diff options
| author | Tyge Løvset <[email protected]> | 2023-02-08 16:16:49 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-08 17:18:24 +0100 |
| commit | c4441f5fc665194fbd7a894a67a64a08c3beac42 (patch) | |
| tree | 82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/tests | |
| parent | 673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff) | |
| download | STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.tar.gz STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.zip | |
Changed to use lowercase flow-control macros in examples (uppercase will still be supported). Improved many examples to use c_make() to init containers.
Diffstat (limited to 'misc/tests')
| -rw-r--r-- | misc/tests/cregex_test.c | 18 | ||||
| -rw-r--r-- | misc/tests/cspan_test.c | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/misc/tests/cregex_test.c b/misc/tests/cregex_test.c index ac7e958f..b3cc9f0a 100644 --- a/misc/tests/cregex_test.c +++ b/misc/tests/cregex_test.c @@ -45,7 +45,7 @@ CTEST(cregex, compile_match_anchors) CTEST(cregex, compile_match_quantifiers1) { const char* inp; - c_AUTO (cregex, re) { + c_auto (cregex, re) { re = cregex_from("ä+"); ASSERT_EQ(re.error, 0); @@ -65,7 +65,7 @@ CTEST(cregex, compile_match_quantifiers1) CTEST(cregex, compile_match_quantifiers2) { const char* inp; - c_AUTO (cregex, re) { + c_auto (cregex, re) { re = cregex_from("bä*"); ASSERT_EQ(re.error, 0); @@ -98,7 +98,7 @@ CTEST(cregex, compile_match_escaped_chars) CTEST(cregex, compile_match_class_simple) { - c_AUTO (cregex, re1, re2, re3) + c_auto (cregex, re1, re2, re3) { re1 = cregex_from("\\s"); ASSERT_EQ(re1.error, 0); @@ -123,7 +123,7 @@ CTEST(cregex, compile_match_class_simple) CTEST(cregex, compile_match_or) { - c_AUTO (cregex, re, re2) + c_auto (cregex, re, re2) { re = cregex_from("as|df"); ASSERT_EQ(re.error, 0); @@ -185,7 +185,7 @@ CTEST(cregex, compile_match_cap) CTEST(cregex, search_all) { const char* inp; - c_AUTO (cregex, re) + c_auto (cregex, re) { re = cregex_from("ab"); csview m = {0}; @@ -206,7 +206,7 @@ CTEST(cregex, search_all) CTEST(cregex, captures_len) { - c_AUTO (cregex, re) { + c_auto (cregex, re) { re = cregex_from("(ab(cd))(ef)"); ASSERT_EQ(cregex_captures(&re), 4); } @@ -215,7 +215,7 @@ CTEST(cregex, captures_len) CTEST(cregex, captures_cap) { const char* inp; - c_AUTO (cregex, re) { + c_auto (cregex, re) { re = cregex_from("(ab)((cd)+)"); ASSERT_EQ(cregex_captures(&re), 4); @@ -249,7 +249,7 @@ CTEST(cregex, replace) const char* pattern = "\\b(\\d\\d\\d\\d)-(1[0-2]|0[1-9])-(3[01]|[12][0-9]|0[1-9])\\b"; const char* input = "start date: 2015-12-31, end date: 2022-02-28"; - c_AUTO (cstr, str) { + c_auto (cstr, str) { // replace with a fixed string, extended all-in-one call: cstr_take(&str, cregex_replace_pattern(pattern, input, "YYYY-MM-DD")); ASSERT_STREQ(cstr_str(&str), "start date: YYYY-MM-DD, end date: YYYY-MM-DD"); @@ -267,7 +267,7 @@ CTEST(cregex, replace) ASSERT_STREQ(cstr_str(&str), "52 ${apples} ${and} 31 ${mangoes}"); // Compile RE separately - c_WITH (cregex re = cregex_from(pattern), cregex_drop(&re)) { + c_with (cregex re = cregex_from(pattern), cregex_drop(&re)) { ASSERT_EQ(cregex_captures(&re), 4); // European date format. diff --git a/misc/tests/cspan_test.c b/misc/tests/cspan_test.c index 9e33467c..5d46f579 100644 --- a/misc/tests/cspan_test.c +++ b/misc/tests/cspan_test.c @@ -47,9 +47,9 @@ CTEST(cspan, slice) { #include <stc/cstack.h> CTEST(cspan, slice2) { - c_AUTO (cstack_int, stack) + c_auto (cstack_int, stack) { - c_FORRANGE (i, 10*20*30) + c_forrange (i, 10*20*30) cstack_int_push(&stack, i); intspan3 ms3 = cspan_md(stack.data, 10, 20, 30); @@ -66,7 +66,7 @@ CTEST(cspan, slice2) { ASSERT_EQ(65112, sum); sum = 0; - c_FOREACH (i, intspan3, ms3) + c_foreach (i, intspan3, ms3) sum += *i.ref; ASSERT_EQ(65112, sum); } @@ -89,14 +89,14 @@ CTEST_SETUP(cspan_cube) { _self->tiles = Tiles_init(); cstack_int_reserve(&_self->stack, N); - c_FORRANGE (i, N) + c_forrange (i, N) cstack_int_push(&_self->stack, i+1); intspan3 ms3 = cspan_md(_self->stack.data, CUBE, CUBE, CUBE); - c_FORRANGE (i, 0, ms3.shape[0], TSIZE) { - c_FORRANGE (j, 0, ms3.shape[1], TSIZE) { - c_FORRANGE (k, 0, ms3.shape[2], TSIZE) { + c_forrange (i, 0, ms3.shape[0], TSIZE) { + c_forrange (j, 0, ms3.shape[1], TSIZE) { + c_forrange (k, 0, ms3.shape[2], TSIZE) { intspan3 tile = cspan_slice(intspan3, &ms3, {i, i + TSIZE}, {j, j + TSIZE}, {k, k + TSIZE}); Tiles_push(&_self->tiles, tile); } @@ -117,8 +117,8 @@ CTEST_F(cspan_cube, slice3) { int64_t sum = 0; // iterate each 3d tile in sequence - c_FOREACH (i, Tiles, _self->tiles) - c_FOREACH (t, intspan3, *i.ref) + c_foreach (i, Tiles, _self->tiles) + c_foreach (t, intspan3, *i.ref) sum += *t.ref; ASSERT_EQ(n*(n + 1)/2, sum); |
