Update contrib.
5 #include "cppunit/cppunit_proxy.h"
7 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
14 class IncludesTest : public CPPUNIT_NS::TestCase
16 CPPUNIT_TEST_SUITE(IncludesTest);
20 CPPUNIT_TEST_SUITE_END();
27 static bool compare_strings(const char* s1_, const char* s2_)
29 return strcmp(s1_, s2_) < 0 ? 1 : 0;
33 CPPUNIT_TEST_SUITE_REGISTRATION(IncludesTest);
36 // tests implementation
38 void IncludesTest::incl0()
40 int numbers1[5] = { 1, 2, 3, 4, 5 };
41 //int numbers2[5] = { 1, 2, 4, 8, 16 };
42 int numbers3[2] = { 4, 8 };
43 bool r1=includes(numbers1, numbers1 + 5, numbers3, numbers3 + 2);
46 void IncludesTest::incl1()
51 for (i = 0; (size_t)i < v1.size(); ++i) {
55 bool r1=includes(v1.begin(), v1.end(), v2.begin(), v2.end());
58 for (i = 0; (size_t)i < v2.size(); ++i)
61 bool r2=includes(v1.begin(), v1.end(), v2.begin(), v2.end());
64 void IncludesTest::incl2()
66 char const* names[] = { "Todd", "Mike", "Graham", "Jack", "Brett"};
68 const unsigned nameSize = sizeof(names)/sizeof(names[0]);
69 vector <char const*> v1(nameSize);
70 for (int i = 0; (size_t)i < v1.size(); ++i) {
73 vector <char const*> v2(2);
77 sort(v1.begin(), v1.end(), compare_strings);
78 sort(v2.begin(), v2.end(), compare_strings);
80 bool r1 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings);
85 bool r2 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings);