-
Notifications
You must be signed in to change notification settings - Fork 5
/
t-entities.c
36 lines (29 loc) · 879 Bytes
/
t-entities.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
/* Copyright 2012 Christoph Gärtner, ooxi/entities
https://bitbucket.org/cggaertner/cstuff
https://github.com/ooxi/entities
Distributed under the Boost Software License, Version 1.0
*/
#include "entities.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#undef NDEBUG
#include <assert.h>
int main(void)
{
{
static const char SAMPLE[] = "Christoph Gärtner";
static char buffer[] = "Christoph Gärtner";
assert(decode_html_entities_utf8(buffer, NULL) == sizeof SAMPLE - 1);
assert(strcmp(buffer, SAMPLE) == 0);
}
{
static const char SAMPLE[] = "test@example.org";
static const char INPUT[] = "test@example.org";
static char buffer[sizeof INPUT];
assert(decode_html_entities_utf8(buffer, INPUT) == sizeof SAMPLE - 1);
assert(strcmp(buffer, SAMPLE) == 0);
}
fprintf(stdout, "All tests passed :-)\n");
return EXIT_SUCCESS;
}