diff options
author | Mattias Andrée <maandree@kth.se> | 2018-11-23 23:37:11 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-11-23 23:37:11 +0100 |
commit | ea9beb1d5dceb99797482ae8b580f5fbd7be8128 (patch) | |
tree | 7a4c9faa17f02c36f6cbd3ee24ce15bc62c67e10 /rawmemrelem.c | |
parent | Split out memelem.h from mem.h (diff) | |
download | libsimple-ea9beb1d5dceb99797482ae8b580f5fbd7be8128.tar.gz libsimple-ea9beb1d5dceb99797482ae8b580f5fbd7be8128.tar.bz2 libsimple-ea9beb1d5dceb99797482ae8b580f5fbd7be8128.tar.xz |
Add tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | rawmemrelem.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rawmemrelem.c b/rawmemrelem.c index 75a15a9..4e93b5c 100644 --- a/rawmemrelem.c +++ b/rawmemrelem.c @@ -4,7 +4,7 @@ void * -libsimple_rawmemrelem(const void *hay_, size_t hayn, const void *sub_, size_t subn) +libsimple_rawmemrelem(const void *hay_, size_t hayn, const void *sub_, size_t subn) /* TODO man */ { switch (subn) { case 0: @@ -68,6 +68,11 @@ main(void) assert(!strcmpnul(libsimple_rawmemrelem("abcd1234abcd1234", 4, "1234", 4), "1234")); assert(!strcmpnul(libsimple_rawmemrelem("abcdefgh12345678abcdefgh12345678", 4, "12345678", 8), "12345678")); assert(!strcmpnul(libsimple_rawmemrelem("abc123abc123", 4, "123", 3), "123")); + + assert(!strcmpnul(libsimple_rawmemrelem("-aa--a-a", 4, "a-", 2), "a--a-a")); + assert(!strcmpnul(libsimple_rawmemrelem("--aa----a--a", 4, "a--", 3), "a----a--a")); + assert(!strcmpnul(libsimple_rawmemrelem("---aa------a---a", 4, "a---", 4), "a------a---a")); + assert(!strcmpnul(libsimple_rawmemrelem("-------aa--------------a-------a", 4, "a-------", 8), "a--------------a-------a")); return 0; } |