Revision e19ad051 test/client.cpp

View differences:

test/client.cpp
1 1
// Bring in my package's API, which is what I'm testing
2
#include "client.h"
2
#include "humotion/client/client.h"
3 3
#include <gtest/gtest.h>
4 4
#include <string>
5 5
#include <cstdio>
6 6
using namespace std;
7
using namespace humotion;
8
using namespace humotion::client;
7 9

  
8 10
namespace {
9 11

  
......
11 13
class client_Test : public ::testing::Test {
12 14
protected:
13 15
    client_Test() {
14
		//set-up work for EACH test here
15
        s = new client();
16
        //set-up work for EACH test here
17
        s = new Client("test", "ROS");
18

  
19
    }
16 20

  
17
	}
18
	
19 21
    virtual ~client_Test() {
20
		//clean-up work that doesn't throw exceptions here
21
		delete(s);
22
		s = NULL;
23
	}
24
	
25
	//if the constructor and destructor are not enough for setting up
26
	//and cleaning up each test, you can define the following methods:
27
	virtual void SetUp() {
28
		//code here will be called immediately after the constructor (right before each test).
29
	}
22
        //clean-up work that doesn't throw exceptions here
23
        delete(s);
24
        s = NULL;
25
    }
30 26

  
31
	virtual void TearDown() {
32
		//code here will be called immediately after each test (right
33
		//before the destructor).
34
	}
27
    //if the constructor and destructor are not enough for setting up
28
    //and cleaning up each test, you can define the following methods:
29
    virtual void SetUp() {
30
        //code here will be called immediately after the constructor (right before each test).
31
    }
32

  
33
    virtual void TearDown() {
34
        //code here will be called immediately after each test (right
35
        //before the destructor).
36
    }
35 37

  
36
	//ojects declared here can be used by all tests in the test case for Foo
37
    client *s;
38
    //ojects declared here can be used by all tests in the test case for Foo
39
    Client *s;
38 40
};
39 41

  
40 42
// Tests that the Foo::Bar() method does Abc.
......
64 66

  
65 67
// Run all the tests that were declared with TEST()
66 68
int main(int argc, char **argv){
67
	testing::InitGoogleTest(&argc, argv);
68
	return RUN_ALL_TESTS();
69
    testing::InitGoogleTest(&argc, argv);
70
    return RUN_ALL_TESTS();
69 71
}

Also available in: Unified diff