File indexing completed on 2026-04-09 07:49:15
0001 #include "SBitSet.h"
0002
0003 const char* SPECS = R"LITERAL(
0004 1,10,100,-1
0005 ~1,10,100,-1
0006 t1,10,100,-1
0007 t
0008 ~
0009 ~0
0010 t0
0011 t-1
0012 ~-1
0013 0
0014
0015 0,1,2,3
0016 ~0,1,2,3
0017 )LITERAL" ;
0018
0019 void test_0()
0020 {
0021
0022 unsigned num_bits = 128 ;
0023 bool dump = true ;
0024
0025 bool* bits = new bool[num_bits] ;
0026
0027 std::stringstream ss(SPECS) ;
0028 std::string line ;
0029 while (std::getline(ss, line))
0030 {
0031 const char* spec = line.c_str();
0032 SBitSet::ParseSpec( num_bits, bits, spec, dump );
0033 std::cout
0034 << std::setw(20) << spec
0035 << " : "
0036 << SBitSet::Desc(num_bits, bits, false )
0037 << std::endl
0038 ;
0039 }
0040 }
0041
0042 void test_1()
0043 {
0044 SBitSet* bs = new SBitSet(128);
0045
0046 std::stringstream ss(SPECS) ;
0047 std::string line ;
0048 while (std::getline(ss, line))
0049 {
0050 const char* spec = line.c_str();
0051
0052 bs->parse_spec(spec);
0053
0054 std::cout
0055 << std::setw(20) << spec
0056 << " : "
0057 << bs->desc()
0058 << std::endl
0059 ;
0060
0061 }
0062
0063 delete bs ;
0064 }
0065
0066
0067 void test_2()
0068 {
0069 std::stringstream ss(SPECS) ;
0070 std::string line ;
0071 while (std::getline(ss, line))
0072 {
0073 const char* spec = line.c_str();
0074 SBitSet* bs = SBitSet::Create(128, spec);
0075 std::cout
0076 << std::setw(20) << spec
0077 << " : "
0078 << bs->desc()
0079 << std::endl
0080 ;
0081
0082 delete bs ;
0083 }
0084 }
0085
0086
0087 int main(int argc, char** argv)
0088 {
0089 test_0();
0090 test_1();
0091 test_2();
0092
0093 return 0 ;
0094 }