From 59be7cdd0d6b7e355e3b3f18904cb1139babc213 Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Tue, 13 Jun 2023 11:15:20 +0000 Subject: [PATCH] add: test to strlen --- tests/strlen.🗿 | 8 ++++++++ tests/test.🗿 | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/strlen.🗿 diff --git a/tests/strlen.🗿 b/tests/strlen.🗿 new file mode 100644 index 0000000..70ca382 --- /dev/null +++ b/tests/strlen.🗿 @@ -0,0 +1,8 @@ +main() +{ + local str; + name = "strlen"; + str = "bozoman du 36"; + test(strlen(str), 13, ""); + test(strlen(""), 0, "Empty string"); +} diff --git a/tests/test.🗿 b/tests/test.🗿 index d04b0df..8e67c52 100644 --- a/tests/test.🗿 +++ b/tests/test.🗿 @@ -1,3 +1,5 @@ +global name; + putstr(str){ local i; i = 0; @@ -9,14 +11,14 @@ putstr(str){ } } -test(value, reach_value, error_message) +test(value, reach_value, description) { putstr(name); if (value != reach_value) { putstr(": ERROR: "); putstr(", "); - putstr(error_message); + putstr(description); putstr(" ["); putstr(reach_value); putstr(" != "); @@ -26,6 +28,7 @@ test(value, reach_value, error_message) else { putstr(": OK: "); + putstr(description); } wrt '\n'; }