-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.test.hpp
72 lines (62 loc) · 1.5 KB
/
.test.hpp
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
/**
* @file
* @copyright Ken Smith kgsmith at gmail.com, 2013.
* @license This software is released under the Boost
* Software License, version 1.0.
* See LICENSE_1_0.txt or
* http://www.boost.org/LICENSE_1_0.txt
*/
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <limits>
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>
#include "stream_saver_t.hpp"
#include "log_t.hpp"
#define TEST BOOST_AUTO_TEST_CASE
#define FTST BOOST_FIXTURE_TEST_CASE
#define EQ BOOST_REQUIRE_EQUAL
#define NE BOOST_REQUIRE_NE
#define CL BOOST_REQUIRE_CLOSE
#define GT BOOST_REQUIRE_GT
#define GE BOOST_REQUIRE_GE
#define LT BOOST_REQUIRE_LT
#define LE BOOST_REQUIRE_LE
#define THROW BOOST_REQUIRE_THROW
#define NO_THROW BOOST_REQUIRE_NO_THROW
inline std::string vecstr(const std::vector<char>& rhs)
{
std::string s(rhs.begin(), rhs.end());
return s;
}
inline std::vector<char> vecstr(const std::string& rhs)
{
std::vector<char> v(rhs.begin(), rhs.end());
return v;
}
inline std::ostream& operator<<(std::ostream& os, const std::vector<char>& rhs)
{
stream_saver_t saver(os);
os
<< "["
<< rhs.size()
<< "]"
<< std::hex << "{";
for (char byte : rhs)
{
os << "0x" << uintptr_t(uint8_t(byte)) << ",";
}
os << "}";
return os;
}
#define testname()\
do\
{\
ooo(iii)\
<< typeid(*this).name();\
} while(false)