diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-18 22:51:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-18 22:53:01 +0300 |
commit | 40de3bee0278d6584561a827123bc342934adccb (patch) | |
tree | 460ba68f29ec25377ef1971989c4c46e507ea3da /src/utils | |
parent | dffd0a4a8e99196ad27f8fde2430b09dd29cac57 (diff) | |
download | manaplus-40de3bee0278d6584561a827123bc342934adccb.tar.gz manaplus-40de3bee0278d6584561a827123bc342934adccb.tar.bz2 manaplus-40de3bee0278d6584561a827123bc342934adccb.tar.xz manaplus-40de3bee0278d6584561a827123bc342934adccb.zip |
Add support for additional unit test library doctest.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/chatutils_unittest.cc | 11 | ||||
-rw-r--r-- | src/utils/checkutils_unittest.cc | 2 | ||||
-rw-r--r-- | src/utils/dumplibs_unittest.cc | 2 | ||||
-rw-r--r-- | src/utils/langs_unittest.cc | 6 | ||||
-rw-r--r-- | src/utils/mathutils_unittest.cc | 4 | ||||
-rw-r--r-- | src/utils/parameters_unittest.cc | 66 | ||||
-rw-r--r-- | src/utils/stringutils_unittest.cc | 128 | ||||
-rw-r--r-- | src/utils/timer_unittest.cc | 6 | ||||
-rw-r--r-- | src/utils/translation/poparser_unittest.cc | 4 | ||||
-rw-r--r-- | src/utils/xml_unittest.cc | 6 | ||||
-rw-r--r-- | src/utils/xmlutils_unittest.cc | 17 |
11 files changed, 131 insertions, 121 deletions
diff --git a/src/utils/chatutils_unittest.cc b/src/utils/chatutils_unittest.cc index 875923d83..bc2013e82 100644 --- a/src/utils/chatutils_unittest.cc +++ b/src/utils/chatutils_unittest.cc @@ -38,6 +38,7 @@ #include "utils/chatutils.h" #include "utils/delete2.h" +#include "utils/env.h" #include "render/sdlgraphics.h" @@ -51,7 +52,7 @@ #include "debug.h" -TEST_CASE("chatutils leak test1") +TEST_CASE("chatutils leak test1", "") { logger = new Logger(); REQUIRE(gui == nullptr); @@ -60,8 +61,10 @@ TEST_CASE("chatutils leak test1") delete2(logger); } -TEST_CASE("chatutils replaceVars") +TEST_CASE("chatutils replaceVars", "") { + setEnv("SDL_VIDEODRIVER", "dummy"); + client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); @@ -262,7 +265,7 @@ TEST_CASE("chatutils replaceVars") // VirtFs::deinit(); } -TEST_CASE("chatutils textToMe") +TEST_CASE("chatutils textToMe", "") { REQUIRE(textToMe("") == "**"); REQUIRE(textToMe("123") == "*123*"); @@ -270,7 +273,7 @@ TEST_CASE("chatutils textToMe") REQUIRE(textToMe("test line") == "*test line*"); } -TEST_CASE("chatutils leak test2") +TEST_CASE("chatutils leak test2", "") { logger = new Logger(); REQUIRE(gui == nullptr); diff --git a/src/utils/checkutils_unittest.cc b/src/utils/checkutils_unittest.cc index a3c101e02..4dbc23062 100644 --- a/src/utils/checkutils_unittest.cc +++ b/src/utils/checkutils_unittest.cc @@ -81,7 +81,7 @@ static bool testFailAlways2() return false; } -TEST_CASE("CheckUtils") +TEST_CASE("CheckUtils", "") { logger = new Logger; diff --git a/src/utils/dumplibs_unittest.cc b/src/utils/dumplibs_unittest.cc index 6aef5d933..66a272b8e 100644 --- a/src/utils/dumplibs_unittest.cc +++ b/src/utils/dumplibs_unittest.cc @@ -36,7 +36,7 @@ PRAGMACLANG6GCC(GCC diagnostic pop) #include "debug.h" -TEST_CASE("dumplibs tests") +TEST_CASE("dumplibs tests", "") { logger = new Logger(); diff --git a/src/utils/langs_unittest.cc b/src/utils/langs_unittest.cc index b162fc001..695644a4b 100644 --- a/src/utils/langs_unittest.cc +++ b/src/utils/langs_unittest.cc @@ -27,7 +27,7 @@ #include "debug.h" -TEST_CASE("Langs getLang") +TEST_CASE("Langs getLang", "") { LangVect langs; @@ -68,7 +68,7 @@ TEST_CASE("Langs getLang") REQUIRE(langs[1] == "ru"); } -TEST_CASE("Langs getLangSimple") +TEST_CASE("Langs getLangSimple", "") { config.setValue("lang", "C"); REQUIRE(getLangSimple() == "C"); @@ -91,7 +91,7 @@ TEST_CASE("Langs getLangSimple") REQUIRE(getLangSimple() == "ru_RU.UTF-8"); } -TEST_CASE("Langs getLangShort") +TEST_CASE("Langs getLangShort", "") { config.setValue("lang", "C"); REQUIRE(getLangShort() == "C"); diff --git a/src/utils/mathutils_unittest.cc b/src/utils/mathutils_unittest.cc index 6ec2ce831..187accf74 100644 --- a/src/utils/mathutils_unittest.cc +++ b/src/utils/mathutils_unittest.cc @@ -24,7 +24,7 @@ #include "debug.h" -TEST_CASE("MathUtils powerOfTwo") +TEST_CASE("MathUtils powerOfTwo", "") { REQUIRE(powerOfTwo(0) == 1); REQUIRE(powerOfTwo(1) == 1); @@ -95,7 +95,7 @@ TEST_CASE("MathUtils powerOfTwo") REQUIRE(powerOfTwo(1000000) == 1048576); } -TEST_CASE("MathUtils tests fastSqrtInt") +TEST_CASE("MathUtils tests fastSqrtInt", "") { for (int f = 0; f < 1005; f ++) REQUIRE(fastSqrtInt(f) == CAST_S32(sqrt(f))); diff --git a/src/utils/parameters_unittest.cc b/src/utils/parameters_unittest.cc index 6030c394e..192249a12 100644 --- a/src/utils/parameters_unittest.cc +++ b/src/utils/parameters_unittest.cc @@ -24,14 +24,14 @@ #include "debug.h" -TEST_CASE("parameters basic 1") +TEST_CASE("parameters basic 1", "") { StringVect pars; REQUIRE(splitParameters(pars, "", ",", '\"') == true); REQUIRE(pars.size() == 0); } -TEST_CASE("parameters basic 2") +TEST_CASE("parameters basic 2", "") { StringVect pars; REQUIRE(splitParameters(pars, "one,two, tree", ",", '\"') == true); @@ -41,14 +41,14 @@ TEST_CASE("parameters basic 2") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters basic 3") +TEST_CASE("parameters basic 3", "") { StringVect pars; REQUIRE(splitParameters(pars, ", ,,,", ",", '\"') == true); REQUIRE(pars.size() == 0); } -TEST_CASE("parameters basic 4") +TEST_CASE("parameters basic 4", "") { StringVect pars; REQUIRE(splitParameters(pars, "one,,two, tree", ",", '\"') == true); @@ -58,7 +58,7 @@ TEST_CASE("parameters basic 4") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters escape 1") +TEST_CASE("parameters escape 1", "") { StringVect pars; REQUIRE(splitParameters(pars, "\\\"", ",", '\"') == true); @@ -66,7 +66,7 @@ TEST_CASE("parameters escape 1") REQUIRE(pars[0] == "\""); } -TEST_CASE("parameters escape 2") +TEST_CASE("parameters escape 2", "") { StringVect pars; REQUIRE(splitParameters(pars, "\\\", test", ",", '\"') == true); @@ -75,7 +75,7 @@ TEST_CASE("parameters escape 2") REQUIRE(pars[1] == "test"); } -TEST_CASE("parameters escape 3") +TEST_CASE("parameters escape 3", "") { StringVect pars; REQUIRE(splitParameters(pars, "test,\\\"", ",", '\"') == true); @@ -84,7 +84,7 @@ TEST_CASE("parameters escape 3") REQUIRE(pars[1] == "\""); } -TEST_CASE("parameters quote 1") +TEST_CASE("parameters quote 1", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one\",,two, tree", ",", '\"') == true); @@ -94,7 +94,7 @@ TEST_CASE("parameters quote 1") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 2") +TEST_CASE("parameters quote 2", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"\",,two, tree", ",", '\"') == true); @@ -104,7 +104,7 @@ TEST_CASE("parameters quote 2") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 3") +TEST_CASE("parameters quote 3", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one test\",,two, tree", ",", '\"') == @@ -115,7 +115,7 @@ TEST_CASE("parameters quote 3") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 4") +TEST_CASE("parameters quote 4", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"\\\"one test\\\"\",,two, tree", ",", '\"') @@ -126,7 +126,7 @@ TEST_CASE("parameters quote 4") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 5") +TEST_CASE("parameters quote 5", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"\\\"one \\\"test\\\"\",,two, tree", @@ -137,7 +137,7 @@ TEST_CASE("parameters quote 5") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 6") +TEST_CASE("parameters quote 6", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one, test\",,two, tree", ",", '\"') @@ -148,7 +148,7 @@ TEST_CASE("parameters quote 6") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 7") +TEST_CASE("parameters quote 7", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"\\\"one, test\\\"\",,two, tree", @@ -159,7 +159,7 @@ TEST_CASE("parameters quote 7") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 8") +TEST_CASE("parameters quote 8", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"\\\"\",,two, tree", ",", '\"') @@ -170,7 +170,7 @@ TEST_CASE("parameters quote 8") REQUIRE(pars[2] == "tree"); } -TEST_CASE("parameters quote 9") +TEST_CASE("parameters quote 9", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"\\\",,two, tree", ",", '\"') @@ -179,7 +179,7 @@ TEST_CASE("parameters quote 9") REQUIRE(pars[0] == "\"\",,two, tree"); } -TEST_CASE("parameters quote 10") +TEST_CASE("parameters quote 10", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"", ",", '\"') @@ -188,7 +188,7 @@ TEST_CASE("parameters quote 10") REQUIRE(pars[0] == "\""); } -TEST_CASE("parameters quote 11") +TEST_CASE("parameters quote 11", "") { StringVect pars; REQUIRE(splitParameters(pars, "\\\"", ",", '\"') @@ -197,7 +197,7 @@ TEST_CASE("parameters quote 11") REQUIRE(pars[0] == "\""); } -TEST_CASE("parameters quote 12") +TEST_CASE("parameters quote 12", "") { StringVect pars; REQUIRE(splitParameters(pars, ",\"", ",", '\"') @@ -206,7 +206,7 @@ TEST_CASE("parameters quote 12") REQUIRE(pars[0] == "\""); } -TEST_CASE("parameters quote 13") +TEST_CASE("parameters quote 13", "") { StringVect pars; REQUIRE(splitParameters(pars, "\",", ",", '\"') @@ -215,7 +215,7 @@ TEST_CASE("parameters quote 13") REQUIRE(pars[0] == "\","); } -TEST_CASE("parameters quote 14") +TEST_CASE("parameters quote 14", "") { StringVect pars; REQUIRE(splitParameters(pars, "\\\",", ",", '\"') @@ -224,7 +224,7 @@ TEST_CASE("parameters quote 14") REQUIRE(pars[0] == "\""); } -TEST_CASE("parameters quote 15") +TEST_CASE("parameters quote 15", "") { StringVect pars; REQUIRE(splitParameters(pars, ",\\\"", ",", '\"') @@ -233,7 +233,7 @@ TEST_CASE("parameters quote 15") REQUIRE(pars[0] == "\""); } -TEST_CASE("parameters quote 16") +TEST_CASE("parameters quote 16", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one test\"", ",", '\"') == @@ -242,7 +242,7 @@ TEST_CASE("parameters quote 16") REQUIRE(pars[0] == "one test"); } -TEST_CASE("parameters quote 17") +TEST_CASE("parameters quote 17", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one, test\"", ",", '\"') == @@ -251,7 +251,7 @@ TEST_CASE("parameters quote 17") REQUIRE(pars[0] == "one, test"); } -TEST_CASE("parameters quote 18") +TEST_CASE("parameters quote 18", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one\\\" test\"", ",", '\"') == @@ -260,7 +260,7 @@ TEST_CASE("parameters quote 18") REQUIRE(pars[0] == "one\" test"); } -TEST_CASE("parameters quote 19") +TEST_CASE("parameters quote 19", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one\\\" ,test\"", ",", '\"') == @@ -269,7 +269,7 @@ TEST_CASE("parameters quote 19") REQUIRE(pars[0] == "one\" ,test"); } -TEST_CASE("parameters quote 20") +TEST_CASE("parameters quote 20", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"one\\\" test,\"", ",", '\"') == @@ -278,7 +278,7 @@ TEST_CASE("parameters quote 20") REQUIRE(pars[0] == "one\" test,"); } -TEST_CASE("parameters complex 1") +TEST_CASE("parameters complex 1", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"test\" \"line\"", ",", '\"') == true); @@ -286,7 +286,7 @@ TEST_CASE("parameters complex 1") REQUIRE(pars[0] == "test\" \"line"); } -TEST_CASE("parameters complex 2") +TEST_CASE("parameters complex 2", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"test\", \"line\"", ",", '\"') == true); @@ -295,7 +295,7 @@ TEST_CASE("parameters complex 2") REQUIRE(pars[1] == "line"); } -TEST_CASE("parameters complex 3") +TEST_CASE("parameters complex 3", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"test,\" \"line\"", ",", '\"') == true); @@ -303,7 +303,7 @@ TEST_CASE("parameters complex 3") REQUIRE(pars[0] == "test,\" \"line"); } -TEST_CASE("parameters broken 1") +TEST_CASE("parameters broken 1", "") { StringVect pars; REQUIRE(splitParameters(pars, "\"", ",", '\"') == true); @@ -311,14 +311,14 @@ TEST_CASE("parameters broken 1") REQUIRE(pars[0] == "\""); } -TEST_CASE("parameters broken 2") +TEST_CASE("parameters broken 2", "") { StringVect pars; REQUIRE(splitParameters(pars, ",", ",", '\"') == true); REQUIRE(pars.size() == 0); } -TEST_CASE("parameters broken 3") +TEST_CASE("parameters broken 3", "") { StringVect pars; REQUIRE(splitParameters(pars, diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc index 7a5508298..57d4336e0 100644 --- a/src/utils/stringutils_unittest.cc +++ b/src/utils/stringutils_unittest.cc @@ -38,7 +38,7 @@ #include "debug.h" -TEST_CASE("stringuntils trim 1") +TEST_CASE("stringuntils trim 1", "") { std::string str = "str"; REQUIRE("str" == trim(str)); @@ -56,7 +56,7 @@ TEST_CASE("stringuntils trim 1") REQUIRE("" == trim(str)); } -TEST_CASE("stringuntils toLower 1") +TEST_CASE("stringuntils toLower 1", "") { std::string str = "str"; REQUIRE("str" == toLower(str)); @@ -74,7 +74,7 @@ TEST_CASE("stringuntils toLower 1") REQUIRE("" == toLower(str)); } -TEST_CASE("stringuntils toUpper 1") +TEST_CASE("stringuntils toUpper 1", "") { std::string str = "str"; REQUIRE("STR" == toUpper(str)); @@ -92,7 +92,7 @@ TEST_CASE("stringuntils toUpper 1") REQUIRE("" == toUpper(str)); } -TEST_CASE("stringuntils atox 1") +TEST_CASE("stringuntils atox 1", "") { std::string str = "0x10"; REQUIRE(16 == atox(str)); @@ -123,13 +123,13 @@ TEST_CASE("stringuntils atox 1") REQUIRE(0 == atox(str)); } -TEST_CASE("stringuntils ipToString 1") +TEST_CASE("stringuntils ipToString 1", "") { REQUIRE("0.0.0.0" == std::string(ipToString(0))); REQUIRE("219.255.210.73" == std::string(ipToString(1238564827))); } -TEST_CASE("stringuntils toString 1") +TEST_CASE("stringuntils toString 1", "") { REQUIRE(strprintf("%d", 0) == toString(0)); REQUIRE(strprintf("%d", -1) == toString(-1)); @@ -145,14 +145,14 @@ TEST_CASE("stringuntils toString 1") REQUIRE(strprintf("%f", 3.1) == toString(3.1)); } -TEST_CASE("stringuntils toStringPrint 1") +TEST_CASE("stringuntils toStringPrint 1", "") { REQUIRE(toStringPrint(0) == "0 0x0"); REQUIRE(toStringPrint(10) == "10 0xa"); REQUIRE(toStringPrint(255) == "255 0xff"); } -TEST_CASE("stringuntils parse2Int 1") +TEST_CASE("stringuntils parse2Int 1", "") { int a = -1; int b = -1; @@ -186,7 +186,7 @@ TEST_CASE("stringuntils parse2Int 1") REQUIRE(b == 0); } -TEST_CASE("stringuntils parse2Str 1") +TEST_CASE("stringuntils parse2Str 1", "") { std::string str1 = "-"; std::string str2 = "-"; @@ -212,7 +212,7 @@ TEST_CASE("stringuntils parse2Str 1") REQUIRE(str2 == "line"); } -TEST_CASE("stringuntils parseNumber 1") +TEST_CASE("stringuntils parseNumber 1", "") { REQUIRE(parseNumber("") == 0); REQUIRE(parseNumber("0x") == 0); @@ -222,7 +222,7 @@ TEST_CASE("stringuntils parseNumber 1") REQUIRE(parseNumber("0x20") == 32); } -TEST_CASE("stringuntils removeToken 1") +TEST_CASE("stringuntils removeToken 1", "") { std::string str = ""; @@ -250,7 +250,7 @@ TEST_CASE("stringuntils removeToken 1") REQUIRE(str == ""); } -TEST_CASE("stringuntils strprintf 1") +TEST_CASE("stringuntils strprintf 1", "") { REQUIRE(strprintf("%s very long string. 123456789012345678901234567890" "+++++++++++++++++++++++++++++++++++++++" @@ -268,7 +268,7 @@ TEST_CASE("stringuntils strprintf 1") "end of test"); } -TEST_CASE("stringuntils toString 2") +TEST_CASE("stringuntils toString 2", "") { for (int f = 0; f < 10000000; f += 123) { @@ -276,7 +276,7 @@ TEST_CASE("stringuntils toString 2") } } -TEST_CASE("stringuntils removeColors 1") +TEST_CASE("stringuntils removeColors 1", "") { REQUIRE("" == removeColors("")); REQUIRE("#" == removeColors("#")); @@ -290,7 +290,7 @@ TEST_CASE("stringuntils removeColors 1") REQUIRE("#1" == removeColors("#1##2")); } -TEST_CASE("stringuntils compareStrI 1") +TEST_CASE("stringuntils compareStrI 1", "") { std::string str1 = ""; std::string str2 = ""; @@ -313,7 +313,7 @@ TEST_CASE("stringuntils compareStrI 1") REQUIRE(0 < compareStrI(str1, str2)); } -TEST_CASE("stringuntils isWordSeparator 1") +TEST_CASE("stringuntils isWordSeparator 1", "") { REQUIRE(isWordSeparator(' ')); REQUIRE(isWordSeparator(',')); @@ -324,7 +324,7 @@ TEST_CASE("stringuntils isWordSeparator 1") REQUIRE(!isWordSeparator('-')); } -TEST_CASE("stringuntils findSameSubstring") +TEST_CASE("stringuntils findSameSubstring", "") { std::string str1 = ""; std::string str2 = ""; @@ -344,7 +344,7 @@ TEST_CASE("stringuntils findSameSubstring") REQUIRE("" == findSameSubstring(str1, str2)); } -TEST_CASE("stringuntils findSameSubstringI") +TEST_CASE("stringuntils findSameSubstringI", "") { std::string str1 = ""; std::string str2 = ""; @@ -368,7 +368,7 @@ TEST_CASE("stringuntils findSameSubstringI") REQUIRE("" == findSameSubstringI(str1, str2)); } -TEST_CASE("stringuntils findI 1") +TEST_CASE("stringuntils findI 1", "") { REQUIRE(0 == findI("", "")); REQUIRE(std::string::npos == findI("test", "line")); @@ -377,7 +377,7 @@ TEST_CASE("stringuntils findI 1") REQUIRE(3 == findI("test line", "t l")); } -TEST_CASE("stringuntils findI 2") +TEST_CASE("stringuntils findI 2", "") { std::vector <std::string> vect1; vect1.push_back("test"); @@ -391,7 +391,7 @@ TEST_CASE("stringuntils findI 2") REQUIRE(std::string::npos == findI("zzz", vect1)); } -TEST_CASE("stringuntils encodeStr 1") +TEST_CASE("stringuntils encodeStr 1", "") { std::string str = encodeStr(10, 1); REQUIRE(10 == decodeStr(str)); @@ -409,7 +409,7 @@ TEST_CASE("stringuntils encodeStr 1") REQUIRE(1000 == decodeStr(str)); } -TEST_CASE("stringuntils extractNameFromSprite 1") +TEST_CASE("stringuntils extractNameFromSprite 1", "") { REQUIRE("" == extractNameFromSprite("")); REQUIRE("test" == extractNameFromSprite("test")); @@ -420,7 +420,7 @@ TEST_CASE("stringuntils extractNameFromSprite 1") REQUIRE("line" == extractNameFromSprite("test\\test2/line.zzz")); } -TEST_CASE("stringuntils removeSpriteIndex 1") +TEST_CASE("stringuntils removeSpriteIndex 1", "") { REQUIRE("" == removeSpriteIndex("")); REQUIRE("test" == removeSpriteIndex("test")); @@ -431,7 +431,7 @@ TEST_CASE("stringuntils removeSpriteIndex 1") REQUIRE("line" == removeSpriteIndex("test\\test2/line[1]")); } -TEST_CASE("stringutils getSafeUtf8String 1") +TEST_CASE("stringutils getSafeUtf8String 1", "") { const char *str; str = getSafeUtf8String(""); @@ -456,7 +456,7 @@ TEST_CASE("stringutils getSafeUtf8String 1") delete [] str; } -TEST_CASE("stringutils getSafeUtf8String 2") +TEST_CASE("stringutils getSafeUtf8String 2", "") { char *str; @@ -502,7 +502,7 @@ TEST_CASE("stringutils getSafeUtf8String 2") delete [] str; } -TEST_CASE("stringuntils getFileName 1") +TEST_CASE("stringuntils getFileName 1", "") { REQUIRE("" == getFileName("")); REQUIRE("file" == getFileName("file")); @@ -512,7 +512,7 @@ TEST_CASE("stringuntils getFileName 1") REQUIRE("file" == getFileName("/file")); } -TEST_CASE("stringuntils getFileDir 1") +TEST_CASE("stringuntils getFileDir 1", "") { REQUIRE("" == getFileDir("")); REQUIRE("file" == getFileDir("file")); @@ -522,7 +522,7 @@ TEST_CASE("stringuntils getFileDir 1") REQUIRE("" == getFileDir("/file")); } -TEST_CASE("stringuntils replaceAll 1") +TEST_CASE("stringuntils replaceAll 1", "") { std::string str1 = ""; std::string str2 = ""; @@ -546,7 +546,7 @@ TEST_CASE("stringuntils replaceAll 1") REQUIRE("this is test line" == replaceAll(str1, str2, str3)); } -TEST_CASE("stringuntils replaceRecursiveAll 1") +TEST_CASE("stringuntils replaceRecursiveAll 1", "") { std::string str; str = ""; @@ -590,7 +590,7 @@ TEST_CASE("stringuntils replaceRecursiveAll 1") REQUIRE(str == "111111"); } -TEST_CASE("stringuntils getBoolFromString 1") +TEST_CASE("stringuntils getBoolFromString 1", "") { REQUIRE(getBoolFromString("true")); REQUIRE(getBoolFromString("yes")); @@ -620,7 +620,7 @@ TEST_CASE("stringuntils getBoolFromString 1") REQUIRE(!getBoolFromString(" oFF")); } -TEST_CASE("stringuntils parseBoolean 1") +TEST_CASE("stringuntils parseBoolean 1", "") { REQUIRE(parseBoolean("true") == 1); REQUIRE(parseBoolean("yes") == 1); @@ -655,7 +655,7 @@ TEST_CASE("stringuntils parseBoolean 1") REQUIRE(parseBoolean(" tEst") == -1); } -TEST_CASE("stringuntils splitToIntSet 1") +TEST_CASE("stringuntils splitToIntSet 1", "") { std::set<int> tokens; splitToIntSet(tokens, "", ','); @@ -696,7 +696,7 @@ TEST_CASE("stringuntils splitToIntSet 1") REQUIRE(tokens.find(30) != tokens.end()); } -TEST_CASE("stringuntils splitToIntList 1") +TEST_CASE("stringuntils splitToIntList 1", "") { std::list<int> tokens; tokens = splitToIntList("", ','); @@ -751,7 +751,7 @@ TEST_CASE("stringuntils splitToIntList 1") tokens.pop_front(); } -TEST_CASE("stringuntils splitToStringSet 1") +TEST_CASE("stringuntils splitToStringSet 1", "") { std::set<std::string> tokens; splitToStringSet(tokens, "", ','); @@ -798,7 +798,7 @@ TEST_CASE("stringuntils splitToStringSet 1") REQUIRE(tokens.find("30e") != tokens.end()); } -TEST_CASE("stringuntils splitToIntVector 1") +TEST_CASE("stringuntils splitToIntVector 1", "") { std::vector<int> tokens; splitToIntVector(tokens, "", ','); @@ -845,7 +845,7 @@ TEST_CASE("stringuntils splitToIntVector 1") REQUIRE(tokens[2] == 30); } -TEST_CASE("stringuntils splitToStringVector 1") +TEST_CASE("stringuntils splitToStringVector 1", "") { std::vector<std::string> tokens; splitToStringVector(tokens, "", ','); @@ -885,7 +885,7 @@ TEST_CASE("stringuntils splitToStringVector 1") REQUIRE(tokens[2] == "3line"); } -TEST_CASE("stringuntils replaceSpecialChars 1") +TEST_CASE("stringuntils replaceSpecialChars 1", "") { std::string str; @@ -934,7 +934,7 @@ TEST_CASE("stringuntils replaceSpecialChars 1") REQUIRE("test line!" == str); } -TEST_CASE("stringuntils normalize 1") +TEST_CASE("stringuntils normalize 1", "") { REQUIRE(normalize("") == ""); REQUIRE(normalize("test") == "test"); @@ -945,7 +945,7 @@ TEST_CASE("stringuntils normalize 1") REQUIRE(normalize("test lIne ") == "test line"); } -TEST_CASE("stringuntils combineDye 1") +TEST_CASE("stringuntils combineDye 1", "") { REQUIRE("" == combineDye("", "")); REQUIRE("test" == combineDye("test", "")); @@ -956,7 +956,7 @@ TEST_CASE("stringuntils combineDye 1") REQUIRE("test|line" == combineDye("test|w", "line")); } -TEST_CASE("stringuntils combineDye 2") +TEST_CASE("stringuntils combineDye 2", "") { REQUIRE("" == combineDye2("", "")); REQUIRE("test" == combineDye2("test", "")); @@ -971,7 +971,7 @@ TEST_CASE("stringuntils combineDye 2") combineDye2("test.xml|#43413d,59544f,7a706c;#123456", "W;B")); } -TEST_CASE("stringuntils combineDye 3") +TEST_CASE("stringuntils combineDye 3", "") { REQUIRE("" == combineDye3("", "")); REQUIRE("test" == combineDye3("test", "")); @@ -985,7 +985,7 @@ TEST_CASE("stringuntils combineDye 3") combineDye3("test.xml|#43413d,59544f,7a706c;#123456", "W;B")); } -TEST_CASE("stringuntils packList 1") +TEST_CASE("stringuntils packList 1", "") { std::list <std::string> list; REQUIRE("" == packList(list)); @@ -1009,7 +1009,7 @@ TEST_CASE("stringuntils packList 1") REQUIRE("|test|line" == packList(list)); } -TEST_CASE("stringuntils stringToHexPath 1") +TEST_CASE("stringuntils stringToHexPath 1", "") { std::string str; @@ -1029,7 +1029,7 @@ TEST_CASE("stringuntils stringToHexPath 1") REQUIRE("%61/%62%63%64" == stringToHexPath(str)); } -TEST_CASE("stringuntils deleteCharLeft 1") +TEST_CASE("stringuntils deleteCharLeft 1", "") { std::string str; unsigned int pos = 0; @@ -1054,7 +1054,7 @@ TEST_CASE("stringuntils deleteCharLeft 1") REQUIRE("tes line\x0" == str); } -TEST_CASE("stringuntils findLast 1") +TEST_CASE("stringuntils findLast 1", "") { std::string str; @@ -1068,7 +1068,7 @@ TEST_CASE("stringuntils findLast 1") REQUIRE(!findLast(str, "lin")); } -TEST_CASE("stringuntils findFirst 1") +TEST_CASE("stringuntils findFirst 1", "") { std::string str; @@ -1085,7 +1085,7 @@ TEST_CASE("stringuntils findFirst 1") REQUIRE(findFirst(str, "est") == false); } -TEST_CASE("stringuntils findCutLast 1") +TEST_CASE("stringuntils findCutLast 1", "") { std::string str; @@ -1106,7 +1106,7 @@ TEST_CASE("stringuntils findCutLast 1") REQUIRE("test" == str); } -TEST_CASE("stringuntils CutLast 1") +TEST_CASE("stringuntils CutLast 1", "") { std::string str; @@ -1127,7 +1127,7 @@ TEST_CASE("stringuntils CutLast 1") REQUIRE("test" == str); } -TEST_CASE("stringuntils findCutFirst 1") +TEST_CASE("stringuntils findCutFirst 1", "") { std::string str; @@ -1148,7 +1148,7 @@ TEST_CASE("stringuntils findCutFirst 1") REQUIRE("test" == str); } -TEST_CASE("stringuntils cutFirst 1") +TEST_CASE("stringuntils cutFirst 1", "") { std::string str; @@ -1169,7 +1169,7 @@ TEST_CASE("stringuntils cutFirst 1") REQUIRE("test" == str); } -TEST_CASE("stringuntils removeProtocol 1") +TEST_CASE("stringuntils removeProtocol 1", "") { std::string str; @@ -1183,7 +1183,7 @@ TEST_CASE("stringuntils removeProtocol 1") REQUIRE("test" == removeProtocol(str)); } -TEST_CASE("stringuntils strStartWith 1") +TEST_CASE("stringuntils strStartWith 1", "") { REQUIRE(strStartWith("", "")); REQUIRE(!strStartWith("", "1")); @@ -1192,7 +1192,7 @@ TEST_CASE("stringuntils strStartWith 1") REQUIRE(!strStartWith("test line", "est")); } -TEST_CASE("stringuntils encodeLinkText") +TEST_CASE("stringuntils encodeLinkText", "") { std::string str; @@ -1204,7 +1204,7 @@ TEST_CASE("stringuntils encodeLinkText") REQUIRE(str == "test\342\235\230\342\235\230line"); } -TEST_CASE("stringuntils decodeLinkText") +TEST_CASE("stringuntils decodeLinkText", "") { std::string str; @@ -1214,7 +1214,7 @@ TEST_CASE("stringuntils decodeLinkText") REQUIRE(str == "test|line"); } -TEST_CASE("stringuntils isDigit") +TEST_CASE("stringuntils isDigit", "") { std::string str; @@ -1227,7 +1227,7 @@ TEST_CASE("stringuntils isDigit") REQUIRE_FALSE(isDigit("12-34")); } -TEST_CASE("stringuntils findAny") +TEST_CASE("stringuntils findAny", "") { std::string str; @@ -1240,7 +1240,7 @@ TEST_CASE("stringuntils findAny") REQUIRE(findAny("\"one\",,two, tree", ",", 5) == 5U); } -TEST_CASE("stringuntils escapeString") +TEST_CASE("stringuntils escapeString", "") { REQUIRE(escapeString("") == "\"\""); REQUIRE(escapeString("1") == "\"1\""); @@ -1254,7 +1254,7 @@ TEST_CASE("stringuntils escapeString") REQUIRE(escapeString("12\\3") == "\"12\\3\""); } -TEST_CASE("stringuntils sanitizePath") +TEST_CASE("stringuntils sanitizePath", "") { std::string path; const std::string sep = dirSeparator; @@ -1340,7 +1340,7 @@ TEST_CASE("stringuntils sanitizePath") "dir" + sep + "with" + sep + "sepa" + sep + "ra" + sep + "tors"); } -TEST_CASE("stringuntils pathJoin1") +TEST_CASE("stringuntils pathJoin1", "") { const std::string sep = dirSeparator; @@ -1362,7 +1362,7 @@ TEST_CASE("stringuntils pathJoin1") "dir1" + sep + "dir2" + sep + "dir3" + sep + "dir4"); } -TEST_CASE("stringuntils pathJoin2") +TEST_CASE("stringuntils pathJoin2", "") { const std::string sep = dirSeparator; @@ -1417,7 +1417,7 @@ TEST_CASE("stringuntils pathJoin2") "dir1" + sep + "dir2" + sep + "dir3" + sep + "dir4" + sep + "dir5"); } -TEST_CASE("stringuntils urlJoin") +TEST_CASE("stringuntils urlJoin", "") { REQUIRE(urlJoin("", "") == "/"); REQUIRE(urlJoin("/", "") == "/"); @@ -1433,7 +1433,7 @@ TEST_CASE("stringuntils urlJoin") REQUIRE(urlJoin("dir1/dir2", "/dir3/dir4") == "dir1/dir2/dir3/dir4"); } -TEST_CASE("stringuntils secureChatCommand") +TEST_CASE("stringuntils secureChatCommand", "") { std::string str; secureChatCommand(str); @@ -1456,7 +1456,7 @@ TEST_CASE("stringuntils secureChatCommand") } #ifdef ENABLE_NLS -TEST_CASE("stringuntils timeDiffToString") +TEST_CASE("stringuntils timeDiffToString", "") { REQUIRE(timeDiffToString(60 * 60 * 24 * 7) == "1 week"); REQUIRE(timeDiffToString(60 * 60 * 24 * 7 * 2 + @@ -1488,7 +1488,7 @@ TEST_CASE("stringuntils timeDiffToString") } #endif // ENABLE_NLS -TEST_CASE("stringuntils replaceItemLinks") +TEST_CASE("stringuntils replaceItemLinks", "") { logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); diff --git a/src/utils/timer_unittest.cc b/src/utils/timer_unittest.cc index 41bfad48c..4a9f245da 100644 --- a/src/utils/timer_unittest.cc +++ b/src/utils/timer_unittest.cc @@ -30,12 +30,12 @@ static const int MAX_TICK_VALUE = INT_MAX / 2; -TEST_CASE("timer const") +TEST_CASE("timer const", "") { REQUIRE(MILLISECONDS_IN_A_TICK != 0); } -TEST_CASE("timer get_elapsed_time") +TEST_CASE("timer get_elapsed_time", "") { tick_time = 0; REQUIRE(get_elapsed_time(0) == 0); @@ -62,7 +62,7 @@ TEST_CASE("timer get_elapsed_time") 10001 * MILLISECONDS_IN_A_TICK); } -TEST_CASE("timer get_elapsed_time1") +TEST_CASE("timer get_elapsed_time1", "") { tick_time = 0; REQUIRE(get_elapsed_time1(0) == 0); diff --git a/src/utils/translation/poparser_unittest.cc b/src/utils/translation/poparser_unittest.cc index 812472fb2..82418e09d 100644 --- a/src/utils/translation/poparser_unittest.cc +++ b/src/utils/translation/poparser_unittest.cc @@ -47,7 +47,7 @@ #include "debug.h" -TEST_CASE("PoParser leak test1") +TEST_CASE("PoParser leak test1", "") { logger = new Logger(); REQUIRE(gui == nullptr); @@ -147,7 +147,7 @@ TEST_CASE("PoParser tests", "PoParser") // VirtFs::deinit(); } -TEST_CASE("PoParser leak test2") +TEST_CASE("PoParser leak test2", "") { logger = new Logger(); REQUIRE(gui == nullptr); diff --git a/src/utils/xml_unittest.cc b/src/utils/xml_unittest.cc index dd5a2145e..00ec2b5ff 100644 --- a/src/utils/xml_unittest.cc +++ b/src/utils/xml_unittest.cc @@ -47,7 +47,7 @@ #include "debug.h" -TEST_CASE("xml test1") +TEST_CASE("xml test1", "") { logger = new Logger(); REQUIRE(client == nullptr); @@ -57,7 +57,7 @@ TEST_CASE("xml test1") delete2(logger); } -TEST_CASE("xml doc") +TEST_CASE("xml doc", "") { setEnv("SDL_VIDEODRIVER", "dummy"); @@ -389,7 +389,7 @@ TEST_CASE("xml doc") // VirtFs::deinit(); } -TEST_CASE("xml test2") +TEST_CASE("xml test2", "") { logger = new Logger(); REQUIRE(gui == nullptr); diff --git a/src/utils/xmlutils_unittest.cc b/src/utils/xmlutils_unittest.cc index eaf3097f3..eb6ec15aa 100644 --- a/src/utils/xmlutils_unittest.cc +++ b/src/utils/xmlutils_unittest.cc @@ -30,6 +30,7 @@ #include "gui/gui.h" #include "utils/delete2.h" +#include "utils/env.h" #include "utils/xmlutils.h" #include "render/sdlgraphics.h" @@ -40,7 +41,7 @@ #include "debug.h" -TEST_CASE("xmlutils leak test1") +TEST_CASE("xmlutils leak test1", "") { logger = new Logger(); REQUIRE(gui == nullptr); @@ -49,8 +50,10 @@ TEST_CASE("xmlutils leak test1") delete2(logger); } -TEST_CASE("xmlutils readXmlIntVector 1") +TEST_CASE("xmlutils readXmlIntVector 1", "") { + setEnv("SDL_VIDEODRIVER", "dummy"); + client = new Client; XML::initXML(); logger = new Logger(); @@ -94,8 +97,10 @@ TEST_CASE("xmlutils readXmlIntVector 1") // VirtFs::deinit(); } -TEST_CASE("xmlutils readXmlStringMap 1") +TEST_CASE("xmlutils readXmlStringMap 1", "") { + setEnv("SDL_VIDEODRIVER", "dummy"); + client = new Client; XML::initXML(); logger = new Logger(); @@ -138,8 +143,10 @@ TEST_CASE("xmlutils readXmlStringMap 1") // VirtFs::deinit(); } -TEST_CASE("xmlutils readXmlIntMap 1") +TEST_CASE("xmlutils readXmlIntMap 1", "") { + setEnv("SDL_VIDEODRIVER", "dummy"); + client = new Client; XML::initXML(); logger = new Logger(); @@ -186,7 +193,7 @@ TEST_CASE("xmlutils readXmlIntMap 1") // VirtFs::deinit(); } -TEST_CASE("xmlutils leak test2") +TEST_CASE("xmlutils leak test2", "") { logger = new Logger(); REQUIRE(gui == nullptr); |