Skip to content

Commit f32da1b

Browse files
committed
tests for boolean
1 parent 8b98081 commit f32da1b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/test_conversions.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,32 @@ BOOST_AUTO_TEST_CASE(ints)
6666
BOOST_TEST(std::get<9>(resp).value() == 42);
6767
BOOST_TEST(std::get<10>(resp).value() == 42);
6868
}
69+
70+
BOOST_AUTO_TEST_CASE(bools)
71+
{
72+
// Setup
73+
net::io_context ioc;
74+
auto conn = std::make_shared<connection>(ioc);
75+
run(conn);
76+
77+
// Get a boolean
78+
request req;
79+
req.push("SET", "key_true", "t");
80+
req.push("SET", "key_false", "f");
81+
req.push("GET", "key_true");
82+
req.push("GET", "key_false");
83+
84+
response<ignore_t, ignore_t, bool, bool> resp;
85+
86+
conn->async_exec(req, resp, [conn](error_code ec, std::size_t) {
87+
BOOST_TEST(!ec);
88+
conn->cancel();
89+
});
90+
91+
// Run the operations
92+
ioc.run();
93+
94+
// Check
95+
BOOST_TEST(std::get<2>(resp).value() == true);
96+
BOOST_TEST(std::get<3>(resp).value() == false);
97+
}

0 commit comments

Comments
 (0)