annotate tests/libclient/size/main.cpp @ 44:f30c84b4b9ed

Tests: switch from GoogleTest to Boost.Unit, closes #588
author David Demelier <markand@malikania.fr>
date Wed, 30 Nov 2016 21:15:53 +0100
parents fabbe1759cec
children fe7e3524e571
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
1 /*
42
a47a4477f347 Misc: new style, closes #578
David Demelier <markand@malikania.fr>
parents: 33
diff changeset
2 * main.cpp -- test mlk::size
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
3 *
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
4 * Copyright (c) 2013-2016 Malikania Authors
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
5 *
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
6 * Permission to use, copy, modify, and/or distribute this software for any
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
7 * purpose with or without fee is hereby granted, provided that the above
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
8 * copyright notice and this permission notice appear in all copies.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
9 *
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
17 */
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
18
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
19 #define BOOST_TEST_MODULE "Size"
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
20 #include <boost/test/unit_test.hpp>
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
21
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
22 #include <malikania/size.hpp>
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
23
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
24 namespace mlk {
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
25
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
26 std::ostream& operator<<(std::ostream& out, const size& size)
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
27 {
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
28 out << "{" << size.width() << ", " << size.height() << "}";
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
29
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
30 return out;
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
31 }
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
32
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
33 }
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
34
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
35 BOOST_AUTO_TEST_CASE(none)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
36 {
42
a47a4477f347 Misc: new style, closes #578
David Demelier <markand@malikania.fr>
parents: 33
diff changeset
37 mlk::size size;
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
38
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
39 BOOST_REQUIRE_EQUAL(0U, size.width());
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
40 BOOST_REQUIRE_EQUAL(0U, size.height());
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
41 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
42
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
43 BOOST_AUTO_TEST_CASE(null)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
44 {
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
45 BOOST_REQUIRE(mlk::size().is_null());
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
46 BOOST_REQUIRE(!mlk::size(0, 10).is_null());
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
47 BOOST_REQUIRE(!mlk::size(10, 0).is_null());
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
48 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
49
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
50 BOOST_AUTO_TEST_CASE(standard)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
51 {
42
a47a4477f347 Misc: new style, closes #578
David Demelier <markand@malikania.fr>
parents: 33
diff changeset
52 mlk::size size(10, 20);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
53
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
54 BOOST_REQUIRE_EQUAL(10U, size.width());
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
55 BOOST_REQUIRE_EQUAL(20U, size.height());
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
56 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
57
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
58 BOOST_AUTO_TEST_CASE(operatorEq)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
59 {
42
a47a4477f347 Misc: new style, closes #578
David Demelier <markand@malikania.fr>
parents: 33
diff changeset
60 mlk::size size1, size2;
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
61
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
62 BOOST_REQUIRE_EQUAL(size1, size2);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
63 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
64
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
65 BOOST_AUTO_TEST_CASE(operatorEq1)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
66 {
42
a47a4477f347 Misc: new style, closes #578
David Demelier <markand@malikania.fr>
parents: 33
diff changeset
67 mlk::size size1(10, 20);
a47a4477f347 Misc: new style, closes #578
David Demelier <markand@malikania.fr>
parents: 33
diff changeset
68 mlk::size size2(10, 20);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
69
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
70 BOOST_REQUIRE_EQUAL(size1, size2);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
71 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
72
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
73 BOOST_AUTO_TEST_CASE(operatorNeq)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
74 {
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
75 BOOST_REQUIRE_NE(mlk::size(10), mlk::size(20));
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
76 BOOST_REQUIRE_NE(mlk::size(10, 10), mlk::size(10, 20));
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
77 }