-
Notifications
You must be signed in to change notification settings - Fork 0
/
loggingtest.c
56 lines (42 loc) · 960 Bytes
/
loggingtest.c
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "logging.h"
void testescape1(void);
void testescape2(void);
void testescape3(void);
int main(int argc, const char *argv[])
{
testescape1();
testescape2();
testescape3();
return 0;
}
void testescape1(void)
{
char *input = "mikel";
char *expected = "mikel";
char *actual;
printf("Running %s\n", __func__);
actual = escape_percents(input);
assert(strcmp(actual, expected) == 0);
}
void testescape2(void)
{
char *input = NULL;
char *actual;
printf("Running %s\n", __func__);
actual = escape_percents(input);
assert(actual == NULL);
}
void testescape3(void)
{
char *input = "%sally";
char *expected = "%%sally";
char *actual;
printf("Running %s\n", __func__);
actual = escape_percents(input);
assert(strcmp(actual, expected) == 0);
}
/* vim: set ts=4 sw=4 tw=0 et:*/