2015-04-13 16:45:56 +10:00
|
|
|
#include "version.hpp"
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2015-04-13 16:45:56 +10:00
|
|
|
#include "tap.hpp"
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
static const struct {
|
|
|
|
const char *msg;
|
|
|
|
const char *str;
|
|
|
|
unsigned parts[4];
|
|
|
|
util::version::release_t release;
|
2013-08-05 16:45:03 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
} TESTS[] = {
|
|
|
|
{ "1-component", "1", { 1u }, util::version::PRODUCTION },
|
2011-11-04 17:28:04 +11:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
{ "2-component", "1.2", { 1u, 2u }, util::version::PRODUCTION },
|
|
|
|
{ "3-component", "1.2.3", { 1u, 2u, 3u }, util::version::PRODUCTION },
|
|
|
|
{ "4-component", "1.2.3.4", { 1u, 2u, 3u, 4u }, util::version::PRODUCTION },
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
{ "2-component alpha", "9.5a", { 9u, 5u }, util::version::ALPHA },
|
|
|
|
{ "3-component beta", "8.2.5b", { 8u, 2u, 5u }, util::version::BETA },
|
|
|
|
|
|
|
|
/*
|
|
|
|
{ "1.4.1-p8", { 1, 4, 1 } },
|
|
|
|
{ "4.2.0-r4", { 4, 2, 0 } },
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
{ "1.4 RC1", { 1, 4 } }
|
|
|
|
*/
|
|
|
|
};
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
//-----------------------------------------------------------------------------
|
2011-05-23 17:18:52 +10:00
|
|
|
int
|
2015-04-13 16:45:56 +10:00
|
|
|
main () {
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
util::TAP::logger tap;
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
for (const auto &i: TESTS) {
|
|
|
|
util::version v (i.str);
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
tap.expect (std::equal (v.begin (), v.end (), i.parts) && v.release == i.release,
|
|
|
|
i.msg);
|
2011-05-23 17:18:52 +10:00
|
|
|
}
|
|
|
|
|
2016-01-19 18:31:49 +11:00
|
|
|
return tap.status ();
|
2011-05-23 17:18:52 +10:00
|
|
|
}
|