1 #include <algorithm> 2 #include "unary.h" 3 4 #include "cppunit/cppunit_proxy.h" 5 6 #if defined(_STLP_USE_NAMESPACES) 7 using namespace std; 8 #endif 9 10 // 11 // TestCase class 12 // 13 class BcomposTest : public CPPUNIT_NS::TestCase 14 { 15 CPPUNIT_TEST_SUITE(BcomposTest); 16 #if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) 17 CPPUNIT_IGNORE; 18 #endif 19 CPPUNIT_TEST(bcompos1); 20 CPPUNIT_TEST(bcompos2); 21 CPPUNIT_TEST_SUITE_END(); 22 23 protected: 24 void bcompos1(); 25 void bcompos2(); 26 }; 27 28 CPPUNIT_TEST_SUITE_REGISTRATION(BcomposTest); 29 30 // 31 // tests implementation 32 // 33 void BcomposTest::bcompos1() 34 { 35 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) 36 int array [6] = { -2, -1, 0, 1, 2, 3 }; 37 38 binary_compose<logical_and<bool>, odd, positive> 39 b = binary_compose<logical_and<bool>, odd, positive>(logical_and<bool>(), odd(), positive()); 40 41 int* p = find_if((int*)array, (int*)array + 6, b); 42 CPPUNIT_ASSERT(p != array + 6); 43 #endif 44 } 45 46 void BcomposTest::bcompos2() 47 { 48 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) 49 int array [6] = { -2, -1 , 0, 1, 2, 3 }; 50 51 int* p = find_if((int*)array, (int*)array + 6, 52 compose2(logical_and<bool>(), odd(), positive())); 53 CPPUNIT_ASSERT(p != array + 6); 54 #endif 55 } 56