39 #if !defined(TAWARA_TEST_UTILS_H_)
40 #define TAWARA_TEST_UTILS_H_
42 #include <boost/shared_ptr.hpp>
44 #include <gtest/gtest.h>
55 typedef boost::shared_ptr<tawara::Element>
ElPtr;
59 :
public std::binary_function<uint64_t, ElPtr, uint64_t>
63 return total + el->size();
71 std::basic_string<uint8_t>
const& b1,
72 std::basic_string<uint8_t>
const& b2);
76 char const* b2_expr, std::string
const& b1, std::string
const& b2);
80 char const* b2_expr, std::vector<char>
const& b1,
81 std::vector<char>
const& b2);
85 template<
typename T1,
typename T2>
86 ::testing::AssertionResult
pairs_eq(
char const* p1_expr,
87 char const* p2_expr,
typename std::pair<uint64_t, T1>
const& p1,
88 typename std::pair<uint64_t, T2>
const& p2)
90 if (p1.first != p2.first || p1.second != p2.second)
92 return ::testing::AssertionFailure() << p1_expr <<
" (" << p1.first <<
93 ", " << p1.second <<
") != " << p2_expr <<
" (" << p2.first <<
94 ", " << p2.second <<
")";
96 return ::testing::AssertionSuccess();
101 boost::shared_ptr<std::vector<char> >
make_blob(
size_t size);
105 #endif // TAWARA_TEST_UTILS_H_
::testing::AssertionResult pairs_eq(char const *p1_expr, char const *p2_expr, typename std::pair< uint64_t, T1 > const &p1, typename std::pair< uint64_t, T2 > const &p2)
boost::shared_ptr< tawara::Element > ElPtr
std::streamsize size(ID id)
Get the number of bytes required by an ID.
::testing::AssertionResult std_buffers_eq(char const *b1_expr, char const *b2_expr, std::basic_string< uint8_t > const &b1, std::basic_string< uint8_t > const &b2)
boost::shared_ptr< std::vector< char > > make_blob(size_t size)
uint64_t operator()(uint64_t total, ElPtr el)
::testing::AssertionResult std_vectors_eq(char const *b1_expr, char const *b2_expr, std::vector< char > const &b1, std::vector< char > const &b2)