Skip to content

Commit

Permalink
test cs loop command
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed May 28, 2024
1 parent f8702d5 commit 7c9e9c3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/testcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,21 @@ namespace

test_cs_command(inputs);
}

void test_cs_loop()
{
std::printf("testing CS loop command\n");

std::vector<std::pair<std::string, int>> inputs = {
{"testval = 0; loop i 10 [testval = (+ $testval 1)]; result $testval", 10},
{"testval = 0; loop i 10 [testval = (+ $testval $i)]; result $testval", 45},
{"testval = 0; loop i 10 [testval = (+ $testval $i)]; result $i", 0},
{"testval = 0; loop i 0 [testval = (+ $testval 1)]; result $testval", 0},
{"testval = 0; loop i 'test' [testval = (+ $testval 1)]; result $testval", 0},
};

test_cs_command(inputs);
}
}

//run tests
Expand Down Expand Up @@ -1288,6 +1303,7 @@ void testcs()
//controlcmds
test_cs_result();
test_cs_listlen();
test_cs_loop();
//command.h
testescapestring();
testescapeid();
Expand Down

0 comments on commit 7c9e9c3

Please sign in to comment.