summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/src/tests.lua44
-rw-r--r--tests/emu/attotime.cpp2
-rw-r--r--tests/lib/util/corestr.cpp32
-rw-r--r--tests/lib/util/options.cpp15
4 files changed, 81 insertions, 12 deletions
diff --git a/scripts/src/tests.lua b/scripts/src/tests.lua
index 662f6ac0c20..7b4185f5005 100644
--- a/scripts/src/tests.lua
+++ b/scripts/src/tests.lua
@@ -21,6 +21,49 @@ project("mametests")
targetdir(MAME_DIR)
end
+ configuration { "x64", "Release" }
+ targetsuffix "64"
+ if _OPTIONS["PROFILE"] then
+ targetsuffix "64p"
+ end
+
+ configuration { "x64", "Debug" }
+ targetsuffix "64d"
+ if _OPTIONS["PROFILE"] then
+ targetsuffix "64dp"
+ end
+
+ configuration { "x32", "Release" }
+ targetsuffix ""
+ if _OPTIONS["PROFILE"] then
+ targetsuffix "p"
+ end
+
+ configuration { "x32", "Debug" }
+ targetsuffix "d"
+ if _OPTIONS["PROFILE"] then
+ targetsuffix "dp"
+ end
+
+ configuration { "Native", "Release" }
+ targetsuffix ""
+ if _OPTIONS["PROFILE"] then
+ targetsuffix "p"
+ end
+
+ configuration { "Native", "Debug" }
+ targetsuffix "d"
+ if _OPTIONS["PROFILE"] then
+ targetsuffix "dp"
+ end
+
+ configuration { "mingw*" or "vs*" }
+ targetextension ".exe"
+
+ configuration { "rpi" }
+ targetextension ""
+
+
configuration { }
links {
@@ -42,6 +85,7 @@ project("mametests")
files {
MAME_DIR .. "tests/main.cpp",
MAME_DIR .. "tests/lib/util/corestr.cpp",
+ MAME_DIR .. "tests/lib/util/options.cpp",
MAME_DIR .. "tests/emu/attotime.cpp",
}
diff --git a/tests/emu/attotime.cpp b/tests/emu/attotime.cpp
index e37954b249f..9ddb931ee52 100644
--- a/tests/emu/attotime.cpp
+++ b/tests/emu/attotime.cpp
@@ -7,5 +7,5 @@
TEST_CASE("convert 1 sec to attotime", "[emu]")
{
attotime value = attotime::from_seconds(1);
- REQUIRE(1000000000000000000 == value.as_attoseconds());
+ REQUIRE(value.as_attoseconds() == U64(1000000000000000000));
}
diff --git a/tests/lib/util/corestr.cpp b/tests/lib/util/corestr.cpp
index 5bf752a4818..86774c92728 100644
--- a/tests/lib/util/corestr.cpp
+++ b/tests/lib/util/corestr.cpp
@@ -5,29 +5,39 @@
TEST_CASE("String make upper", "[util]")
{
std::string value = "test";
- REQUIRE("TEST" == strmakeupper(value));
+ REQUIRE(strmakeupper(value) == "TEST");
}
TEST_CASE("String make lower", "[util]")
{
std::string value = "ValUE";
- REQUIRE("value" == strmakelower(value));
+ REQUIRE(strmakelower(value) == "value");
}
TEST_CASE("String replace", "[util]")
{
std::string value = "Main string";
- REQUIRE(1 == strreplace(value,"str","aaa"));
- REQUIRE("Main aaaing" == value);
- REQUIRE(4 == strreplace(value,"a","b"));
+ REQUIRE(strreplace(value,"str","aaa") == 1);
+ REQUIRE(value == "Main aaaing");
+ REQUIRE(strreplace(value,"a","b") == 4);
}
-TEST_CASE("String trimming", "[util]")
+TEST_CASE("String replace counting", "[util]")
+{
+ std::string value = "Main aaaing";
+ REQUIRE(strreplace(value,"a","b") == 4);
+}
+
+TEST_CASE("String trimming spaces", "[util]")
{
std::string value = " a value for test ";
- REQUIRE("a value for test" == strtrimspace(value));
- value = "\r\n\ta value for test\r\n\n\r";
- REQUIRE("a value for test" == strtrimspace(value));
+ REQUIRE(strtrimspace(value) == "a value for test");
+}
+
+TEST_CASE("String trimming all special", "[util]")
+{
+ std::string value = "\r\n\ta value for test\r\n\n\r";
+ REQUIRE(strtrimspace(value) == "a value for test");
}
TEST_CASE("String replace chars", "[util]")
@@ -37,7 +47,7 @@ TEST_CASE("String replace chars", "[util]")
strreplacechr(value,'e','E');
strreplacechr(value,'i','I');
strreplacechr(value,'o','O');
- REQUIRE("StrIng fOr dOIng rEplAcEs" == value);
+ REQUIRE(value == "StrIng fOr dOIng rEplAcEs");
}
TEST_CASE("String delete char", "[util]")
@@ -47,6 +57,6 @@ TEST_CASE("String delete char", "[util]")
strdelchr(value,'e');
strdelchr(value,'i');
strdelchr(value,'o');
- REQUIRE("Strng fr dng dlts" == value);
+ REQUIRE(value == "Strng fr dng dlts");
}
diff --git a/tests/lib/util/options.cpp b/tests/lib/util/options.cpp
new file mode 100644
index 00000000000..e971a564521
--- /dev/null
+++ b/tests/lib/util/options.cpp
@@ -0,0 +1,15 @@
+#include "catch.hpp"
+
+#include "options.h"
+
+TEST_CASE("Empty options should return first as nullptr", "[util]")
+{
+ core_options options;
+ REQUIRE(options.first() == nullptr);
+}
+
+TEST_CASE("Empty options should have iterators same", "[util]")
+{
+ core_options options;
+ REQUIRE(options.begin() == options.end());
+}