sv/tests/10_sv_strstr.c

23 lines
572 B
C
Raw Normal View History

2025-07-11 16:00:57 +00:00
#define DEBUG
#include "../include/sv.h"
#include "../include/except.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
const char *haystack = "Hello World, this is a test.";
const char *needle = "World,";
const char *result = "World, this is a test.";
SV sv_haystack = sv_strn(haystack,strlen(haystack));
SV sv_needle = sv_strn(needle,strlen(needle));
SV sv_res = sv_strn(result,strlen(result));
SV test = sv_strstr(sv_haystack,sv_needle);
ASSERTED(sv_cmp(sv_res,test) == 0);
return EXIT_SUCCESS;
}