JayBeams  0.1
Another project to have fun coding.
ut_fixed_string.cpp
Go to the documentation of this file.
1 #include <jb/fixed_string.hpp>
2 
3 #include <boost/test/unit_test.hpp>
4 
5 /**
6  * @test Verify that jb::mktdata::fixed_string works as expected.
7  */
8 BOOST_AUTO_TEST_CASE(fixed_string_basic) {
9  int constexpr size = 8;
10  typedef jb::fixed_string<size> tested_type;
11 
12  tested_type t;
13  t = std::string("ABC");
14  BOOST_CHECK_EQUAL(t, std::string("ABC "));
15  std::ostringstream os;
16  os << t;
17  BOOST_CHECK_EQUAL(os.str(), "ABC ");
18 
19  tested_type a("ABC");
20  tested_type b("BCD");
21  BOOST_CHECK_LT(a, b);
22  BOOST_CHECK_LE(a, b);
23  BOOST_CHECK_LE(a, a);
24  BOOST_CHECK_GT(b, a);
25  BOOST_CHECK_GE(b, a);
26  BOOST_CHECK_GE(b, b);
27  BOOST_CHECK_NE(a, b);
28 }
A helper type to define short (and fixed sized) string fields.
BOOST_AUTO_TEST_CASE(fixed_string_basic)