summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2009-07-24 08:26:09 +0000
committerdeva <deva>2009-07-24 08:26:09 +0000
commit1924830084fce3aa37463038bdf9899c16cdab54 (patch)
tree6831e7f1486280dbd2145f3c8a39f839bb55bc97
parent20f428b540ef06ba710671d322aa1f145332fa39 (diff)
Oups - Forgot implementation of secondary constructor.
-rw-r--r--server/src/versionstr.cc15
1 files changed, 15 insertions, 0 deletions
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());