LCOV - code coverage report
Current view: top level - tests - tst_idna4.c (source / functions) Hit Total Coverage
Test: GNU Libidn Lines: 9 12 75.0 %
Date: 2020-07-22 17:53:13 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          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 : }

Generated by: LCOV version 1.13