]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/strutils_test.cxx
Revert "Use simgear internal stuff for the singleton class."
[simgear.git] / simgear / misc / strutils_test.cxx
index f6e08e081a1481185d693c73233755761b6e5512..6387b47cc88ff5e74f42cf3163a0f8648feca226 100644 (file)
@@ -53,6 +53,30 @@ int main (int ac, char ** av)
     COMPARE(to_int("0000000"), 0);
     COMPARE(to_int("-10000"), -10000);
     
+    VERIFY(compare_versions("1.0.12", "1.1") < 0);
+    VERIFY(compare_versions("1.1", "1.0.12") > 0);
+    VERIFY(compare_versions("10.6.7", "10.6.7") == 0);
+    VERIFY(compare_versions("2.0", "2.0.99") < 0);
+    VERIFY(compare_versions("99", "99") == 0);
+    VERIFY(compare_versions("99", "98") > 0);
+    
+// since we compare numerically, leasing zeros shouldn't matter
+    VERIFY(compare_versions("0.06.7", "0.6.07") == 0);
+    
+    string_list la = split("zero one two three four five");
+    COMPARE(la[2], "two");
+    COMPARE(la[5], "five");
+    COMPARE(la.size(), 6);
+    
+    string_list lb = split("alpha:beta:gamma:delta", ":", 2);
+    COMPARE(lb.size(), 3);
+    COMPARE(lb[0], "alpha");
+    COMPARE(lb[1], "beta");
+    COMPARE(lb[2], "gamma:delta");
+    
+    std::string j = join(la, "&");
+    COMPARE(j, "zero&one&two&three&four&five");
+    
     cout << "all tests passed successfully!" << endl;
     return 0;
 }