test_GVO.cpp
3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/***************************************************************************
* test_GVO.hpp - Test VO module *
* ----------------------------------------------------------------------- *
* copyright (C) 2013 by Juergen Knoedlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
/**
* @file test_GVO.hpp
* @brief Implementation of unit tests for VO module
* @author Juergen Knoedlseder
*/
/* __ Includes ___________________________________________________________ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "test_GVO.hpp"
#include "GTools.hpp"
/***********************************************************************//**
* @brief Set parameters and tests
**************************************************************************/
void TestGVO::set(void)
{
// Test name
name("GVO");
// Append tests
append(static_cast<pfunction>(&TestGVO::test_GVOClient), "Test GVOClient class");
// Return
return;
}
/***********************************************************************//**
* @brief Clone test suite
*
* @return Pointer to deep copy of test suite.
***************************************************************************/
TestGVO* TestGVO::clone(void) const
{
// Clone test suite
return new TestGVO(*this);
}
/***********************************************************************//**
* @brief Test VO client class
**************************************************************************/
void TestGVO::test_GVOClient(void)
{
// Test constructor
test_try("GVOClient empty constructor");
try {
GVOClient client;
std::cout << client << std::endl;
test_try_success();
}
catch (std::exception &e) {
test_try_failure(e);
}
// Test Hub connection
test_try("GVOClient hub connection and disconnection");
try {
GVOClient client;
client.connect();
std::cout << client << std::endl;
client.disconnect();
std::cout << client << std::endl;
test_try_success();
}
catch (std::exception &e) {
test_try_failure(e);
}
// Return
return;
}
/***************************************************************************
* @brief Main entry point for test executable
***************************************************************************/
int main(void)
{
// Allocate test suit container
GTestSuites testsuites("VO module");
// Initially assume that we pass all tests
bool success = true;
// Create a test suite
TestGVO test;
// Append test suite to the container
testsuites.append(test);
// Run the testsuites
success = testsuites.run();
// Save test report
testsuites.save("reports/GVO.xml");
// Return success status
return (success ? 0 : 1);
}