MCPcopy Create free account
hub / github.com/HelenOS/helenos / test_tuple_ops

Method test_tuple_ops

uspace/lib/cpp/src/__bits/test/tuple.cpp:136–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134 }
135
136 void tuple_test::test_tuple_ops()
137 {
138 auto tpl1 = std::make_tuple(1, .5f);
139 auto tpl2 = std::make_tuple(1, .5f);
140 auto tpl3 = std::make_tuple(1, 1.f);
141 auto tpl4 = std::make_tuple(2, .5f);
142 auto tpl5 = std::make_tuple(2, 1.f);
143
144 test_eq("tuple == pt1", (tpl1 == tpl2), true);
145 test_eq("tuple == pt2", (tpl1 == tpl3), false);
146 test_eq("tuple == pt3", (tpl1 == tpl4), false);
147 test_eq("tuple < pt1", (tpl1 < tpl2), false);
148 test_eq("tuple < pt2", (tpl1 < tpl3), true);
149 test_eq("tuple < pt3", (tpl1 < tpl4), true);
150 test_eq("tuple < pt4", (tpl1 < tpl5), true);
151
152 tpl1.swap(tpl5);
153 test_eq("tuple swap pt1", std::get<0>(tpl1), 2);
154 test_eq("tuple swap pt2", std::get<1>(tpl1), 1.f);
155 test_eq("tuple swap pt3", std::get<0>(tpl5), 1);
156 test_eq("tuple swap pt4", std::get<1>(tpl5), .5f);
157 }
158}

Callers

nothing calls this directly

Calls 2

make_tupleFunction · 0.85
swapMethod · 0.45

Tested by

no test coverage detected