Initial commit
This commit is contained in:
20
tests/10_strstr.c
Normal file
20
tests/10_strstr.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#define DEBUG
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../include/sv.h"
|
||||
|
||||
int main(void){
|
||||
const char *s = "Hello World!,Goodbye World!";
|
||||
const char *n = "Goodbye";
|
||||
const char *test = "Goodbye World!";
|
||||
struct String_View sv = sv_strn(s, strlen(s));
|
||||
struct String_View sv2 = sv_strn(n, strlen(n));
|
||||
|
||||
struct String_View found = sv_str_str(sv, sv2);
|
||||
assert(found.len == strlen(test));
|
||||
assert( memcmp(found.buf, test, found.len) == 0);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user