Mercurial > malikania
view tests/libclient/point/main.cpp @ 77:61ea80e925ab
CMake: import pugixml 1.8, closes #613
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 20 Jan 2017 11:00:14 +0100 |
parents | 858621081b95 |
children | ee850a6ab89e |
line wrap: on
line source
/* * main.cpp -- test mlk::point * * Copyright (c) 2013-2017 Malikania Authors * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #define BOOST_TEST_MODULE "Point" #include <boost/test/unit_test.hpp> #include <malikania/point.hpp> namespace mlk { std::ostream& operator<<(std::ostream& out, const point& point) { out << "{" << point.x() << ", " << point.y() << "}"; return out; } } // !mlk BOOST_AUTO_TEST_CASE(none) { mlk::point point; BOOST_REQUIRE_EQUAL(0, point.x()); BOOST_REQUIRE_EQUAL(0, point.y()); } BOOST_AUTO_TEST_CASE(standard) { mlk::point point(10, 20); BOOST_REQUIRE_EQUAL(10, point.x()); BOOST_REQUIRE_EQUAL(20, point.y()); } BOOST_AUTO_TEST_CASE(operator_eq) { mlk::point point1, point2; BOOST_REQUIRE_EQUAL(point1, point2); } BOOST_AUTO_TEST_CASE(operator_eq1) { mlk::point point1(10, 20); mlk::point point2(10, 20); BOOST_REQUIRE_EQUAL(point1, point2); } BOOST_AUTO_TEST_CASE(operator_neq) { BOOST_REQUIRE_NE(mlk::point(10), mlk::point(20)); BOOST_REQUIRE_NE(mlk::point(10, 10), mlk::point(10, 20)); }