utestTest.cpp 851 Bytes
Newer Older
1 2
// See LICENCE file at project root

3 4
#include "FUTester.hpp"

5
// compile by g++ utestTest.cpp -o utestTest.exe
6 7 8 9 10 11 12 13

/** this class show a simple example of unit test */
class MyTest : public FUTester<MyTest> {
	void Before(){
		Print("Before running the test");
	}

	void TestOne(){
14 15 16
                uassert(true);
                //or uassert(false); make an error
                uassert(1 == 1);
17
	}
18

19 20
	void TestTwo(){
		equal(1 , 1);
21
                different(1 , 2);
22
	}
23

24 25 26
	void After(){
		Print("After running the test");
	}
27

28 29 30
	void PreTest(){
		Print("Before each test");
	}
31

32 33 34
	void PostTest(){
		Print("After each test");
	}
35

36 37 38 39 40 41 42 43 44
	// You must implement it
	void SetTests(){
            AddTest(&MyTest::TestOne);
            AddTest(&MyTest::TestTwo,"My Second Test");
	}
};

// You must do this
TestClass(MyTest)