Initial commit
This commit is contained in:
24
tests/03_trim_left.c
Normal file
24
tests/03_trim_left.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#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);
|
||||
|
||||
assert(sv.buf != NULL);
|
||||
assert(strlen(s) == sv.len);
|
||||
assert( memcmp(sv.buf, s, strlen(s)) == 0);
|
||||
SV sv2 = sv_trim_left(sv);
|
||||
assert(sv2.len != strlen(s));
|
||||
assert( memcmp(sv2.buf, s, sv2.len) != 0);
|
||||
assert( memcmp(sv2.buf, s2, sv2.len) == 0);
|
||||
assert( sv2.len == strlen(s2));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user