Created
July 12, 2012 01:23
-
-
Save alyx/3095027 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "str.h" | |
void test_str_raw() | |
{ | |
char string[512]; | |
corcstr_copy_raw(string, "moo", 512); | |
if(strcmp(string, "moo") != 0) | |
printf("test_str_raw() failed!\n"); | |
corcstr_concat_raw(string, " cows", 509); | |
if(strcmp(string, "moo cows") != 0) | |
printf("test_str_raw_concat failed!\n"); | |
} | |
void test_str_append() | |
{ | |
CorcString *cs; | |
cs = corcstr_create(); | |
corcstr_append(cs, "moo", 3); | |
if(strcmp(cs->string, "moo") != 0) | |
printf("CorcString appending failed!\n"); | |
corcstr_append_char(cs, ' '); | |
if(strcmp(cs->string, "moo ") != 0) | |
printf("CorcString single-character appending failed!\n"); | |
} | |
void test_str_remove() | |
{ | |
CorcString *cs; | |
cs = corcstr_create(); | |
corcstr_append(cs, "The quick brown fox jumped over the lazy dog.", 45); | |
corcstr_remove(cs, 5); | |
if(strcmp(cs->string, "The quick brown fox jumped over the lazy") != 0) | |
printf("CorcString end removing failed!\n"); | |
} | |
int main(void) | |
{ | |
test_str_raw(); | |
test_str_append(); | |
test_str_remove(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment