Line data Source code
1 : /* tst_idna4.c --- Self tests for memory leak regression.
2 : * Copyright (C) 2011-2020 Simon Josefsson
3 : *
4 : * This file is part of GNU Libidn.
5 : *
6 : * This program is free software: you can redistribute it and/or modify
7 : * it under the terms of the GNU General Public License as published by
8 : * the Free Software Foundation, either version 3 of the License, or
9 : * (at your option) any later version.
10 : *
11 : * This program is distributed in the hope that it will be useful,
12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : * GNU General Public License for more details.
15 : *
16 : * You should have received a copy of the GNU General Public License
17 : * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 : *
19 : */
20 :
21 : #ifdef HAVE_CONFIG_H
22 : # include "config.h"
23 : #endif
24 :
25 : #include <stdio.h>
26 : #include <stdlib.h>
27 : #include <stdarg.h>
28 : #include <string.h>
29 :
30 : #include <idna.h>
31 : #include <idn-free.h>
32 :
33 : #include "utils.h"
34 :
35 : void
36 1 : doit (void)
37 : {
38 : int rc;
39 1 : char *out = NULL;
40 :
41 1 : rc = idna_to_ascii_8z ("search...", &out, 0);
42 1 : if (rc != IDNA_INVALID_LENGTH)
43 0 : fail ("unexpected rc %d\n", rc);
44 :
45 1 : rc = idna_to_ascii_8z ("google.com................point", &out, 0);
46 1 : if (rc != IDNA_INVALID_LENGTH)
47 0 : fail ("unexpected rc %d\n", rc);
48 :
49 1 : rc = idna_to_ascii_8z ("Loading...\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0"
50 : "\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0\xC2\xB0"
51 : "\xC2\xB0\xC2\xB0\xC2\xB0]", &out, 0);
52 1 : if (rc != IDNA_INVALID_LENGTH)
53 0 : fail ("unexpected rc %d\n", rc);
54 1 : }
|