Make each test in memcmp tests distinct in CMakeLists.txt
This commit is contained in:
@@ -7,4 +7,7 @@ add_executable(
|
|||||||
|
|
||||||
target_link_libraries(StdTest OxStd)
|
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
@@ -10,19 +10,33 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <ox/std/std.hpp>
|
#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;
|
return !ox_memcmp("ABCDEFG", "HIJKLMN", 7) < 0;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"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) {
|
int main(int argc, const char **args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user