From 8589d6ff0c31701adfb9e18f46da471bbcf36020 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Sun, 7 Aug 2022 09:48:28 +0400 Subject: Refactor --- source/test/unittests/array_ref.test.c | 4 +- source/test/unittests/input_buffer.test.c | 2 +- source/test/unittests/input_stream.test.c | 4 +- source/test/unittests/lower_bound.test.c | 78 +++++++++++++++---------------- 4 files changed, 44 insertions(+), 44 deletions(-) (limited to 'source/test/unittests') diff --git a/source/test/unittests/array_ref.test.c b/source/test/unittests/array_ref.test.c index 62556f3..ac572b1 100644 --- a/source/test/unittests/array_ref.test.c +++ b/source/test/unittests/array_ref.test.c @@ -5,7 +5,7 @@ TEST("array ref const wrap") { int foo[] = { 1, 2, 3 }; - AR_CONST_WRAP(ref, int, foo); + AR_WRAP(ref, int, foo); REQUIRE(ref.size == 3); REQUIRE(ref.values[0] == 1); @@ -15,7 +15,7 @@ TEST("array ref const wrap") { TEST("array ref wrap") { int foo[] = { 1, 2, 3 }; - AR_WRAP(ref, int, foo); + AR_MUT_WRAP(ref, int, foo); REQUIRE(ref.size == 3); REQUIRE(ref.values[0] == 1); diff --git a/source/test/unittests/input_buffer.test.c b/source/test/unittests/input_buffer.test.c index 23499ee..a88b58b 100644 --- a/source/test/unittests/input_buffer.test.c +++ b/source/test/unittests/input_buffer.test.c @@ -4,7 +4,7 @@ #include "../../kit_test/test.h" TEST("input buffer") { - cstr_t text = { .size = 3, .values = "foo" }; + str_t text = { .size = 3, .values = "foo" }; is_handle_t in = IS_WRAP_STRING(text); ib_handle_t first = IB_WRAP(in); diff --git a/source/test/unittests/input_stream.test.c b/source/test/unittests/input_stream.test.c index e646983..7dce043 100644 --- a/source/test/unittests/input_stream.test.c +++ b/source/test/unittests/input_stream.test.c @@ -7,8 +7,8 @@ TEST("input stream wrap string") { char foo[] = "test"; char bar[] = "test"; - cstr_t foo_ref = { .size = sizeof(foo) - 1, .values = foo }; - cstr_t bar_ref = { .size = sizeof(bar) - 1, .values = bar }; + str_t foo_ref = { .size = sizeof(foo) - 1, .values = foo }; + str_t bar_ref = { .size = sizeof(bar) - 1, .values = bar }; is_handle_t in = IS_WRAP_STRING(foo_ref); diff --git a/source/test/unittests/lower_bound.test.c b/source/test/unittests/lower_bound.test.c index 275acd6..225c6ba 100644 --- a/source/test/unittests/lower_bound.test.c +++ b/source/test/unittests/lower_bound.test.c @@ -13,7 +13,7 @@ static int kit_less_int_ref(int const *left, int const *right) { } TEST("lower bound empty") { - AR_CONST(ref, int) = { .size = 0, .values = NULL }; + AR(ref, int) = { .size = 0, .values = NULL }; ptrdiff_t index; KIT_LOWER_BOUND(index, ref, 42, kit_less_int); @@ -21,8 +21,8 @@ TEST("lower bound empty") { } TEST("lower bound single left") { - int const v[1] = { 42 }; - AR_CONST(ref, int) = { .size = 1, .values = v }; + int const v[1] = { 42 }; + AR(ref, int) = { .size = 1, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 1, .values = v }; + int const v[1] = { 42 }; + AR(ref, int) = { .size = 1, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 4, .values = v }; + int const v[4] = { 1, 2, 3, 4 }; + AR(ref, int) = { .size = 4, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 4, .values = v }; + int const v[4] = { 1, 2, 3, 4 }; + AR(ref, int) = { .size = 4, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 4, .values = v }; + int const v[4] = { 1, 2, 3, 4 }; + AR(ref, int) = { .size = 4, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 4, .values = v }; + int const v[4] = { 1, 2, 3, 4 }; + AR(ref, int) = { .size = 4, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 4, .values = v }; + int const v[4] = { 1, 2, 3, 4 }; + AR(ref, int) = { .size = 4, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 4, .values = v }; + int const v[4] = { 1, 2, 3, 4 }; + int const value = 1; + AR(ref, int) = { .size = 4, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 4, .values = v }; + int const v[4] = { 1, 2, 3, 4 }; + int const value = 2; + AR(ref, int) = { .size = 4, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + int const value = 5; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_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_CONST(ref, int) = { .size = 5, .values = v }; + int const v[5] = { 1, 2, 3, 4, 5 }; + int const value = 6; + AR(ref, int) = { .size = 5, .values = v }; ptrdiff_t index; KIT_LOWER_BOUND_REF(index, ref, value, kit_less_int_ref); -- cgit v1.2.3