blob: 5ca77e3e5f5682c1bfa0a478957244ab0f8fda2e (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <stdio.h>
#include <stdlib.h>
#include <parserutils/parserutils.h>
#include "input/filter.h"
#include "testutils.h"
static void *myrealloc(void *ptr, size_t len, void *pw)
{
UNUSED(pw);
return realloc(ptr, len);
}
int main(int argc, char **argv)
{
parserutils_filter *input;
parserutils_filter_optparams params;
parserutils_error expected;
#ifdef WITH_ICONV_FILTER
expected = PARSERUTILS_OK;
#else
expected = PARSERUTILS_BADENCODING;
#endif
UNUSED(argc);
UNUSED(argv);
assert(parserutils_filter_create("UTF-8", myrealloc, NULL, &input) ==
PARSERUTILS_OK);
params.encoding.name = "GBK";
assert(parserutils_filter_setopt(input,
PARSERUTILS_FILTER_SET_ENCODING, ¶ms) ==
expected);
params.encoding.name = "GBK";
assert(parserutils_filter_setopt(input,
PARSERUTILS_FILTER_SET_ENCODING, ¶ms) ==
expected);
parserutils_filter_destroy(input);
printf("PASS\n");
return 0;
}
|