From 1924830084fce3aa37463038bdf9899c16cdab54 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 24 Jul 2009 08:26:09 +0000 Subject: Oups - Forgot implementation of secondary constructor. --- server/src/versionstr.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/src/versionstr.cc b/server/src/versionstr.cc index 47451aa..8c0521f 100644 --- a/server/src/versionstr.cc +++ b/server/src/versionstr.cc @@ -49,6 +49,13 @@ VersionStr::VersionStr(std::string v) set(v); } +VersionStr::VersionStr(size_t major, size_t minor, size_t patch) +{ + version[0] = major; + version[1] = minor; + version[2] = patch; +} + void VersionStr::set(std::string v) { std::string num; @@ -123,6 +130,14 @@ int main() printf("VersionStr: %s\n", ((std::string)v1).c_str()); if((std::string)v1 != "1.2.3") return 1; + // Test normal secondary constructor and numeric version number verification. + VersionStr _v1(1, 2, 3); + printf("VersionStr: %s\n", ((std::string)_v1).c_str()); + if((std::string)_v1 != "1.2.3") return 1; + if(_v1.major() != 1) return 1; + if(_v1.minor() != 2) return 1; + if(_v1.patch() != 3) return 1; + // Test smaller version number and string conversion VersionStr v2("1.2"); printf("VersionStr: %s\n", ((std::string)v2).c_str()); -- cgit v1.2.3