21 lines
540 B
C
21 lines
540 B
C
#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;
|
|
}
|