diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-09-03 22:20:31 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-09-03 22:20:31 +0200 |
commit | ee0a2e7e1965200ec5968ec310bee429db819dde (patch) | |
tree | 8d5632e29233d87a6a14de1165abac7e99bd879a /source/tests | |
parent | 835e1fcd131c63ee2b3b647e327b33a3bfb369e3 (diff) | |
download | kit-ee0a2e7e1965200ec5968ec310bee429db819dde.zip |
Remove const
Diffstat (limited to 'source/tests')
-rw-r--r-- | source/tests/_static.c | 2 | ||||
-rw-r--r-- | source/tests/array_ref.test.c | 6 | ||||
-rw-r--r-- | source/tests/duration.test.c (renamed from source/tests/test_duration.test.c) | 2 | ||||
-rw-r--r-- | source/tests/input_stream.test.c | 4 | ||||
-rw-r--r-- | source/tests/lower_bound.test.c | 78 | ||||
-rw-r--r-- | source/tests/main.test.c | 3 | ||||
-rw-r--r-- | source/tests/move_back.test.c | 8 | ||||
-rw-r--r-- | source/tests/test_cpp.cpp (renamed from source/tests/cpp.cpp) | 0 | ||||
-rw-r--r-- | source/tests/test_signals.cpp (renamed from source/tests/signals.cpp) | 0 | ||||
-rw-r--r-- | source/tests/test_too_many_assertions.c (renamed from source/tests/too_many_assertions.c) | 0 | ||||
-rw-r--r-- | source/tests/test_too_many_tests.c (renamed from source/tests/too_many_tests.c) | 0 |
11 files changed, 52 insertions, 51 deletions
diff --git a/source/tests/_static.c b/source/tests/_static.c index 4b7543d..54587d3 100644 --- a/source/tests/_static.c +++ b/source/tests/_static.c @@ -43,7 +43,7 @@ #include "string_ref.test.c" #undef KIT_TEST_FILE -#include "test_duration.test.c" +#include "duration.test.c" #undef KIT_TEST_FILE #include "thread.test.c" diff --git a/source/tests/array_ref.test.c b/source/tests/array_ref.test.c index da20aa0..cb19850 100644 --- a/source/tests/array_ref.test.c +++ b/source/tests/array_ref.test.c @@ -3,7 +3,7 @@ #define KIT_TEST_FILE array_ref #include "../kit_test/test.h" -TEST("array ref const wrap") { +TEST("array ref wrap") { int foo[] = { 1, 2, 3 }; AR_WRAP(ref, int, foo); @@ -15,7 +15,7 @@ TEST("array ref const wrap") { TEST("array ref wrap") { int foo[] = { 1, 2, 3 }; - AR_MUT_WRAP(ref, int, foo); + AR_WRAP(ref, int, foo); REQUIRE(ref.size == 3); REQUIRE(ref.values[0] == 1); @@ -36,7 +36,7 @@ TEST("array ref equal") { REQUIRE(AR_EQUAL(foo_ref, bar_ref)); } -static int compare(int const *left, int const *right) { +static int compare(int *left, int *right) { return *left - *right; } diff --git a/source/tests/test_duration.test.c b/source/tests/duration.test.c index 27384b4..56919e4 100644 --- a/source/tests/test_duration.test.c +++ b/source/tests/duration.test.c @@ -1,4 +1,4 @@ -#define KIT_TEST_FILE test_duration +#define KIT_TEST_FILE duration #include "../kit_test/test.h" #if defined(_WIN32) && !defined(__CYGWIN__) diff --git a/source/tests/input_stream.test.c b/source/tests/input_stream.test.c index 61c2254..46ee0dd 100644 --- a/source/tests/input_stream.test.c +++ b/source/tests/input_stream.test.c @@ -12,8 +12,8 @@ TEST("input stream wrap string") { is_handle_t in = IS_WRAP_STRING(foo_ref); - char buf[4]; - out_str_t buf_ref = { .size = sizeof(buf), .values = buf }; + char buf[4]; + str_t buf_ref = { .size = sizeof(buf), .values = buf }; REQUIRE(IS_READ(in, buf_ref) == buf_ref.size); REQUIRE(AR_EQUAL(foo_ref, bar_ref)); diff --git a/source/tests/lower_bound.test.c b/source/tests/lower_bound.test.c index 3b62325..56ec816 100644 --- a/source/tests/lower_bound.test.c +++ b/source/tests/lower_bound.test.c @@ -8,7 +8,7 @@ static int kit_less_int(int left, int right) { return left < right; } -static int kit_less_int_ref(int const *left, int const *right) { +static int kit_less_int_ref(int *left, int *right) { return *left < *right; } @@ -21,8 +21,8 @@ TEST("lower bound empty") { } TEST("lower bound single left") { - int const v[1] = { 42 }; - AR(int) ref = { .size = 1, .values = v }; + int v[1] = { 42 }; + AR(int) ref = { .size = 1, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 42, kit_less_int); @@ -30,8 +30,8 @@ TEST("lower bound single left") { } TEST("lower bound single right") { - int const v[1] = { 42 }; - AR(int) ref = { .size = 1, .values = v }; + int v[1] = { 42 }; + AR(int) ref = { .size = 1, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 43, kit_less_int); @@ -39,8 +39,8 @@ TEST("lower bound single right") { } TEST("lower bound first of four") { - int const v[4] = { 1, 2, 3, 4 }; - AR(int) ref = { .size = 4, .values = v }; + int v[4] = { 1, 2, 3, 4 }; + AR(int) ref = { .size = 4, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 1, kit_less_int); @@ -48,8 +48,8 @@ TEST("lower bound first of four") { } TEST("lower bound second of four") { - int const v[4] = { 1, 2, 3, 4 }; - AR(int) ref = { .size = 4, .values = v }; + int v[4] = { 1, 2, 3, 4 }; + AR(int) ref = { .size = 4, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 2, kit_less_int); @@ -57,8 +57,8 @@ TEST("lower bound second of four") { } TEST("lower bound third of four") { - int const v[4] = { 1, 2, 3, 4 }; - AR(int) ref = { .size = 4, .values = v }; + int v[4] = { 1, 2, 3, 4 }; + AR(int) ref = { .size = 4, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 3, kit_less_int); @@ -66,8 +66,8 @@ TEST("lower bound third of four") { } TEST("lower bound forth of four") { - int const v[4] = { 1, 2, 3, 4 }; - AR(int) ref = { .size = 4, .values = v }; + int v[4] = { 1, 2, 3, 4 }; + AR(int) ref = { .size = 4, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 4, kit_less_int); @@ -75,8 +75,8 @@ TEST("lower bound forth of four") { } TEST("lower bound fifth of four") { - int const v[4] = { 1, 2, 3, 4 }; - AR(int) ref = { .size = 4, .values = v }; + int v[4] = { 1, 2, 3, 4 }; + AR(int) ref = { .size = 4, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 5, kit_less_int); @@ -84,8 +84,8 @@ TEST("lower bound fifth of four") { } TEST("lower bound first of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 1, kit_less_int); @@ -93,8 +93,8 @@ TEST("lower bound first of five") { } TEST("lower bound second of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 2, kit_less_int); @@ -102,8 +102,8 @@ TEST("lower bound second of five") { } TEST("lower bound third of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 3, kit_less_int); @@ -111,8 +111,8 @@ TEST("lower bound third of five") { } TEST("lower bound forth of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 4, kit_less_int); @@ -120,8 +120,8 @@ TEST("lower bound forth of five") { } TEST("lower bound fifth of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 5, kit_less_int); @@ -129,8 +129,8 @@ TEST("lower bound fifth of five") { } TEST("lower bound sixth of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND(index, ref, 6, kit_less_int); @@ -138,9 +138,9 @@ TEST("lower bound sixth of five") { } TEST("lower bound ref first of four") { - int const v[4] = { 1, 2, 3, 4 }; - int const value = 1; - AR(int) ref = { .size = 4, .values = v }; + int v[4] = { 1, 2, 3, 4 }; + int value = 1; + AR(int) ref = { .size = 4, .values = v }; ptrdiff_t index; LOWER_BOUND_REF(index, ref, &value, kit_less_int_ref); @@ -148,9 +148,9 @@ TEST("lower bound ref first of four") { } TEST("lower bound ref second of four") { - int const v[4] = { 1, 2, 3, 4 }; - int const value = 2; - AR(int) ref = { .size = 4, .values = v }; + int v[4] = { 1, 2, 3, 4 }; + int value = 2; + AR(int) ref = { .size = 4, .values = v }; ptrdiff_t index; LOWER_BOUND_REF(index, ref, &value, kit_less_int_ref); @@ -158,9 +158,9 @@ TEST("lower bound ref second of four") { } TEST("lower bound ref fifth of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - int const value = 5; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + int value = 5; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND_REF(index, ref, &value, kit_less_int_ref); @@ -168,9 +168,9 @@ TEST("lower bound ref fifth of five") { } TEST("lower bound ref sixth of five") { - int const v[5] = { 1, 2, 3, 4, 5 }; - int const value = 6; - AR(int) ref = { .size = 5, .values = v }; + int v[5] = { 1, 2, 3, 4, 5 }; + int value = 6; + AR(int) ref = { .size = 5, .values = v }; ptrdiff_t index; LOWER_BOUND_REF(index, ref, &value, kit_less_int_ref); diff --git a/source/tests/main.test.c b/source/tests/main.test.c index 2a41d4b..790c8c2 100644 --- a/source/tests/main.test.c +++ b/source/tests/main.test.c @@ -1,9 +1,10 @@ +#include "../kit/status.h" #include "../kit_test/bench.h" #include "../kit_test/test.h" int main(int argc, char **argv) { int status = run_tests(argc, argv); - if (status == 0) + if (status == KIT_OK) status = run_benchmarks(argc, argv); return status; } diff --git a/source/tests/move_back.test.c b/source/tests/move_back.test.c index f08d190..f3f6dc4 100644 --- a/source/tests/move_back.test.c +++ b/source/tests/move_back.test.c @@ -3,19 +3,19 @@ #define KIT_TEST_FILE move_back #include "../kit_test/test.h" -static int is_equal(int const x, int const y) { +static int is_equal(int x, int y) { return x == y; } -static int is_equal_ref(int const *const x, int const y) { +static int is_equal_ref(int *x, int y) { return *x == y; } -static int is_even(int const x, int const _) { +static int is_even(int x, int _) { return (x % 2) == 0; } -static int is_even_ref(int const *const x, int const _) { +static int is_even_ref(int *x, int _) { return (*x % 2) == 0; } diff --git a/source/tests/cpp.cpp b/source/tests/test_cpp.cpp index 8b762e4..8b762e4 100644 --- a/source/tests/cpp.cpp +++ b/source/tests/test_cpp.cpp diff --git a/source/tests/signals.cpp b/source/tests/test_signals.cpp index 0f6d77a..0f6d77a 100644 --- a/source/tests/signals.cpp +++ b/source/tests/test_signals.cpp diff --git a/source/tests/too_many_assertions.c b/source/tests/test_too_many_assertions.c index 662207d..662207d 100644 --- a/source/tests/too_many_assertions.c +++ b/source/tests/test_too_many_assertions.c diff --git a/source/tests/too_many_tests.c b/source/tests/test_too_many_tests.c index d4842e4..d4842e4 100644 --- a/source/tests/too_many_tests.c +++ b/source/tests/test_too_many_tests.c |