From 05630cf10cc01a237131989248261149f03fc8ab Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Sun, 7 Aug 2022 08:55:32 +0400 Subject: static array wrap, static string wrap --- source/test/unittests/array_ref.test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source/test/unittests/array_ref.test.c') diff --git a/source/test/unittests/array_ref.test.c b/source/test/unittests/array_ref.test.c index d8cbcec..27b754b 100644 --- a/source/test/unittests/array_ref.test.c +++ b/source/test/unittests/array_ref.test.c @@ -3,6 +3,29 @@ #define KIT_TEST_FILE array_ref #include "../../kit_test/test.h" +TEST("array ref const wrap") { + int foo[] = { 1, 2, 3 }; + AR_CONST_WRAP(ref, 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_WRAP(ref, 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 }; -- cgit v1.2.3