ReactOS  0.4.14-dev-384-g5b37caa
MaxTest Class Reference
Inheritance diagram for MaxTest:
Collaboration diagram for MaxTest:

Protected Member Functions

void max1 ()
 
void max2 ()
 
void maxelem1 ()
 
void maxelem2 ()
 

Static Protected Member Functions

static bool str_compare (const char *a_, const char *b_)
 

Private Member Functions

 CPPUNIT_TEST_SUITE (MaxTest)
 
 CPPUNIT_TEST (max1)
 
 CPPUNIT_TEST (max2)
 
 CPPUNIT_TEST (maxelem1)
 
 CPPUNIT_TEST (maxelem2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 13 of file max_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/4]

MaxTest::CPPUNIT_TEST ( max1  )
private

◆ CPPUNIT_TEST() [2/4]

MaxTest::CPPUNIT_TEST ( max2  )
private

◆ CPPUNIT_TEST() [3/4]

MaxTest::CPPUNIT_TEST ( maxelem1  )
private

◆ CPPUNIT_TEST() [4/4]

MaxTest::CPPUNIT_TEST ( maxelem2  )
private

◆ CPPUNIT_TEST_SUITE()

MaxTest::CPPUNIT_TEST_SUITE ( MaxTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

MaxTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ max1()

void MaxTest::max1 ( )
protected

Definition at line 37 of file max_test.cpp.

38 {
39  int r = max(42, 100);
40  CPPUNIT_ASSERT( r == 100 );
41 
42  int t = max(++r, 0);
43  CPPUNIT_ASSERT( t == 101 );
44 }
#define max(a, b)
Definition: svc.c:63
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ max2()

void MaxTest::max2 ( )
protected

Definition at line 45 of file max_test.cpp.

46 {
47  const char* r = max((const char*)"shoe", (const char*)"shine", str_compare);
48  CPPUNIT_ASSERT(!strcmp(r, "shoe"));
49 }
#define max(a, b)
Definition: svc.c:63
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static bool str_compare(const char *a_, const char *b_)
Definition: max_test.cpp:28
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ maxelem1()

void MaxTest::maxelem1 ( )
protected

Definition at line 50 of file max_test.cpp.

51 {
52  int numbers[6] = { 4, 10, 56, 11, -42, 19 };
53 
54  int* r = max_element((int*)numbers, (int*)numbers + 6);
55  CPPUNIT_ASSERT(*r==56);
56 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.c:1800
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ maxelem2()

void MaxTest::maxelem2 ( )
protected

Definition at line 57 of file max_test.cpp.

58 {
59  const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" };
60 
61  const unsigned namesCt = sizeof(names) / sizeof(names[0]);
62  const char** r = max_element((const char**)names, (const char**)names + namesCt, str_compare);
63  CPPUNIT_ASSERT(!strcmp(*r, "Todd"));
64 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static bool str_compare(const char *a_, const char *b_)
Definition: max_test.cpp:28
GLuint GLuint * names
Definition: glext.h:11545
_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.c:1800
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ str_compare()

static bool MaxTest::str_compare ( const char a_,
const char b_ 
)
inlinestaticprotected

Definition at line 28 of file max_test.cpp.

29  { return strcmp(a_, b_) < 0 ? 1 : 0; }
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

The documentation for this class was generated from the following file: