Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Macros | Enumerations | Functions | Variables
23.bitset.cons.cpp File Reference
#include <bitset>
#include <stdexcept>
#include <string>
#include <cstddef>
#include <rw_char.h>
#include <rw_driver.h>
Include dependency graph for 23.bitset.cons.cpp:

Go to the source code of this file.

Macros

#define DO_TEST(T, val)
 
#define DO_TEST(N, str, pos, n, except)
 
#define CTOR_INFO(N)
 
#define TEST_1(N, str, except)   DO_TEST(N, str, -1, -1, except)
 
#define FILL(pfx, bit, N, sfx)   fillstr (pfx, bit, N, sfx).c_str ()
 
#define CTOR_INFO(N)
 
#define TEST_2(N, str, pos, except)   DO_TEST(N, str, pos, -1, except)
 
#define CTOR_INFO(N)
 
#define TEST_3(N, str, pos, n, except)   DO_TEST(N, str, pos, n, except)
 
#define DO_TEST(N)   test_ctors ((std::bitset<N>*)0)
 

Enumerations

enum  { InvalidArgument = 1 , OutOfRange }
 

Functions

template<std::size_t N>
int bcmp (const std::bitset< N > &bset, const char *str)
 
const char * ulong_to_bitstring (unsigned long val, std::size_t bits)
 
template<std::size_t N>
void test_default_ctor (std::bitset< N > *)
 
template<std::size_t N>
void test_long_ctor (std::bitset< N > *)
 
template<std::size_t N, class Traits , class Allocator >
std::bitset< N > bitset_ctor (std::bitset< N > *, const std::basic_string< char, Traits, Allocator > *bstr, const char *str, std::size_t pos, std::size_t n, const char bin_digits[2])
 
template<std::size_t N, class Traits , class Allocator >
std::bitset< N > bitset_ctor (std::bitset< N > *, const std::basic_string< wchar_t, Traits, Allocator > *bstr, const wchar_t *wstr, std::size_t pos, std::size_t n, const wchar_t bin_digits[2])
 
template<std::size_t N, class Traits , class Allocator >
std::bitset< N > bitset_ctor (std::bitset< N > *, const std::basic_string< UserChar, Traits, Allocator > *bstr, const UserChar *, std::size_t pos, std::size_t n, const UserChar bin_digits[2])
 
template<std::size_t N, class charT , class Traits , class Allocator >
std::bitset< N > bitset_ctor (std::bitset< N > *, std::basic_string< charT, Traits, Allocator > *p, const char *str, std::size_t pos, std::size_t n)
 
template<class charT >
const char * type_prefix (charT)
 
const char * type_prefix (wchar_t)
 
template<std::size_t N, class charT , class Traits , class Allocator >
void test_string_ctor (std::bitset< N > *, std::basic_string< charT, Traits, Allocator > *p, int line, const char *str, std::size_t pos, std::size_t n, const char *bitstr)
 
std::string fillstr (const char *pfx, int bit, std::size_t count, const char *sfx)
 
template<class charT , class Traits , class Allocator >
void test_string_ctor (std::basic_string< charT, Traits, Allocator > *p, const char *cname)
 
template<std::size_t N>
void test_ctors (std::bitset< N > *pb)
 
template<class Traits >
void test_ctors (const Traits *, const char *cname)
 
int main (int argc, char *argv[])
 

Variables

int opt_char
 
int opt_wchar
 
int opt_userchar
 
int opt_no_exceptions
 

Macro Definition Documentation

◆ CTOR_INFO [1/3]

#define CTOR_INFO (   N)
Value:
rw_info (0, 0, __LINE__, "std::bitset<%i>::bitset(const " \
"%{?}std::basic_string<%s>&%{:}%3$s%{;})", \
N, 0 != p, cname)
#define N
Definition 17.names.cpp:157
#define p
Definition 17.names.cpp:132
_TEST_EXPORT int rw_info(int, const char *, int, const char *,...)
Definition driver.cpp:1681

◆ CTOR_INFO [2/3]

#define CTOR_INFO (   N)
Value:
rw_info (0, 0, __LINE__, "std::bitset<%i>::bitset(const " \
"%{?}std::basic_string<%s>&%{:}%3$s%{;}, size_t)", \
N, 0 != p, cname)

◆ CTOR_INFO [3/3]

#define CTOR_INFO (   N)
Value:
rw_info (0, 0, __LINE__, "std::bitset<%i>::bitset(const " \
"%{?}std::basic_string<%s>&%{:}%3$s%{;}, size_t, size_t)", \
N, 0 != p, cname)

◆ DO_TEST [1/3]

#define DO_TEST (   N)    test_ctors ((std::bitset<N>*)0)

◆ DO_TEST [2/3]

#define DO_TEST (   N,
  str,
  pos,
  n,
  except 
)
Value:
test_string_ctor ((std::bitset<N>*)0, p, __LINE__, \
str, std::size_t (pos), std::size_t (n), \
(const char*)except)
#define n
Definition 17.names.cpp:130
#define pos
Definition 17.names.cpp:518
void test_string_ctor(std::bitset< N > *, std::basic_string< charT, Traits, Allocator > *p, int line, const char *str, std::size_t pos, std::size_t n, const char *bitstr)
const char * str
Definition exec.cpp:170

◆ DO_TEST [3/3]

