diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-06-24 13:28:21 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-06-24 13:28:21 +1000 |
commit | 147bcfbba9e9eaec215b5ad40e6bfb3fd57361dd (patch) | |
tree | bfa06a28b65ea3ce976f6bad7584829853270bee /libc | |
parent | b8677f6a97a978e11017736a280bc948bb1a85fe (diff) | |
download | skiboot-147bcfbba9e9eaec215b5ad40e6bfb3fd57361dd.zip skiboot-147bcfbba9e9eaec215b5ad40e6bfb3fd57361dd.tar.gz skiboot-147bcfbba9e9eaec215b5ad40e6bfb3fd57361dd.tar.bz2 |
add tests for libc strcmp
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libc')
-rw-r--r-- | libc/test/run-memops-test.c | 6 | ||||
-rw-r--r-- | libc/test/run-memops.c | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libc/test/run-memops-test.c b/libc/test/run-memops-test.c index c848a1d..41c624f 100644 --- a/libc/test/run-memops-test.c +++ b/libc/test/run-memops-test.c @@ -46,6 +46,7 @@ int test_memset(char* buf, int c, size_t s); int test_memchr(const void *ptr, int c, size_t n, void* expected); int test_memcmp(const void *ptr1, const void *ptr2, size_t n, int expected); +int test_strcmp(const void *ptr1, const void *ptr2, int expected); int test_memset(char* buf, int c, size_t s) { @@ -69,3 +70,8 @@ int test_memcmp(const void *ptr1, const void *ptr2, size_t n, int expected) { return(expected == memcmp(ptr1, ptr2, n)); } + +int test_strcmp(const void *ptr1, const void *ptr2, int expected) +{ + return(expected == strcmp(ptr1, ptr2)); +} diff --git a/libc/test/run-memops.c b/libc/test/run-memops.c index ded21ae..259c4ff 100644 --- a/libc/test/run-memops.c +++ b/libc/test/run-memops.c @@ -24,6 +24,7 @@ int test_memset(char* buf, int c, size_t s); int test_memchr(const void *ptr, int c, size_t n, void* expected); int test_memcmp(const void *ptr1, const void *ptr2, size_t n, int expected); +int test_strcmp(const void *ptr1, const void *ptr2, int expected); int main(void) { @@ -49,6 +50,9 @@ int main(void) assert(test_memcmp(buf, "Hello World!", strlen(buf), 0)); assert(test_memcmp(buf, "Hfllow World", strlen(buf), -1)); + + assert(test_strcmp(buf, "Hello World!", 0)); + assert(test_strcmp(buf, "Hfllow World", -1)); free(buf); return 0; |