]>
git.ipfire.org Git - thirdparty/squid.git/blob - compat/testPreCompiler.cc
1 #define SQUID_UNIT_TEST 1
8 #include "testPreCompiler.h"
10 CPPUNIT_TEST_SUITE_REGISTRATION( testPreCompiler
);
13 * Test several ways of defining pre-compiler directives.
14 * Squid-3 uses #if FOO syntax for precompiler directives.
15 * These tests ensure that the inputs will work as expected.
18 testPreCompiler::testIfDef()
20 /* Defined to explicit value 1 should be true */
30 bool oneFalse
= false;
32 CPPUNIT_ASSERT(oneTrue
);
33 CPPUNIT_ASSERT(!oneFalse
);
35 /* Defined to explicit value 0 should be false */
40 bool zeroTrue
= false;
43 bool zeroFalse
= true;
45 bool zeroFalse
= false;
47 CPPUNIT_ASSERT(zeroFalse
);
48 CPPUNIT_ASSERT(!zeroTrue
);
50 /* Defined to exist without a value generates pre-compiler errors when used in #if . */
52 /* Not Defined to exist at all == false */
55 bool undefinedTrue
= true;
57 bool undefinedTrue
= false;
60 bool undefinedFalse
= true;
62 bool undefinedFalse
= false;
64 CPPUNIT_ASSERT(undefinedFalse
);
65 CPPUNIT_ASSERT(!undefinedTrue
);