1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
/*
* Copyright 2009- ECMWF.
*
* This software is licensed under the terms of the Apache Licence version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/
#include <boost/test/unit_test.hpp>
#include "ecflow/core/TimeSlot.hpp"
#include "ecflow/test/scaffold/Naming.hpp"
using namespace ecf;
BOOST_AUTO_TEST_SUITE(U_Core)
BOOST_AUTO_TEST_SUITE(T_TimeSlot)
BOOST_AUTO_TEST_CASE(test_time_slot) {
ECF_NAME_THIS_TEST();
// test timeslot operator
{
TimeSlot x;
TimeSlot y;
BOOST_CHECK_MESSAGE(x.isNULL(), "Expected NULL");
BOOST_CHECK_MESSAGE(y.isNULL(), "Expected NULL");
BOOST_CHECK_MESSAGE(x == y, "Equality operator expected to succeed");
BOOST_CHECK_MESSAGE(!(x < y), "Less than operator expected to fail");
BOOST_CHECK_MESSAGE(!(x > y), "Greater than operator expected to fail");
BOOST_CHECK_MESSAGE(x <= y, "<= operator expected to succeed");
BOOST_CHECK_MESSAGE(x >= y, ">= operator expected to succeed");
BOOST_CHECK_MESSAGE(y <= x, "<= operator expected to succeed");
BOOST_CHECK_MESSAGE(y >= x, ">= operator expected to succeed");
TimeSlot a(10, 12);
TimeSlot b(10, 12);
BOOST_CHECK_MESSAGE(!a.isNULL(), "Expected NOT NULL");
BOOST_CHECK_MESSAGE(!b.isNULL(), "Expected NOT NULL");
BOOST_CHECK_MESSAGE(a == b, "Equality operator expected to succeed");
BOOST_CHECK_MESSAGE(!(a < b), "Less than operator expected to fail");
BOOST_CHECK_MESSAGE(!(a > b), "Greater than operator expected to fail");
BOOST_CHECK_MESSAGE(a <= b, "<= operator expected to succeed");
BOOST_CHECK_MESSAGE(a >= b, ">= operator expected to succeed");
BOOST_CHECK_MESSAGE(b <= a, "<= operator expected to succeed");
BOOST_CHECK_MESSAGE(b >= a, ">= operator expected to succeed");
TimeSlot c(0, 0);
TimeSlot d(0, 0);
BOOST_CHECK_MESSAGE(!c.isNULL(), "Expected NOT NULL");
BOOST_CHECK_MESSAGE(!d.isNULL(), "Expected NOT NULL");
BOOST_CHECK_MESSAGE(c == d, "Equality operator expected to succeed");
BOOST_CHECK_MESSAGE(!(c < d), "Less than operator expected to fail");
BOOST_CHECK_MESSAGE(!(c > d), "Greater than operator expected to fail");
BOOST_CHECK_MESSAGE(c <= d, "<= operator expected to succeed");
BOOST_CHECK_MESSAGE(c >= d, ">= operator expected to succeed");
BOOST_CHECK_MESSAGE(d <= c, "<= operator expected to succeed");
BOOST_CHECK_MESSAGE(d >= c, ">= operator expected to succeed");
TimeSlot a1(10, 1);
TimeSlot b1(10, 12);
BOOST_CHECK_MESSAGE(!a1.isNULL(), "Expected NOT NULL");
BOOST_CHECK_MESSAGE(!b1.isNULL(), "Expected NOT NULL");
BOOST_CHECK_MESSAGE(a1 != b1, "Equality operator expected to fail");
BOOST_CHECK_MESSAGE(a1 < b1, "Less than operator expected to succeed");
BOOST_CHECK_MESSAGE(!(a1 > b1), "Greater than operator expected to fail");
BOOST_CHECK_MESSAGE(!(a1 >= b1), ">= than operator expected to fail");
BOOST_CHECK_MESSAGE(b1 > a1, "Greater than operator expected to succeed");
BOOST_CHECK_MESSAGE(b1 >= a1, ">= expected to succeed");
TimeSlot xx(10, 1);
TimeSlot yy(23, 12);
BOOST_CHECK_MESSAGE(xx != yy, "Equality operator expected to fail");
BOOST_CHECK_MESSAGE(xx < yy, "Less than operator expected to succeed");
BOOST_CHECK_MESSAGE(xx <= yy, "<= operator expected to succeed");
BOOST_CHECK_MESSAGE(yy > xx, "Greater than operator expected to succeed");
BOOST_CHECK_MESSAGE(yy >= xx, ">= operator expected to succeed");
BOOST_CHECK_MESSAGE(!(xx > yy), "Greater than operator expected to fail");
BOOST_CHECK_MESSAGE(!(xx >= yy), ">= operator expected to fail");
TimeSlot x1(11, 0);
TimeSlot y1(10, 0);
BOOST_CHECK_MESSAGE(x1 != y1, "Equality operator expected to fail");
BOOST_CHECK_MESSAGE(!(x1 < y1), "Less than operator expected to fail");
BOOST_CHECK_MESSAGE(!(x1 <= y1), "<= operator expected to fail");
BOOST_CHECK_MESSAGE(x1 > y1, "Greater than operator expected to succced");
BOOST_CHECK_MESSAGE(x1 >= y1, ">= operator expected to succced");
}
}
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
|