ReactOS 0.4.16-dev-125-g798ea90
MinTest Class Reference
Inheritance diagram for MinTest:
Collaboration diagram for MinTest:

Protected Member Functions

void min1 ()
 
void min2 ()
 
void minelem1 ()
 
void minelem2 ()
 

Static Protected Member Functions

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

Private Member Functions

 CPPUNIT_TEST_SUITE (MinTest)
 
 CPPUNIT_TEST (min1)
 
 CPPUNIT_TEST (min2)
 
 CPPUNIT_TEST (minelem1)
 
 CPPUNIT_TEST (minelem2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 13 of file min_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/4]

MinTest::CPPUNIT_TEST ( min1  )
private

◆ CPPUNIT_TEST() [2/4]

MinTest::CPPUNIT_TEST ( min2  )
private

◆ CPPUNIT_TEST() [3/4]

MinTest::CPPUNIT_TEST ( minelem1  )
private

◆ CPPUNIT_TEST() [4/4]

MinTest::CPPUNIT_TEST ( minelem2  )
private

◆ CPPUNIT_TEST_SUITE()

MinTest::CPPUNIT_TEST_SUITE ( MinTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

MinTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ min1()

void MinTest::min1 ( )
protected

Definition at line 36 of file min_test.cpp.

37{
38 int r = min(42, 100);
39 CPPUNIT_ASSERT( r == 42 );
40
41 r = min(--r, r);
42 CPPUNIT_ASSERT( r == 41 );
43}
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define min(a, b)
Definition: monoChain.cc:55

◆ min2()

void MinTest::min2 ( )
protected

Definition at line 44 of file min_test.cpp.

45{
46 const char* r = min((const char*)"shoe", (const char*)"shine", str_compare);
47 CPPUNIT_ASSERT(!strcmp(r, "shine"));
48}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static bool str_compare(const char *a_, const char *b_)
Definition: min_test.cpp:27

◆ minelem1()

void MinTest::minelem1 ( )
protected

Definition at line 49 of file min_test.cpp.

50{
51 int numbers[6] = { -10, 15, -100, 36, -242, 42 };
52 int* r = min_element((int*)numbers, (int*)numbers + 6);
53 CPPUNIT_ASSERT(*r==-242);
54}
_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.c:1828

◆ minelem2()

void MinTest::minelem2 ( )
protected

Definition at line 55 of file min_test.cpp.

56{
57 const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" };
58
59 const unsigned namesCt = sizeof(names) / sizeof(names[0]);
60 const char** r = min_element((const char**)names, (const char**)names + namesCt, str_compare);
61 CPPUNIT_ASSERT(!strcmp(*r, "Brett"));
62}
GLuint GLuint * names
Definition: glext.h:11545

◆ str_compare()

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

Definition at line 27 of file min_test.cpp.

28 { return strcmp(a_, b_) < 0 ? 1 : 0; }

Referenced by min2(), and minelem2().


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