From b7f5d7565a19efbfebd72f2877444c552e4230c8 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 12 Mar 2021 16:44:02 +0200 Subject: libk: add Result class --- libk/test/string.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 libk/test/string.cc (limited to 'libk/test/string.cc') diff --git a/libk/test/string.cc b/libk/test/string.cc new file mode 100644 index 0000000..4d7d340 --- /dev/null +++ b/libk/test/string.cc @@ -0,0 +1,14 @@ +#include + +// strlen +static_assert(strlen("") == 0); +static_assert(strlen("0") == 1); +static_assert(strlen("hello") == 5); +static_assert(strlen("world") == 5); + +// reverse +static_assert([]() { + char s[] = "xyz"; + reverse(s, strlen(s)); + return s[0] == 'z' && s[1] == 'y' && s[2] == 'x' && s[3] == '\0'; +}()); -- cgit v1.2.1