JayBeams  0.1
Another project to have fun coding.
ut_char_list_validator.cpp
Go to the documentation of this file.
2 
3 #include <boost/test/unit_test.hpp>
4 
5 /**
6  * @test Verify that the trivial validators work as expected.
7  */
8 BOOST_AUTO_TEST_CASE(base_validator) {
10  BOOST_CHECK_NO_THROW(bfalse(u'Y'));
11 
13  BOOST_CHECK_THROW(btrue(u'Y'), std::runtime_error);
14 }
15 
16 /**
17  * @test Verify that the disabled validator works as expected.
18  */
19 BOOST_AUTO_TEST_CASE(disabled_validator) {
21  BOOST_CHECK_NO_THROW(bfalse(u'A'));
22  BOOST_CHECK_NO_THROW(bfalse(u'B'));
23  BOOST_CHECK_NO_THROW(bfalse(u'C'));
24  BOOST_CHECK_NO_THROW(bfalse(u'Y'));
25 }
26 
27 /**
28  * @test Verify that the enabled validator works as expected.
29  */
30 BOOST_AUTO_TEST_CASE(enabled_validator) {
32  BOOST_CHECK_NO_THROW(btrue(u'A'));
33  BOOST_CHECK_NO_THROW(btrue(u'B'));
34  BOOST_CHECK_NO_THROW(btrue(u'C'));
35  BOOST_CHECK_THROW(btrue(u'Y'), std::runtime_error);
36 }
BOOST_AUTO_TEST_CASE(base_validator)
Define a functor to validate character fields with limited values.
Specialize for the empty list.