| 1 |
// { dg-do run { target c++11 } } |
| 2 |
|
| 3 |
#include <tr2/dynamic_bitset> |
| 4 |
#include <string> |
| 5 |
#include <testsuite_hooks.h> |
| 6 |
|
| 7 |
void |
| 8 |
test_string_ctor() |
| 9 |
{ |
| 10 |
std::tr2::dynamic_bitset<> b("101001"); |
| 11 |
VERIFY( b[0] == true ); |
| 12 |
VERIFY( b[1] == false ); |
| 13 |
VERIFY( b[2] == false ); |
| 14 |
VERIFY( b[3] == true ); |
| 15 |
VERIFY( b[4] == false ); |
| 16 |
VERIFY( b[5] == true ); |
| 17 |
} |
| 18 |
|
| 19 |
void |
| 20 |
test_alt_chars() |
| 21 |
{ |
| 22 |
std::string str = "xOIOIOIOx"; |
| 23 |
std::tr2::dynamic_bitset<> b(str, 1, 6, 'I', 'O'); |
| 24 |
VERIFY( b[0] == false ); |
| 25 |
VERIFY( b[1] == true ); |
| 26 |
VERIFY( b[2] == false ); |
| 27 |
VERIFY( b[3] == true ); |
| 28 |
VERIFY( b[4] == false ); |
| 29 |
VERIFY( b[5] == true ); |
| 30 |
} |
| 31 |
|
| 32 |
int main() |
| 33 |
{ |
| 34 |
test_string_ctor(); |
| 35 |
test_alt_chars(); |
| 36 |
} |