Mercurial > malikania
comparison tests/libclient/point/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 |
comparison
equal
deleted
inserted
replaced
43:fabbe1759cec | 44:f30c84b4b9ed |
---|---|
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 */ | 17 */ |
18 | 18 |
19 #include <gtest/gtest.h> | 19 #define BOOST_TEST_MODULE "Point" |
20 #include <boost/test/unit_test.hpp> | |
20 | 21 |
21 #include <malikania/point.hpp> | 22 #include <malikania/point.hpp> |
22 | 23 |
23 TEST(Basics, none) | 24 namespace mlk { |
25 | |
26 std::ostream& operator<<(std::ostream& out, const point& point) | |
27 { | |
28 out << "{" << point.x() << ", " << point.y() << "}"; | |
29 | |
30 return out; | |
31 } | |
32 | |
33 } | |
34 | |
35 BOOST_AUTO_TEST_CASE(none) | |
24 { | 36 { |
25 mlk::point point; | 37 mlk::point point; |
26 | 38 |
27 ASSERT_EQ(0, point.x()); | 39 BOOST_REQUIRE_EQUAL(0, point.x()); |
28 ASSERT_EQ(0, point.y()); | 40 BOOST_REQUIRE_EQUAL(0, point.y()); |
29 } | 41 } |
30 | 42 |
31 TEST(Basics, standard) | 43 BOOST_AUTO_TEST_CASE(standard) |
32 { | 44 { |
33 mlk::point point(10, 20); | 45 mlk::point point(10, 20); |
34 | 46 |
35 ASSERT_EQ(10, point.x()); | 47 BOOST_REQUIRE_EQUAL(10, point.x()); |
36 ASSERT_EQ(20, point.y()); | 48 BOOST_REQUIRE_EQUAL(20, point.y()); |
37 } | 49 } |
38 | 50 |
39 TEST(Basics, operatorEq) | 51 BOOST_AUTO_TEST_CASE(operatorEq) |
40 { | 52 { |
41 mlk::point point1, point2; | 53 mlk::point point1, point2; |
42 | 54 |
43 ASSERT_EQ(point1, point2); | 55 BOOST_REQUIRE_EQUAL(point1, point2); |
44 } | 56 } |
45 | 57 |
46 TEST(Basics, operatorEq1) | 58 BOOST_AUTO_TEST_CASE(operatorEq1) |
47 { | 59 { |
48 mlk::point point1(10, 20); | 60 mlk::point point1(10, 20); |
49 mlk::point point2(10, 20); | 61 mlk::point point2(10, 20); |
50 | 62 |
51 ASSERT_EQ(point1, point2); | 63 BOOST_REQUIRE_EQUAL(point1, point2); |
52 } | 64 } |
53 | 65 |
54 TEST(Basics, operatorNeq) | 66 BOOST_AUTO_TEST_CASE(operatorNeq) |
55 { | 67 { |
56 ASSERT_NE(mlk::point(10), mlk::point(20)); | 68 BOOST_REQUIRE_NE(mlk::point(10), mlk::point(20)); |
57 ASSERT_NE(mlk::point(10, 10), mlk::point(10, 20)); | 69 BOOST_REQUIRE_NE(mlk::point(10, 10), mlk::point(10, 20)); |
58 } | 70 } |
59 | |
60 int main(int argc, char **argv) | |
61 { | |
62 testing::InitGoogleTest(&argc, argv); | |
63 | |
64 return RUN_ALL_TESTS(); | |
65 } |