Add extra tests + remove annoying comments
This commit is contained in:
parent
120893b0cd
commit
038e7409d7
1 changed files with 29 additions and 27 deletions
|
|
@ -6,10 +6,6 @@
|
|||
#include "axl_koan.h"
|
||||
#include "axl_memory.h"
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* axl_strlen */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
KOAN(strlen_empty)
|
||||
{
|
||||
i8* s = (i8*)"";
|
||||
|
|
@ -28,10 +24,6 @@ KOAN(strlen_with_special_chars)
|
|||
ASSERT_UINT_EQ(12, axl_strlen(s));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* axl_strcpy */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
KOAN(strcpy_basic)
|
||||
{
|
||||
i8* src = (i8*)"test";
|
||||
|
|
@ -59,10 +51,6 @@ KOAN(strcpy_empty)
|
|||
axl_free(dst);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* axl_strncpy */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
KOAN(strncpy_exact)
|
||||
{
|
||||
i8* src = (i8*)"hello";
|
||||
|
|
@ -103,10 +91,6 @@ KOAN(strncpy_pads_with_nulls)
|
|||
axl_free(dst);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* axl_strcat */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
KOAN(strcat_basic)
|
||||
{
|
||||
i8* dst = (i8*)axl_malloc(20);
|
||||
|
|
@ -133,10 +117,6 @@ KOAN(strcat_to_empty)
|
|||
axl_free(dst);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* axl_strncat */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
KOAN(strncat_full)
|
||||
{
|
||||
i8* dst = (i8*)axl_malloc(20);
|
||||
|
|
@ -177,10 +157,6 @@ KOAN(strncat_always_null_terminates)
|
|||
axl_free(dst);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* axl_strcmp */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
KOAN(strcmp_equal)
|
||||
{
|
||||
i8* s1 = (i8*)"hello";
|
||||
|
|
@ -223,9 +199,35 @@ KOAN(strcmp_first_empty)
|
|||
ASSERT_TRUE(axl_strcmp(s1, s2) < 0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Main */
|
||||
/* ------------------------------------------------------------------ */
|
||||
KOAN(strlen_null)
|
||||
{
|
||||
ASSERT_UINT_EQ(0, axl_strlen(NULL));
|
||||
}
|
||||
|
||||
KOAN(strcpy_null_dst)
|
||||
{
|
||||
i8 buf[10];
|
||||
ASSERT_PTR_EQ(buf, axl_strcpy(buf, NULL));
|
||||
}
|
||||
|
||||
KOAN(strcpy_null_src)
|
||||
{
|
||||
ASSERT_NULL(axl_strcpy(NULL, (const i8*)"test"));
|
||||
}
|
||||
|
||||
KOAN(strncpy_zero_n)
|
||||
{
|
||||
i8 dst[10] = {'w'};
|
||||
axl_strncpy(dst, (const i8*)"test", 0);
|
||||
ASSERT_INT_EQ('w', dst[0]);
|
||||
}
|
||||
|
||||
KOAN(strncat_zero_n)
|
||||
{
|
||||
i8 dst[10] = "hi";
|
||||
axl_strncat(dst, (const i8*)"world", 0);
|
||||
ASSERT_STR_EQ("hi", (char*)dst);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue