--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Geometry.hpp"
+
+#include <gtest/gtest.h>
+
+TEST(Point, testPoint)
+{
+ Point p1{1, 2};
+ Point p2{1, 2};
+ EXPECT_TRUE(p1 == p2);
+
+ p2.x = 2;
+ EXPECT_FALSE(p1 == p2);
+ EXPECT_TRUE(p1 != p2);
+}
+
+TEST(Rectangle, testRectangleToString)
+{
+ Rectangle r1{{20, 50}, {100, 70}};
+ EXPECT_STRCASEEQ("x= 20 y= 50 w= 100 h= 70", r1.toString().c_str());
+}
+
+TEST(Rectangle, testRectangleContains)
+{
+ Rectangle r1{{20, 50}, {100, 70}};
+ Point p1{50, 100};
+
+ EXPECT_TRUE(r1.contains(p1));
+ p1.y = 10;
+ EXPECT_FALSE(r1.contains(p1));
+}
+
+TEST(Rectangle, testRectangleGetCenter)
+{
+ Rectangle r1{{20, 50}, {10, 10}};
+ Point p1{25, 55};
+ EXPECT_TRUE(p1 == r1.getCenterPoint());
+
+ Rectangle r2{{20, 50}, {1, 1}};
+ Point p2{20, 50};
+ EXPECT_TRUE(p2 == r2.getCenterPoint());
+}
+
+TEST(Rectangle, testRectangleSum)
+{
+ Rectangle r1{{20, 50}, {20, 20}};
+ Rectangle r2{{25, 55}, {5, 5}};
+ EXPECT_EQ(Rectangle::sum(r1, r2), r1);
+
+ Rectangle r4{{25, 55}, {20, 5}};
+ EXPECT_EQ((Rectangle{{20, 50}, {25, 20}}), Rectangle::sum(r1, r4));
+}
+
+TEST(Rectangle, testRectangleIntersect)
+{
+ Rectangle r1{{20, 50}, {20, 20}};
+ Rectangle r2{{25, 55}, {5, 5}};
+ EXPECT_EQ(r2, Rectangle::intersect(r1, r2));
+ EXPECT_EQ((Rectangle{{30, 60}, {10, 10}}), Rectangle::intersect(r1, (Rectangle{{30, 60}, {20, 20}})));
+ EXPECT_FALSE(Rectangle::intersect((Rectangle{{30, 60}, {10, 10}}), r2).hasPositiveSize());
+ EXPECT_FALSE(Rectangle::intersect((Rectangle{{31, 61}, {10, 10}}), r2).hasPositiveSize());
+ EXPECT_TRUE(r2.hasPositiveSize());
+}
+
+TEST(Size, testSize)
+{
+ Size s1{2, 5};
+ Size s2{5, 2};
+
+ s2.width = 2;
+ s2.height = 5;
+ EXPECT_EQ(s1, s2);
+}
+
+int main(int argc, char *argv[])
+{
+ try {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+ } catch (...) {
+ return 1;
+ }
+}