annotate tests/libclient/point/main.cpp @ 158:4b292c20124c

Misc: update copyrights
author David Demelier <markand@malikania.fr>
date Tue, 09 Jan 2018 13:15:07 +0100
parents 119bcc5a727e
children
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 /*
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
2 * main.cpp -- test mlk::client::point
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
3 *
158
4b292c20124c Misc: update copyrights
David Demelier <markand@malikania.fr>
parents: 110
diff changeset
4 * Copyright (c) 2013-2018 David Demelier <markand@malikania.fr>
33
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 "Point"
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
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
22 #include <malikania/client/point.hpp>
33
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
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
26 namespace client {
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
27
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
28 std::ostream& operator<<(std::ostream& out, const point& point)
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 out << "{" << point.x() << ", " << point.y() << "}";
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 return out;
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
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
35 } // !client
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
36
53
fe7e3524e571 Tests: various style fixes
David Demelier <markand@malikania.fr>
parents: 44
diff changeset
37 } // !mlk
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
38
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
39 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
40 {
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
41 mlk::client::point point;
33
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_REQUIRE_EQUAL(0, point.x());
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
44 BOOST_REQUIRE_EQUAL(0, point.y());
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
45 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
46
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
47 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
48 {
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
49 mlk::client::point point(10, 20);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
50
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
51 BOOST_REQUIRE_EQUAL(10, point.x());
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
52 BOOST_REQUIRE_EQUAL(20, point.y());
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
53 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
54
53
fe7e3524e571 Tests: various style fixes
David Demelier <markand@malikania.fr>
parents: 44
diff changeset
55 BOOST_AUTO_TEST_CASE(operator_eq)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
56 {
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
57 mlk::client::point point1, point2;
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
58
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
59 BOOST_REQUIRE_EQUAL(point1, point2);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
60 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
61
53
fe7e3524e571 Tests: various style fixes
David Demelier <markand@malikania.fr>
parents: 44
diff changeset
62 BOOST_AUTO_TEST_CASE(operator_eq1)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
63 {
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
64 mlk::client::point point1(10, 20);
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
65 mlk::client::point point2(10, 20);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
66
44
f30c84b4b9ed Tests: switch from GoogleTest to Boost.Unit, closes #588
David Demelier <markand@malikania.fr>
parents: 43
diff changeset
67 BOOST_REQUIRE_EQUAL(point1, point2);
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
68 }
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
69
53
fe7e3524e571 Tests: various style fixes
David Demelier <markand@malikania.fr>
parents: 44
diff changeset
70 BOOST_AUTO_TEST_CASE(operator_neq)
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
71 {
82
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
72 BOOST_REQUIRE_NE(mlk::client::point(10), mlk::client::point(20));
ee850a6ab89e Client: namespace and hierarchy
David Demelier <markand@malikania.fr>
parents: 76
diff changeset
73 BOOST_REQUIRE_NE(mlk::client::point(10, 10), mlk::client::point(10, 20));
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
74 }