comparison tests/libclient/point/main.cpp @ 0:8991989c4708

Initial import
author David Demelier <markand@malikania.fr>
date Tue, 22 Mar 2016 18:26:05 +0100
parents
children 45b3c770803c
comparison
equal deleted inserted replaced
-1:000000000000 0:8991989c4708
1 /*
2 * main.cpp -- test Point
3 *
4 * Copyright (c) 2013-2016 Malikania Authors
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
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
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #include <gtest/gtest.h>
20
21 #include <malikania/Point.h>
22
23 using namespace malikania;
24
25 TEST(Basics, none)
26 {
27 Point point;
28
29 ASSERT_EQ(0, point.x());
30 ASSERT_EQ(0, point.y());
31 }
32
33 TEST(Basics, standard)
34 {
35 Point point(10, 20);
36
37 ASSERT_EQ(10, point.x());
38 ASSERT_EQ(20, point.y());
39 }
40
41 TEST(Basics, operatorEq)
42 {
43 Point point1, point2;
44
45 ASSERT_EQ(point1, point2);
46 }
47
48 TEST(Basics, operatorEq1)
49 {
50 Point point1(10, 20);
51 Point point2(10, 20);
52
53 ASSERT_EQ(point1, point2);
54 }
55
56 TEST(Basics, operatorNeq)
57 {
58 ASSERT_NE(Point(10), Point(20));
59 ASSERT_NE(Point(10, 10), Point(10, 20));
60 }
61
62 int main(int argc, char **argv)
63 {
64 testing::InitGoogleTest(&argc, argv);
65
66 return RUN_ALL_TESTS();
67 }