Mercurial > malikania
view 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 |
line wrap: on
line source
/* * main.cpp -- test mlk::client::point * * Copyright (c) 2013-2018 David Demelier <markand@malikania.fr> * * 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/client/point.hpp> namespace mlk { namespace client { std::ostream& operator<<(std::ostream& out, const point& point) { out << "{" << point.x() << ", " << point.y() << "}"; return out; } } // !client } // !mlk BOOST_AUTO_TEST_CASE(none) { mlk::client::point point; BOOST_REQUIRE_EQUAL(0, point.x()); BOOST_REQUIRE_EQUAL(0, point.y()); } BOOST_AUTO_TEST_CASE(standard) { mlk::client::point point(10, 20); BOOST_REQUIRE_EQUAL(10, point.x()); BOOST_REQUIRE_EQUAL(20, point.y()); } BOOST_AUTO_TEST_CASE(operator_eq) { mlk::client::point point1, point2; BOOST_REQUIRE_EQUAL(point1, point2); } BOOST_AUTO_TEST_CASE(operator_eq1) { mlk::client::point point1(10, 20); mlk::client::point point2(10, 20); BOOST_REQUIRE_EQUAL(point1, point2); } BOOST_AUTO_TEST_CASE(operator_neq) { BOOST_REQUIRE_NE(mlk::client::point(10), mlk::client::point(20)); BOOST_REQUIRE_NE(mlk::client::point(10, 10), mlk::client::point(10, 20)); }