Make improvements

This commit is contained in:
Justine Tunney
2020-12-01 03:43:40 -08:00
parent 3e4fd4b0ad
commit e44a0cf6f8
256 changed files with 23100 additions and 2294 deletions

View File

@@ -19,10 +19,12 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/bits/bits.h"
#include "libc/conv/conv.h"
#include "libc/mem/mem.h"
#include "libc/testlib/testlib.h"
TEST(basename, test) {
EXPECT_STREQ("", basename(""));
EXPECT_STREQ("/", basename("/"));
EXPECT_STREQ("hello", basename("hello"));
EXPECT_STREQ("there", basename("hello/there"));
EXPECT_STREQ("yo", basename("hello/there/yo"));
@@ -42,3 +44,13 @@ TEST(basename, testWindows_isGrantedRespect) {
EXPECT_STREQ("there", basename("hello\\there"));
EXPECT_STREQ("yo", basename("hello\\there\\yo"));
}
TEST(dirname, test) {
EXPECT_STREQ("/usr", dirname(strdup("/usr/lib")));
EXPECT_STREQ("usr", dirname(strdup("usr/lib")));
EXPECT_STREQ("/", dirname(strdup("/usr/")));
EXPECT_STREQ("/", dirname(strdup("/")));
EXPECT_STREQ(".", dirname(strdup("hello")));
EXPECT_STREQ(".", dirname(strdup(".")));
EXPECT_STREQ(".", dirname(strdup("..")));
}

View File

@@ -27,6 +27,7 @@ TEST_LIBC_CONV_DIRECTDEPS = \
LIBC_CONV \
LIBC_FMT \
LIBC_LOG \
LIBC_MEM \
LIBC_STDIO \
LIBC_NEXGEN32E \
LIBC_STUBS \