summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-03-21 11:55:38 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-03-21 11:55:38 -0400
commita2a6ac8edd5d85398f6edb6afd02e683d9da9e7b (patch)
tree96402084c7a9184cb483aaee0fe8224a7f8871f1 /tests
parentef0aef16961508075249a6206dc0e9a9ac27d81c (diff)
downloadbfs-a2a6ac8edd5d85398f6edb6afd02e683d9da9e7b.tar.xz
bfstd: New asciilen() function
Diffstat (limited to 'tests')
-rw-r--r--tests/bfstd.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/bfstd.c b/tests/bfstd.c
index 1351e11..3ffab41 100644
--- a/tests/bfstd.c
+++ b/tests/bfstd.c
@@ -40,6 +40,21 @@ static bool check_wordesc(const char *str, const char *exp, enum wesc_flags flag
bool check_bfstd(void) {
bool ret = true;
+ ret &= bfs_check(asciilen("") == 0);
+ ret &= bfs_check(asciilen("@") == 1);
+ ret &= bfs_check(asciilen("@@") == 2);
+ ret &= bfs_check(asciilen("\xFF@") == 0);
+ ret &= bfs_check(asciilen("@\xFF") == 1);
+ ret &= bfs_check(asciilen("@@@@@@@@") == 8);
+ ret &= bfs_check(asciilen("@@@@@@@@@@@@@@@@") == 16);
+ ret &= bfs_check(asciilen("@@@@@@@@@@@@@@@@@@@@@@@@") == 24);
+ ret &= bfs_check(asciilen("@@@@@@@@@@@@@@a\xFF@@@@@@@") == 15);
+ ret &= bfs_check(asciilen("@@@@@@@@@@@@@@@@\xFF@@@@@@@") == 16);
+ ret &= bfs_check(asciilen("@@@@@@@@@@@@@@@@a\xFF@@@@@@") == 17);
+ ret &= bfs_check(asciilen("@@@@@@@\xFF@@@@@@a\xFF@@@@@@@") == 7);
+ ret &= bfs_check(asciilen("@@@@@@@@\xFF@@@@@a\xFF@@@@@@@") == 8);
+ ret &= bfs_check(asciilen("@@@@@@@@@\xFF@@@@a\xFF@@@@@@@") == 9);
+
// From man 3p basename
ret &= check_base_dir("usr", ".", "usr");
ret &= check_base_dir("usr/", ".", "usr");