blob: 24ec67c9316700b5ec2a258cbd79a218ae4a2cd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "reverse.h"
int assert_equals(char *actual, char *expected)
{
int ret;
ret = strcmp(actual, expected);
if(ret != 0){
printf("FAIL! actual: '%s', expected: '%s'", actual, expected);
} else {
printf("PASS! actual: '%s', expected: '%s'", actual, expected);
}
return ret == 0?1:0;
}
void test_string_reversal()
{
char input[32];
strcpy( input, "tell The Truth");
reverse(input);
assert_equals(input, "hturT ehT llet");
}
int main(int argc, const char *argv[])
{
test_string_reversal();
return 0;
}
|