-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunit_tests.cpp
69 lines (52 loc) · 1.28 KB
/
unit_tests.cpp
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
#include <string>
#include "Reverse.h"
#include "Palindrome.h"
#include "high_load.h"
#include "f1.h"
#include "f2.h"
#define BOOST_TEST_MODULE SampleTestModule
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(reverse_tests)
BOOST_AUTO_TEST_CASE(simple)
{
std::string toRev = "Hello";
Reverse rev;
std::string res = rev.reverse(toRev);
BOOST_CHECK_EQUAL(res, "olleH");
}
BOOST_AUTO_TEST_CASE(empty)
{
std::string toRev;
Reverse rev;
std::string res = rev.reverse(toRev);
BOOST_CHECK_EQUAL(res, "");
}
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(palindrome_tests)
BOOST_AUTO_TEST_CASE(is_palindrome)
{
std::string pal = "mom";
Palindrome pally;
BOOST_CHECK_EQUAL(pally.isPalindrome(pal), true);
}
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(benchmark_tests)
BOOST_AUTO_TEST_CASE( benchmark )
{
std::cout<<"Running benchmark."<<std::endl;
BenchmarkRunner runner;
BOOST_CHECK_EQUAL( runner.benchmark(), true );
}
BOOST_AUTO_TEST_CASE(f1)
{
std::cout << "Running benchmark f1." << std::endl;
F1 f1;
BOOST_CHECK_EQUAL(f1.run(), true);
}
BOOST_AUTO_TEST_CASE(f2)
{
std::cout << "Running benchmark f2." << std::endl;
F2 f2;
BOOST_CHECK_EQUAL(f2.run_python(), true);
}
BOOST_AUTO_TEST_SUITE_END()