diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-09-02 20:59:29 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-09-02 20:59:29 +0200 |
commit | 835e1fcd131c63ee2b3b647e327b33a3bfb369e3 (patch) | |
tree | 9d6fb42d6296a7bbec4a6ea58358c0fdb5de7e05 /source/test/unittests/array_ref.test.c | |
parent | 34ba87d8c8cfef5ed249b34bd2d2b7e41a34d2f7 (diff) | |
download | kit-835e1fcd131c63ee2b3b647e327b33a3bfb369e3.zip |
[Linux] Change build system; Remove CMake
Diffstat (limited to 'source/test/unittests/array_ref.test.c')
-rw-r--r-- | source/test/unittests/array_ref.test.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/source/test/unittests/array_ref.test.c b/source/test/unittests/array_ref.test.c deleted file mode 100644 index c6083ee..0000000 --- a/source/test/unittests/array_ref.test.c +++ /dev/null @@ -1,65 +0,0 @@ -#include "../../kit/array_ref.h" - -#define KIT_TEST_FILE array_ref -#include "../../kit_test/test.h" - -TEST("array ref const wrap") { - int foo[] = { 1, 2, 3 }; - AR_WRAP(ref, int, foo); - - REQUIRE(ref.size == 3); - REQUIRE(ref.values[0] == 1); - REQUIRE(ref.values[1] == 2); - REQUIRE(ref.values[2] == 3); -} - -TEST("array ref wrap") { - int foo[] = { 1, 2, 3 }; - AR_MUT_WRAP(ref, int, foo); - - REQUIRE(ref.size == 3); - REQUIRE(ref.values[0] == 1); - REQUIRE(ref.values[1] == 2); - REQUIRE(ref.values[2] == 3); - - ref.values[1] = 42; - REQUIRE(ref.values[1] == 42); -} - -TEST("array ref equal") { - int foo[] = { 1, 2, 3, 4, 5, 6, 7 }; - int bar[] = { 3, 4, 5 }; - - AR(int) foo_ref = { .size = 3, .values = foo + 2 }; - AR(int) bar_ref = { .size = 3, .values = bar }; - - REQUIRE(AR_EQUAL(foo_ref, bar_ref)); -} - -static int compare(int const *left, int const *right) { - return *left - *right; -} - -TEST("array ref compare") { - int foo[] = { 1, 2, 3, 5 }; - int bar[] = { 1, 2, 4, 5 }; - - AR(int) foo_ref = { .size = 3, .values = foo }; - AR(int) bar_ref = { .size = 3, .values = bar }; - - REQUIRE(AR_COMPARE(foo_ref, bar_ref, compare) < 0); - REQUIRE(AR_COMPARE(bar_ref, foo_ref, compare) > 0); - REQUIRE(AR_COMPARE(foo_ref, foo_ref, compare) == 0); -} - -TEST("array ref different element sizes") { - int foo[] = { 1, 2, 3 }; - char bar[] = { 1, 2, 3 }; - - AR(int) foo_ref = { .size = 3, .values = foo }; - AR(char) bar_ref = { .size = 3, .values = bar }; - - REQUIRE(!AR_EQUAL(foo_ref, bar_ref)); - REQUIRE(AR_COMPARE(foo_ref, bar_ref, compare) > 0); - REQUIRE(AR_COMPARE(bar_ref, foo_ref, compare) < 0); -} |