From 29a4bb920adfdb8ef8093bb3e0b23a08dd3b8bce Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 24 Mar 2021 01:29:01 -0500 Subject: [PATCH] [ox/std] Cleanup tests --- deps/ox/src/ox/std/test/tests.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/deps/ox/src/ox/std/test/tests.cpp b/deps/ox/src/ox/std/test/tests.cpp index b15f5632..b8e98b2a 100644 --- a/deps/ox/src/ox/std/test/tests.cpp +++ b/deps/ox/src/ox/std/test/tests.cpp @@ -6,12 +6,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#undef NDEBUG + #include #include #include #include -std::map> tests = { +std::map> tests = { { "malloc", [] { @@ -19,31 +21,31 @@ std::map> tests = { ox::heapmgr::initHeap(&buff.front(), &buff.back()); oxAssert(ox::heapmgr::malloc(5) != nullptr, "malloc is broken"); oxAssert(ox::heapmgr::malloc(5) != nullptr, "malloc is broken"); - return 0; + return OxError(0); } }, { "ABCDEFG != HIJKLMN", []() { - return ox_memcmp("ABCDEFG", "HIJKLMN", 7) >= 0; + return OxError(ox_memcmp("ABCDEFG", "HIJKLMN", 7) >= 0); } }, { "HIJKLMN != ABCDEFG", []() { - return ox_memcmp("HIJKLMN", "ABCDEFG", 7) <= 0; + return OxError(ox_memcmp("HIJKLMN", "ABCDEFG", 7) <= 0); } }, { "ABCDEFG == ABCDEFG", []() { - return ox_memcmp("ABCDEFG", "ABCDEFG", 7) != 0; + return OxError(ox_memcmp("ABCDEFG", "ABCDEFG", 7) != 0); } }, { "ABCDEFGHI == ABCDEFG", []() { - return ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) != 0; + return OxError(ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) != 0); } }, { @@ -89,7 +91,7 @@ std::map> tests = { insertTest(42, 1); insertTest(100, 2); insertTest(102, 3); - return 0; + return OxError(0); } }, { @@ -100,7 +102,7 @@ std::map> tests = { v["aoeu"] = 100; oxAssert(v["asdf"] == 42, "asdf != 42"); oxAssert(v["aoeu"] == 100, "aoeu != 100"); - return 0; + return OxError(0); } }, }; @@ -109,7 +111,8 @@ int main(int argc, const char **args) { if (argc > 1) { auto testName = args[1]; if (tests.find(testName) != tests.end()) { - return tests[testName](); + oxAssert(tests[testName](), "Test returned Error"); + return 0; } } return -1;