1+ #include < tst/check.hpp>
2+ #include < tst/set.hpp>
3+ #include < utki/version.hpp>
4+
5+ using namespace std ::string_literals;
6+
7+ namespace {
8+ const tst::set set (" version" , [](tst::suite& suite) {
9+ suite.add (" version_duplet__to_uint32_t" , []() {
10+ utki::version_duplet dp = {10 , 20 };
11+
12+ tst::check_eq (dp.to_uint32_t (), utki::version_duplet{10 , 20 }.to_uint32_t (), SL );
13+
14+ tst::check_ne (dp.to_uint32_t (), utki::version_duplet{11 , 20 }.to_uint32_t (), SL );
15+ tst::check_ne (dp.to_uint32_t (), utki::version_duplet{10 , 21 }.to_uint32_t (), SL );
16+ tst::check_ne (dp.to_uint32_t (), utki::version_duplet{11 , 21 }.to_uint32_t (), SL );
17+
18+ tst::check_lt (dp.to_uint32_t (), utki::version_duplet{11 , 20 }.to_uint32_t (), SL );
19+ tst::check_lt (dp.to_uint32_t (), utki::version_duplet{10 , 21 }.to_uint32_t (), SL );
20+ tst::check_lt (dp.to_uint32_t (), utki::version_duplet{11 , 21 }.to_uint32_t (), SL );
21+
22+ tst::check_le (dp.to_uint32_t (), utki::version_duplet{11 , 20 }.to_uint32_t (), SL );
23+ tst::check_le (dp.to_uint32_t (), utki::version_duplet{10 , 21 }.to_uint32_t (), SL );
24+ tst::check_le (dp.to_uint32_t (), utki::version_duplet{11 , 21 }.to_uint32_t (), SL );
25+ tst::check_le (dp.to_uint32_t (), utki::version_duplet{10 , 20 }.to_uint32_t (), SL );
26+ });
27+
28+ suite.add (" version_duplet__operator_stream_output" , []() {
29+ utki::version_duplet dp = {10 , 20 };
30+
31+ std::stringstream ss;
32+
33+ ss << dp;
34+
35+ tst::check_eq (ss.str (), " 10.20" s, SL );
36+ });
37+
38+ suite.add (" operator_greater_or_equal" , []() {
39+ tst::check (utki::version_duplet{1 , 2 } >= utki::version_duplet{1 , 1 }, SL );
40+ tst::check (utki::version_duplet{1 , 2 } >= utki::version_duplet{1 , 2 }, SL );
41+ tst::check (!(utki::version_duplet{1 , 2 } >= utki::version_duplet{1 , 3 }), SL );
42+ tst::check (utki::version_duplet{2 , 0 } >= utki::version_duplet{1 , 9 }, SL );
43+ tst::check (utki::version_duplet{2 , 0 } >= utki::version_duplet{0 , 9 }, SL );
44+ });
45+
46+ suite.add (" operator_less" , []() {
47+ tst::check (!(utki::version_duplet{1 , 2 } < utki::version_duplet{1 , 1 }), SL );
48+ tst::check (!(utki::version_duplet{1 , 2 } < utki::version_duplet{1 , 2 }), SL );
49+ tst::check (utki::version_duplet{1 , 2 } < utki::version_duplet{1 , 3 }, SL );
50+ tst::check (!(utki::version_duplet{2 , 0 } < utki::version_duplet{1 , 9 }), SL );
51+ tst::check (!(utki::version_duplet{2 , 0 } < utki::version_duplet{0 , 9 }), SL );
52+ });
53+ });
54+ } // namespace
0 commit comments