2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-29 05:21:23 +01:00
waf/demos/unit_test/tests/test0/HelloWorldTest.cpp
2011-09-10 11:13:51 +02:00

41 lines
850 B
C++

#include <cppunit/extensions/HelperMacros.h>
#include "HelloWorld.h"
#include <string>
using namespace std;
class HelloWorldTest : public CPPUNIT_NS::TestFixture
{
private:
CPPUNIT_TEST_SUITE( HelloWorldTest );
CPPUNIT_TEST( test0 );
CPPUNIT_TEST( test1 );
CPPUNIT_TEST_SUITE_END();
public:
void test0();
void test1();
};
// Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( HelloWorldTest );
void HelloWorldTest::test0()
{
HelloWorld hello;
string expected("Hello World");
CPPUNIT_ASSERT_EQUAL(expected, hello.message());
}
void HelloWorldTest::test1()
{
string expected("Hola Mundo");
HelloWorld hello(expected);
CPPUNIT_ASSERT_EQUAL(expected, hello.message());
expected = "Hello, world!";
hello.setMessage(expected);
CPPUNIT_ASSERT_EQUAL(expected, hello.message());
}