diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-03-12 16:44:02 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-03-12 16:44:02 +0200 |
commit | b7f5d7565a19efbfebd72f2877444c552e4230c8 (patch) | |
tree | e17ec2edc3be86672442ca1ab854f21cb566b598 /libk/test/string.cc | |
parent | vmm: map multiboot structs (diff) | |
download | kernel.cpp-b7f5d7565a19efbfebd72f2877444c552e4230c8.tar.xz |
libk: add Result<T, E> class
Diffstat (limited to 'libk/test/string.cc')
-rw-r--r-- | libk/test/string.cc | 14 |
1 files changed, 14 insertions, 0 deletions
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 <string.h> + +// 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'; +}()); |