ReactOS 0.4.16-dev-329-g9223134
includes_test.cpp
Go to the documentation of this file.
1#include <cstring>
2#include <vector>
3#include <algorithm>
4
6
7#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
8using namespace std;
9#endif
10
11//
12// TestCase class
13//
14class IncludesTest : public CPPUNIT_NS::TestCase
15{
21
22protected:
23 void incl0();
24 void incl1();
25 void incl2();
26
27 static bool compare_strings(const char* s1_, const char* s2_)
28 {
29 return strcmp(s1_, s2_) < 0 ? 1 : 0;
30 }
31};
32
34
35//
36// tests implementation
37//
39{
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);
45}
47{
48 vector<int> v1(10);
49 vector<int> v2(3);
50 int i;
51 for (i = 0; (size_t)i < v1.size(); ++i) {
52 v1[i] = i;
53 }
54
55 bool r1=includes(v1.begin(), v1.end(), v2.begin(), v2.end());
57
58 for (i = 0; (size_t)i < v2.size(); ++i)
59 v2[i] = i + 3;
60
61 bool r2=includes(v1.begin(), v1.end(), v2.begin(), v2.end());
63}
65{
66 char const* names[] = { "Todd", "Mike", "Graham", "Jack", "Brett"};
67
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) {
71 v1[i] = names[i];
72 }
73 vector <char const*> v2(2);
74
75 v2[0] = "foo";
76 v2[1] = "bar";
77 sort(v1.begin(), v1.end(), compare_strings);
78 sort(v2.begin(), v2.end(), compare_strings);
79
80 bool r1 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings);
82
83 v2[0] = "Brett";
84 v2[1] = "Todd";
85 bool r2 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings);
87}
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
Definition: _algo.c:993
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CPPUNIT_TEST_SUITE(IncludesTest)
CPPUNIT_TEST(incl2)
CPPUNIT_TEST(incl0)
CPPUNIT_TEST(incl1)
CPPUNIT_TEST_SUITE_END()
static bool compare_strings(const char *s1_, const char *s2_)
static struct loaded_include * includes
Definition: compiler.c:53
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition: cppunit_mini.h:193
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
__kernel_size_t size_t
Definition: linux.h:237
GLuint GLuint * names
Definition: glext.h:11545
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
Definition: features.h:417