32 #include "DGtal/base/Common.h"
33 #include "DGtal/base/BasicBoolFunctors.h"
37 using namespace DGtal;
40 #define INBLOCK_TEST(x) \
41 nbok += ( x ) ? 1 : 0; \
43 trace.info() << "(" << nbok << "/" << nb << ") " \
46 #define INBLOCK_TEST2(x,y) \
47 nbok += ( x ) ? 1 : 0; \
49 trace.info() << "(" << nbok << "/" << nb << ") " \
61 unsigned int nbok = 0;
66 nbok += trueBF0() ==
true ? 1 : 0;
68 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
69 <<
"true() == true" << std::endl;
72 nbok += falseBF0() ==
false ? 1 : 0;
74 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
75 <<
"false() == false" << std::endl;
78 nbok += identityBF1(
true ) ==
true ? 1 : 0;
80 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
81 <<
"id(true) == true" << std::endl;
82 nbok += identityBF1(
false ) ==
false ? 1 : 0;
84 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
85 <<
"id(false) == false" << std::endl;
88 nbok += notBF1(
true ) ==
false ? 1 : 0;
90 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
91 <<
"not(true) == false" << std::endl;
92 nbok += notBF1(
false ) ==
true ? 1 : 0;
94 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
95 <<
"not(false) == true" << std::endl;
98 nbok += andBF2(
true,
true ) ==
true ? 1 : 0;
100 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
101 <<
"and( true, true ) == true" << std::endl;
102 nbok += andBF2(
false,
true ) ==
false ? 1 : 0;
104 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
105 <<
"and( false, true ) == false" << std::endl;
106 nbok += andBF2(
true,
false ) ==
false ? 1 : 0;
108 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
109 <<
"and( true, false ) == false" << std::endl;
110 nbok += andBF2(
false,
false ) ==
false ? 1 : 0;
112 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
113 <<
"and( false, false ) == false" << std::endl;
116 nbok += orBF2(
true,
true ) ==
true ? 1 : 0;
118 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
119 <<
"or( true, true ) == true" << std::endl;
120 nbok += orBF2(
false,
true ) ==
true ? 1 : 0;
122 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
123 <<
"or( false, true ) == true" << std::endl;
124 nbok += orBF2(
true,
false ) ==
true ? 1 : 0;
126 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
127 <<
"or( true, false ) == true" << std::endl;
128 nbok += orBF2(
false,
false ) ==
false ? 1 : 0;
130 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
131 <<
"or( false, false ) == true" << std::endl;
134 INBLOCK_TEST2( xorBF2(
true,
true ) ==
false,
"xor( true, true ) == false" );
135 INBLOCK_TEST2( xorBF2(
false,
true ) ==
true,
"xor( false, true ) == true" );
136 INBLOCK_TEST2( xorBF2(
true,
false ) ==
true,
"xor( true, false ) == true" );
137 INBLOCK_TEST2( xorBF2(
false,
false ) ==
false,
"xor( false, false ) == false" );
141 "implies( true, true ) == true" );
143 "implies( false, true ) == true" );
145 "implies( true, false ) == false" );
147 "implies( false, false ) == true" );
157 int main(
int argc,
char** argv )
161 for (
int i = 0; i < argc; ++i )
166 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
functors namespace gathers all DGtal functors.
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
bool testBasicBoolFunctors()
#define INBLOCK_TEST2(x, y)