summaryrefslogtreecommitdiffhomepage
path: root/misc/tests/cspan_test.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-08 16:16:49 +0100
committerTyge Løvset <[email protected]>2023-02-08 17:18:24 +0100
commitc4441f5fc665194fbd7a894a67a64a08c3beac42 (patch)
tree82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/tests/cspan_test.c
parent673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff)
downloadSTC-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/cspan_test.c')
-rw-r--r--misc/tests/cspan_test.c18
1 files changed, 9 insertions, 9 deletions
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);