@@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(id_test_uuid)
33
33
wsrep::id id (uuid_str);
34
34
std::ostringstream os;
35
35
os << id;
36
- BOOST_REQUIRE (uuid_str == os.str ());
36
+ BOOST_REQUIRE_EQUAL (uuid_str, os.str ());
37
37
}
38
38
39
39
BOOST_AUTO_TEST_CASE (id_test_string)
@@ -42,16 +42,19 @@ BOOST_AUTO_TEST_CASE(id_test_string)
42
42
wsrep::id id (id_str);
43
43
std::ostringstream os;
44
44
os << id;
45
- BOOST_REQUIRE (id_str == os.str ());
45
+ BOOST_REQUIRE_EQUAL (id_str, os.str ());
46
46
}
47
47
48
48
BOOST_AUTO_TEST_CASE (id_test_string_max)
49
49
{
50
- std::string id_str (" 1234567890123456" );
50
+ std::string id_str (" 1234"
51
+ " 5678"
52
+ " 9012"
53
+ " 3456" );
51
54
wsrep::id id (id_str);
52
55
std::ostringstream os;
53
56
os << id;
54
- BOOST_REQUIRE (id_str == os.str ());
57
+ BOOST_REQUIRE_EQUAL ( os.str (), " 31323334-3536-3738-3930-313233343536 " );
55
58
}
56
59
57
60
BOOST_AUTO_TEST_CASE (id_test_string_too_long)
@@ -67,7 +70,7 @@ BOOST_AUTO_TEST_CASE(id_test_binary)
67
70
wsrep::id id (data, sizeof (data));
68
71
std::ostringstream os;
69
72
os << id;
70
- BOOST_REQUIRE (os.str () == " 01020304-0506-0708-0900-010203040506" );
73
+ BOOST_REQUIRE_EQUAL (os.str (), " 01020304-0506-0708-0900-010203040506" );
71
74
}
72
75
73
76
BOOST_AUTO_TEST_CASE (id_test_binary_too_long)
@@ -76,3 +79,37 @@ BOOST_AUTO_TEST_CASE(id_test_binary_too_long)
76
79
BOOST_REQUIRE_EXCEPTION (wsrep::id id (data, sizeof (data)),
77
80
wsrep::runtime_error, exception_check);;
78
81
}
82
+
83
+ BOOST_AUTO_TEST_CASE (id_test_binary_all_alphanumeric)
84
+ {
85
+ char data[16 ] = {' a' , ' a' , ' a' , ' a' ,
86
+ ' a' , ' a' , ' a' , ' a' ,
87
+ ' a' , ' a' , ' a' , ' a' ,
88
+ ' a' , ' a' , ' a' , ' a' };
89
+ wsrep::id id (data, sizeof (data));
90
+ std::ostringstream os;
91
+ os << id;
92
+ /* Value of 'a' is 97 in ASCII, which is 0x61 in hex. */
93
+ BOOST_REQUIRE_EQUAL (os.str (), " 61616161-6161-6161-6161-616161616161" );
94
+ }
95
+
96
+ BOOST_AUTO_TEST_CASE (id_test_binary_all_except_middle_alphanumeric)
97
+ {
98
+ char data[16 ] = {' a' , ' a' , ' a' , ' a' ,
99
+ ' a' , ' a' , ' a' , ' a' ,
100
+ ' a' , ' a' , ' \0 ' , ' a' ,
101
+ ' a' , ' a' , ' a' , ' a' };
102
+ wsrep::id id (data, sizeof (data));
103
+ std::ostringstream os;
104
+ os << id;
105
+ BOOST_REQUIRE_EQUAL (os.str (), " 61616161-6161-6161-6161-006161616161" );
106
+ }
107
+
108
+ BOOST_AUTO_TEST_CASE (id_test_null)
109
+ {
110
+ char data[16 ] = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
111
+ wsrep::id id (data, sizeof (data));
112
+ std::ostringstream os;
113
+ os << id;
114
+ BOOST_REQUIRE_EQUAL (os.str (), " 00000000-0000-0000-0000-000000000000" );
115
+ }
0 commit comments