diff options
Diffstat (limited to 'server')
| -rw-r--r-- | server/src/versionstr.cc | 15 | 
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()); | 
