3 * Author : Chris Koeritz
5 * Copyright (c) 2009-$now By Author. This program is free software; you can *
6 * redistribute it and/or modify it under the terms of the GNU General Public *
7 * License as published by the Free Software Foundation; either version 2 of *
8 * the License or (at your option) any later version. This is online at: *
9 * http://www.fsf.org/copyleft/gpl.html *
10 * Please send any updates to: fred@gruntose.com *
13 #include <application/hoople_main.h>
14 #include <basis/astring.h>
15 #include <basis/functions.h>
16 #include <basis/guards.h>
17 #include <loggers/console_logger.h>
18 #include <loggers/critical_events.h>
19 #include <structures/static_memory_gremlin.h>
20 #include <structures/version_record.h>
21 #include <unit_test/unit_base.h>
23 using namespace application;
24 using namespace basis;
25 using namespace filesystem;
26 using namespace loggers;
27 using namespace mathematics;
28 using namespace structures;
29 using namespace textual;
30 using namespace timely;
31 using namespace unit_test;
33 #define LOG(to_print) EMERGENCY_LOG(program_wide_logger().get(), astring(to_print))
35 class test_version : public virtual unit_base, virtual public application_shell
38 test_version() : application_shell() {}
39 DEFINE_CLASS_NAME("test_version");
40 virtual int execute();
43 int test_version::execute()
47 version v1(5, 6, 138);
48 version v2(5, 7, 108);
49 ASSERT_TRUE((v1 < v2), "compare v1 < v2 should work properly");
50 ASSERT_FALSE(v1 > v2, "compare v1 > v2 should work properly");
51 ASSERT_FALSE(v1 == v2, "compare v1 == v2 should work properly");
52 ASSERT_TRUE((v1 != v2), "compare v1 != v2 should work properly");
54 version v3(4, 6, 180);
55 ASSERT_TRUE((v3 < v1), "compare v3 < v1 should work properly");
56 ASSERT_FALSE(v3 > v1, "compare v3 > v1 should work properly");
57 ASSERT_FALSE(v3 == v1, "compare v3 == v1 should work properly");
58 ASSERT_TRUE((v3 != v1), "compare v3 != v1 should work properly");
59 ASSERT_TRUE((v3 < v2), "compare v3 < v2 should work properly");
60 ASSERT_FALSE(v3 > v2, "compare v3 > v2 should work properly");
61 ASSERT_FALSE(v3 == v2, "compare v3 == v2 should work properly");
62 ASSERT_TRUE((v3 != v2), "compare v3 != v2 should work properly");
63 ASSERT_FALSE(v1 < v3, "compare v1 < v3 should work properly");
64 ASSERT_TRUE((v1 > v3), "compare v1 > v3 should work properly");
65 ASSERT_FALSE(v1 == v3, "compare v1 == v3 should work properly");
66 ASSERT_TRUE((v1 != v3), "compare v1 != v3 should work properly");
67 ASSERT_FALSE(v2 < v3, "compare v2 < v3 should work properly");
68 ASSERT_TRUE((v2 > v3), "compare v2 > v3 should work properly");
69 ASSERT_FALSE(v2 == v3, "compare v2 == v3 should work properly");
70 ASSERT_TRUE((v2 != v3), "compare v2 != v3 should work properly");
72 version v4(4, 6, 180);
73 ASSERT_FALSE(v3 < v4, "compare v3 < v4 should work properly");
74 ASSERT_FALSE(v3 > v4, "compare v3 > v4 should work properly");
75 ASSERT_TRUE((v3 == v4), "compare v3 == v4 should work properly");
76 ASSERT_FALSE(v3 != v4, "compare v3 != v4 should work properly");
77 ASSERT_FALSE(v4 < v3, "compare v4 < v3 should work properly");
78 ASSERT_FALSE(v4 > v3, "compare v4 > v3 should work properly");
79 ASSERT_TRUE((v4 == v3), "compare v4 == v3 should work properly");
80 ASSERT_FALSE(v4 != v3, "compare v4 != v3 should work properly");
82 return final_report();
85 HOOPLE_MAIN(test_version, )