summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-11-12 11:12:11 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2016-11-12 11:12:11 +0100
commit3c577aedb88337775be37d564b6ebe1a3d74c8c3 (patch)
treec326df51d5621310a595f5df6303a722a61fbe3c /tests
parentbe98f6b83acf489daefe604e238e4657940b1e64 (diff)
Converted existing test to catch framework (nw)
Diffstat (limited to 'tests')
-rw-r--r--tests/emu/attotime.cpp7
-rw-r--r--tests/lib/util/corestr.cpp33
-rw-r--r--tests/main.cpp11
3 files changed, 23 insertions, 28 deletions
diff --git a/tests/emu/attotime.cpp b/tests/emu/attotime.cpp
index 7d170c32abe..e37954b249f 100644
--- a/tests/emu/attotime.cpp
+++ b/tests/emu/attotime.cpp
@@ -1,10 +1,11 @@
-#include "gtest/gtest.h"
+#include "catch.hpp"
+
#include "emucore.h"
#include "eminline.h"
#include "attotime.h"
-TEST(attotime,as_attoseconds)
+TEST_CASE("convert 1 sec to attotime", "[emu]")
{
attotime value = attotime::from_seconds(1);
- EXPECT_EQ(1000000000000000000, value.as_attoseconds());
+ REQUIRE(1000000000000000000 == value.as_attoseconds());
}
diff --git a/tests/lib/util/corestr.cpp b/tests/lib/util/corestr.cpp
index 3da0bc75541..5bf752a4818 100644
--- a/tests/lib/util/corestr.cpp
+++ b/tests/lib/util/corestr.cpp
@@ -1,51 +1,52 @@
-#include "gtest/gtest.h"
+#include "catch.hpp"
+
#include "corestr.h"
-TEST(corestr,strmakeupper)
+TEST_CASE("String make upper", "[util]")
{
std::string value = "test";
- EXPECT_STREQ("TEST", strmakeupper(value).c_str());
+ REQUIRE("TEST" == strmakeupper(value));
}
-TEST(corestr,strmakelower)
+TEST_CASE("String make lower", "[util]")
{
std::string value = "ValUE";
- EXPECT_STREQ("value", strmakelower(value).c_str());
+ REQUIRE("value" == strmakelower(value));
}
-TEST(corestr,strreplace)
+TEST_CASE("String replace", "[util]")
{
std::string value = "Main string";
- EXPECT_EQ(1, strreplace(value,"str","aaa"));
- EXPECT_STREQ("Main aaaing", value.c_str());
- EXPECT_EQ(4, strreplace(value,"a","b"));
+ REQUIRE(1 == strreplace(value,"str","aaa"));
+ REQUIRE("Main aaaing" == value);
+ REQUIRE(4 == strreplace(value,"a","b"));
}
-TEST(corestr,strtrimspace)
+TEST_CASE("String trimming", "[util]")
{
std::string value = " a value for test ";
- EXPECT_STREQ("a value for test", strtrimspace(value).c_str());
+ REQUIRE("a value for test" == strtrimspace(value));
value = "\r\n\ta value for test\r\n\n\r";
- EXPECT_STREQ("a value for test", strtrimspace(value).c_str());
+ REQUIRE("a value for test" == strtrimspace(value));
}
-TEST(corestr,strreplacechr)
+TEST_CASE("String replace chars", "[util]")
{
std::string value = "String for doing replaces";
strreplacechr(value,'a','A');
strreplacechr(value,'e','E');
strreplacechr(value,'i','I');
strreplacechr(value,'o','O');
- EXPECT_STREQ("StrIng fOr dOIng rEplAcEs", value.c_str());
+ REQUIRE("StrIng fOr dOIng rEplAcEs" == value);
}
-TEST(corestr,strdelchr)
+TEST_CASE("String delete char", "[util]")
{
std::string value = "String for doing deletes";
strdelchr(value,'a');
strdelchr(value,'e');
strdelchr(value,'i');
strdelchr(value,'o');
- EXPECT_STREQ("Strng fr dng dlts", value.c_str());
+ REQUIRE("Strng fr dng dlts" == value);
}
diff --git a/tests/main.cpp b/tests/main.cpp
index 5a07b837186..0c7c351f437 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -1,9 +1,2 @@
-#include <stdio.h>
-#include "gtest/gtest.h"
-
-int main(int argc, char **argv)
-{
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"