This repository has been archived on 2026-05-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
piquant/tests/string_chomp.c

19 lines
611 B
C
Raw Normal View History

#include "string.h"
#include "stdlib.h"
#include <stdio.h>
#define assert_strip(method, str, strip, count, rvalue, ret_strcmp, ret_count) \
memset((char *)&buff, 0x00, 32); \
rc = method(str, (char *)&buff, strip); \
printf("method(%s) => (%d, %s)\n", str, rc, (char *)&buff); \
if ( rc != count) return ret_count; \
if ( strcmp((char *)&buff, rvalue) != 0 ) return ret_strcmp;
int main(void)
{
char buff[32];
int rc = 0;
assert_strip(lstrip, " white space", " ", 3, "white space", 1, 2)
assert_strip(rstrip, "white space ", " ", 3, "white space", 3, 4)
return 0;
}