Make each test in memcmp tests distinct in CMakeLists.txt

This commit is contained in:
2017-04-06 16:21:37 -05:00
parent 4aa233d664
commit 39edf8bbe8
2 changed files with 28 additions and 11 deletions
+4 -1
View File
@@ -7,4 +7,7 @@ add_executable(
target_link_libraries(StdTest OxStd)
add_test("Test\\ ox_memcmp" StdTest "ox_memcmp")
add_test("Test\\ ox_memcmp\\ ABCDEFG\\ !=\\ HIJKLMN" StdTest "ABCDEFG != HIJKLMN")
add_test("Test\\ ox_memcmp\\ HIJKLMN\\ !=\\ ABCDEFG" StdTest "HIJKLMN != ABCDEFG")
add_test("Test\\ ox_memcmp\\ ABCDEFG\\ ==\\ ABCDEFG" StdTest "ABCDEFG == ABCDEFG")
add_test("Test\\ ox_memcmp\\ ABCDEFGHI\\ ==\\ ABCDEFG" StdTest "ABCDEFGHI == ABCDEFG")
+24 -10
View File
@@ -10,19 +10,33 @@
#include <functional>
#include <ox/std/std.hpp>
::std::map<std::string, std::function<int()>> tests = {
using namespace std;
map<string, function<int()>> tests = {
{
"ox_memcmp",
"ABCDEFG != HIJKLMN",
[]() {
int success = 1;
const char *data1 = "ABCDEFG";
const char *data2 = "HIJKLMN";
success &= ox_memcmp(data1, data2, 7) < 0;
success &= ox_memcmp(data2, data1, 7) > 0;
success &= ox_memcmp(data1, data1, 7) == 0;
return !success;
return !ox_memcmp("ABCDEFG", "HIJKLMN", 7) < 0;
}
}
},
{
"HIJKLMN != ABCDEFG",
[]() {
return !ox_memcmp("HIJKLMN", "ABCDEFG", 7) > 0;
}
},
{
"ABCDEFG == ABCDEFG",
[]() {
return !ox_memcmp("ABCDEFG", "ABCDEFG", 7) == 0;
}
},
{
"ABCDEFGHI == ABCDEFG",
[]() {
return !ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) == 0;
}
},
};
int main(int argc, const char **args) {