#define DO_TEST (   T,
  val 
)
Value:
do { \
const T v = val; \
const std::bitset<N> bset (v); \
const char* const bstr = ulong_to_bitstring (val, N); \
rw_assert (!bcmp (bset, (const char*)bstr), 0, __LINE__, \
"bitset<%u>::bitset(%zu) == { %{.*b} }, " \
"got { %{.*b} }", N, val, bstr, int (N), &bset); \
} while (0)
#define T
Definition 17.names.cpp:163
#define v
Definition 17.names.cpp:138
#define val
Definition 17.names.cpp:570
const char * ulong_to_bitstring(unsigned long val, std::size_t bits)
int bcmp(const std::bitset< N > &bset, const char *str)

◆ FILL

#define FILL (   pfx,
  bit,
  N,
  sfx 
)    fillstr (pfx, bit, N, sfx).c_str ()

◆ TEST_1

#define TEST_1 (   N,
  str,
  except 
)    DO_TEST(N, str, -1, -1, except)

◆ TEST_2

#define TEST_2 (   N,
  str,
  pos,
  except 
)    DO_TEST(N, str, pos, -1, except)

◆ TEST_3

#define TEST_3 (   N,
  str,
  pos,
  n,
  except 
)    DO_TEST(N, str, pos, n, except)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
InvalidArgument 
OutOfRange 

Definition at line 340 of file 23.bitset.cons.cpp.

Function Documentation

◆ bcmp()

template<std::size_t N>
int bcmp ( const std::bitset< N > &  bset,
const char *  str 
)

Definition at line 48 of file 23.bitset.cons.cpp.

◆ bitset_ctor() [1/4]

template<std::size_t N, class Traits , class Allocator >
std::bitset< N > bitset_ctor ( std::bitset< N > *  ,
const std::basic_string< char, Traits, Allocator > *  bstr,
const char *  str,
std::size_t  pos,
std::size_t  n,
const char  bin_digits[2] 
)

Definition at line 163 of file 23.bitset.cons.cpp.

◆ bitset_ctor() [2/4]

template<std::size_t N, class Traits , class Allocator >
std::bitset< N > bitset_ctor ( std::bitset< N > *  ,
const std::basic_string< UserChar, Traits, Allocator > *  bstr,
const UserChar *  ,
std::size_t  pos,
std::size_t  n,
const UserChar  bin_digits[2] 
)

Definition at line 271 of file 23.bitset.cons.cpp.

◆ bitset_ctor() [3/4]

template<std::size_t N, class Traits , class Allocator >
std::bitset< N > bitset_ctor ( std::bitset< N > *  ,
const std::basic_string< wchar_t, Traits, Allocator > *  bstr,
const wchar_t *  wstr,
std::size_t  pos,
std::size_t  n,
const wchar_t  bin_digits[2] 
)

Definition at line 217 of file 23.bitset.cons.cpp.

◆ bitset_ctor() [4/4]

template<std::size_t N, class charT , class Traits , class Allocator >
std::bitset< N > bitset_ctor ( std::bitset< N > *  ,
std::basic_string< charT, Traits, Allocator > *  p,
const char *  str,
std::size_t  pos,
std::size_t  n 
)

Definition at line 300 of file 23.bitset.cons.cpp.

◆ fillstr()

std::string fillstr ( const char *  pfx,
int  bit,
std::size_t  count,
const char *  sfx 
)

Definition at line 407 of file 23.bitset.cons.cpp.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 833 of file 23.bitset.cons.cpp.

◆ test_ctors() [1/2]

template<class Traits >
void test_ctors ( const Traits *  ,
const char *  cname 
)

Definition at line 734 of file 23.bitset.cons.cpp.

◆ test_ctors() [2/2]

template<std::size_t N>
void test_ctors ( std::bitset< N > *  pb)

Definition at line 725 of file 23.bitset.cons.cpp.

◆ test_default_ctor()

template<std::size_t N>
void test_default_ctor ( std::bitset< N > *  )

Definition at line 89 of file 23.bitset.cons.cpp.

◆ test_long_ctor()

template<std::size_t N>
void test_long_ctor ( std::bitset< N > *  )

Definition at line 108 of file 23.bitset.cons.cpp.

◆ test_string_ctor() [1/2]

template<class charT , class Traits , class Allocator >
void test_string_ctor ( std::basic_string< charT, Traits, Allocator > *  p,
const char *  cname 
)

Definition at line 417 of file 23.bitset.cons.cpp.

◆ test_string_ctor() [2/2]

template<std::size_t N, class charT , class Traits , class Allocator >
void test_string_ctor ( std::bitset< N > *  ,
std::basic_string< charT, Traits, Allocator > *  p,
int  line,
const char *  str,
std::size_t  pos,
std::size_t  n,
const char *  bitstr 
)

Definition at line 343 of file 23.bitset.cons.cpp.

◆ type_prefix() [1/2]

template<class charT >
const char * type_prefix ( charT  )

Definition at line 332 of file 23.bitset.cons.cpp.

◆ type_prefix() [2/2]

const char * type_prefix ( wchar_t  )

Definition at line 336 of file 23.bitset.cons.cpp.

◆ ulong_to_bitstring()

const char * ulong_to_bitstring ( unsigned long  val,
std::size_t  bits 
)

Definition at line 68 of file 23.bitset.cons.cpp.

Variable Documentation

◆ opt_char

int opt_char

23.bitset.cons.cpp - test exercising [lib.bitset.cons]

$Id$

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2004-2006 Rogue Wave Software.

Definition at line 40 of file 23.bitset.cons.cpp.

◆ opt_no_exceptions

int opt_no_exceptions

Definition at line 43 of file 23.bitset.cons.cpp.

◆ opt_userchar

int opt_userchar

Definition at line 42 of file 23.bitset.cons.cpp.

◆ opt_wchar

int opt_wchar

Definition at line 41 of file 23.bitset.cons.cpp.