aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr2/dynamic_bitset/string.cc
blob: c7d0efac35f5c2efda18eb2e78ff5e10548b14cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// { dg-do run { target c++11 } }

#include <tr2/dynamic_bitset>
#include <string>
#include <testsuite_hooks.h>

void
test_string_ctor()
{
  std::tr2::dynamic_bitset<> b("101001");
  VERIFY( b[0] == true );
  VERIFY( b[1] == false );
  VERIFY( b[2] == false );
  VERIFY( b[3] == true );
  VERIFY( b[4] == false );
  VERIFY( b[5] == true );
}

void
test_alt_chars()
{
  std::string str = "xOIOIOIOx";
  std::tr2::dynamic_bitset<> b(str, 1, 6, 'I', 'O');
  VERIFY( b[0] == false );
  VERIFY( b[1] == true );
  VERIFY( b[2] == false );
  VERIFY( b[3] == true );
  VERIFY( b[4] == false );
  VERIFY( b[5] == true );
}

int main()
{
  test_string_ctor();
  test_alt_chars();
}