Initial commit

This commit is contained in:
2026-01-17 12:19:24 -06:00
commit a2dbda162f
17 changed files with 563 additions and 0 deletions

25
tests/06_sv_eq.c Normal file
View File

@@ -0,0 +1,25 @@
#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! ";
const char *s2 = "Hello World!";
SV sv = sv_str(s);
SV sv3 = sv_str(s2);
assert(sv.buf != NULL);
assert(strlen(s) == sv.len);
assert( memcmp(sv.buf, s, strlen(s)) == 0);
SV sv2 = sv_trim(sv);
assert(sv2.len == strlen(s2));
assert(memcmp(s2, sv2.buf, sv2.len) == 0);
assert(sv2.len != strlen(s));
assert( memcmp(s, sv2.buf, sv2.len) != 0);
assert( !sv_eq(sv, sv2));
assert( sv_eq(sv2,sv3));
return EXIT_SUCCESS;
}