Commit b4a90631 authored by Yushin Washio's avatar Yushin Washio
Browse files

adjust Makefile and PersonenTestSuite to the format of CxxTest

parent 4aae5d4c
all: test.o
test.o: test.cpp ../Person.h
$(CXX) -I../ -o $@ $<
CXXTEST = cxxtest
CXXTESTGEN = $(CXXTEST)/bin/cxxtestgen
INCLUDE = \
-I$(CXXTEST)\
-I../
person_runner.cpp: PersonTestSuite.h
$(CXXTESTGEN) --error-printer -o $@ $<
test.o: person_runner.cpp ../Person.h
$(CXX) $(INCLUDE) -o $@ $<
clean:
-$(RM) *.o
-$(RM) *_runner.cpp
#include <iostream>
#include <string>
#include <cassert>
#include <cxxtest/TestSuite.h>
#include "Person.h"
using namespace std;
void T_Person_drone_hello_none()
class PersonTestSuite : public CxxTest::TestSuite
{
Person drone("drone");
assert(drone.hello() == "Hi, how are you?"); // T_Person_drone_hello_none
cout << "T_Person_drone_hello_none completed" << endl;
}
public:
void test_Person_drone_hello_none(void)
{
Person drone("drone");
TS_ASSERT_EQUALS(drone.hello(), "Hi, how are you?"); // T_Person_drone_hello_none
TS_TRACE("T_Person_drone_hello_none completed");
}
void T_Person_drone_hello_electrobmw()
{
Person drone("drone");
Person electrobmw("electrobmw");
assert(drone.hello(electrobmw) == "Hi electrobmw, how are you?"); // T_Person_drone_hello_electrobmw
cout << "T_Person_drone_hello_electrobmw completed" << endl;
}
void test_Person_drone_hello_electrobmw(void)
{
Person drone("drone");
Person electrobmw("electrobmw");
TS_ASSERT_EQUALS(drone.hello(electrobmw), "Hi electrobmw, how are you?"); // T_Person_drone_hello_electrobmw
TS_TRACE("T_Person_drone_hello_electrobmw completed");
}
void T_Person_drone_hello_President()
{
Person drone("drone");
Person president("Barack Obama");
// this will fail!
assert(drone.hello(president) == "His Excellency, how are you?"); // T_Person_drone_hello_President
cout << "T_Person_drone_hello_President completed" << endl;
}
int main (int argc, char *argv[])
{
T_Person_drone_hello_none();
T_Person_drone_hello_electrobmw();
T_Person_drone_hello_President();
cout << "All tests completed" << endl;
}
void test_Person_drone_hello_President(void)
{
Person drone("drone");
Person president("Barack Obama");
// this will fail!
TS_ASSERT_EQUALS(drone.hello(president), "His Excellency, how are you?"); // T_Person_drone_hello_President
TS_TRACE("T_Person_drone_hello_President completed");
}
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment