Home
       tests/libc: Fill 0017-strerror - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 686135e189c882b2b3e9f7837b002127be743ee1
   DIR parent 158e115b8b90463541073616f288f5b8b23a7490
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
       Date:   Wed, 16 Oct 2024 15:09:23 +0200
       
       tests/libc: Fill 0017-strerror
       
       Diffstat:
         M tests/libc/execute/0017-strerror.c  |      34 +++++++++++++++++++++++++++++++
         M tests/libc/execute/libc-tests.lst   |       2 +-
       
       2 files changed, 35 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/tests/libc/execute/0017-strerror.c b/tests/libc/execute/0017-strerror.c
       @@ -1,16 +1,50 @@
        #include <assert.h>
       +#include <errno.h>
        #include <stdio.h>
        #include <string.h>
        
        /*
        output:
        testing
       +test1
       +test2
        done
        end:
        */
        
       +void
       +test1(void)
       +{
       +        printf("test1\n");
       +        if (!strerror(EDOM))
       +                printf("invalid EDOM string\n");
       +        if (!strerror(ERANGE))
       +                printf("invalid ERANGE string\n");
       +        if (!strerror(EILSEQ))
       +                printf("invalid EILSEQ string\n");
       +}
       +
       +void
       +test2(void)
       +{
       +        int i;
       +
       +        printf("test2\n");
       +#ifdef EUNKNOWN
       +        for (i = 1; i <= EUNKNOWN; i++) {
       +                if (!strerror(i))
       +                        printf("invalid string for errno=%d\n", i);
       +        }
       +#endif
       +}
       +
        int
        main()
        {
       +        printf("testing\n");
       +        test1();
       +        test2();
       +        printf("done\n");
       +
                return 0;
        }
   DIR diff --git a/tests/libc/execute/libc-tests.lst b/tests/libc/execute/libc-tests.lst
       @@ -14,7 +14,7 @@
        0014-strcoll
        0015-strcpy
        0016-strcspn
       -0017-strerror [TODO]
       +0017-strerror
        0018-strlen
        0019-strncat
        0020-strncmp