diff options
| author | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
| commit | 5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch) | |
| tree | afde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/utilities/template.bitset/bitset.members/to_string.pass.cpp | |
| parent | f11e8eab527fba316c64112f6e05de1a79693a3e (diff) | |
| download | bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip | |
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/utilities/template.bitset/bitset.members/to_string.pass.cpp')
| -rw-r--r-- | libcxx/test/utilities/template.bitset/bitset.members/to_string.pass.cpp | 162 |
1 files changed, 0 insertions, 162 deletions
diff --git a/libcxx/test/utilities/template.bitset/bitset.members/to_string.pass.cpp b/libcxx/test/utilities/template.bitset/bitset.members/to_string.pass.cpp deleted file mode 100644 index b6579409747..00000000000 --- a/libcxx/test/utilities/template.bitset/bitset.members/to_string.pass.cpp +++ /dev/null @@ -1,162 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test: - -// template <class charT, class traits, class Allocator> -// basic_string<charT, traits, Allocator> -// to_string(charT zero = charT('0'), charT one = charT('1')) const; -// -// template <class charT, class traits> -// basic_string<charT, traits, allocator<charT> > to_string() const; -// -// template <class charT> -// basic_string<charT, char_traits<charT>, allocator<charT> > to_string() const; -// -// basic_string<char, char_traits<char>, allocator<char> > to_string() const; - -#include <bitset> -#include <string> -#include <cstdlib> -#include <cassert> - -#pragma clang diagnostic ignored "-Wtautological-compare" - -template <std::size_t N> -std::bitset<N> -make_bitset() -{ - std::bitset<N> v; - for (std::size_t i = 0; i < N; ++i) - v[i] = static_cast<bool>(std::rand() & 1); - return v; -} - -template <std::size_t N> -void test_to_string() -{ -{ - std::bitset<N> v = make_bitset<N>(); - { - std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >(); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >(); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::string s = v.template to_string<char>(); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::string s = v.to_string(); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } -} -{ - std::bitset<N> v = make_bitset<N>(); - { - std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >('0'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >('0'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::string s = v.template to_string<char>('0'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::string s = v.to_string('0'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } -} -{ - std::bitset<N> v = make_bitset<N>(); - { - std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >('0', '1'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::wstring s = v.template to_string<wchar_t, std::char_traits<wchar_t> >('0', '1'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::string s = v.template to_string<char>('0', '1'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } - { - std::string s = v.to_string('0', '1'); - for (std::size_t i = 0; i < N; ++i) - if (v[i]) - assert(s[N - 1 - i] == '1'); - else - assert(s[N - 1 - i] == '0'); - } -} -} - -int main() -{ - test_to_string<0>(); - test_to_string<1>(); - test_to_string<31>(); - test_to_string<32>(); - test_to_string<33>(); - test_to_string<63>(); - test_to_string<64>(); - test_to_string<65>(); - test_to_string<1000>(); -} |

