forked from Imagelibrary/rtems
psxhdrs: add POSIX API Signature Compliance Tests for locale.h (GCI 2018)
This commit is contained in:
committed by
Joel Sherrill
parent
903c57a8b4
commit
0888bfd5dd
@@ -1126,7 +1126,13 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
|
|||||||
psxhdrs/dlfcn/dlopen.c \
|
psxhdrs/dlfcn/dlopen.c \
|
||||||
psxhdrs/dlfcn/dlclose.c \
|
psxhdrs/dlfcn/dlclose.c \
|
||||||
psxhdrs/dlfcn/dlerror.c \
|
psxhdrs/dlfcn/dlerror.c \
|
||||||
psxhdrs/dlfcn/dlsym.c
|
psxhdrs/dlfcn/dlsym.c \
|
||||||
|
psxhdrs/locale/newlocale.c \
|
||||||
|
psxhdrs/locale/freelocale.c \
|
||||||
|
psxhdrs/locale/uselocale.c \
|
||||||
|
psxhdrs/locale/setlocale.c \
|
||||||
|
psxhdrs/locale/duplocale.c \
|
||||||
|
psxhdrs/locale/localeconv.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
rtems_tests_PROGRAMS = $(psx_tests)
|
rtems_tests_PROGRAMS = $(psx_tests)
|
||||||
|
|||||||
41
testsuites/psxtests/psxhdrs/locale/duplocale.c
Normal file
41
testsuites/psxtests/psxhdrs/locale/duplocale.c
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief duplocale() API Conformance Test
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 2018.
|
||||||
|
* Himanshu Sekhar Nayak
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software
|
||||||
|
* for any purpose with or without fee is hereby granted.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||||
|
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
int test( void );
|
||||||
|
|
||||||
|
int test( void )
|
||||||
|
{
|
||||||
|
locale_t newloc;
|
||||||
|
locale_t locobj;
|
||||||
|
int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
|
||||||
|
char *locale = "loc1";
|
||||||
|
|
||||||
|
newloc = newlocale( category_mask, locale, (locale_t)0 );
|
||||||
|
locobj = duplocale( newloc );
|
||||||
|
|
||||||
|
return (locobj != NULL);
|
||||||
|
}
|
||||||
40
testsuites/psxtests/psxhdrs/locale/freelocale.c
Normal file
40
testsuites/psxtests/psxhdrs/locale/freelocale.c
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief freelocale() API Conformance Test
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 2018.
|
||||||
|
* Himanshu Sekhar Nayak
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software
|
||||||
|
* for any purpose with or without fee is hereby granted.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||||
|
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
int test( void );
|
||||||
|
|
||||||
|
int test( void )
|
||||||
|
{
|
||||||
|
locale_t newloc;
|
||||||
|
int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
|
||||||
|
char *locale = "loc1";
|
||||||
|
|
||||||
|
newloc = newlocale( category_mask, locale, (locale_t)0 );
|
||||||
|
freelocale( newloc );
|
||||||
|
|
||||||
|
return (newloc != NULL);
|
||||||
|
}
|
||||||
39
testsuites/psxtests/psxhdrs/locale/localeconv.c
Normal file
39
testsuites/psxtests/psxhdrs/locale/localeconv.c
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief localeconv() API Conformance Test
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 2018.
|
||||||
|
* Himanshu Sekhar Nayak
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software
|
||||||
|
* for any purpose with or without fee is hereby granted.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||||
|
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
int test( void );
|
||||||
|
|
||||||
|
int test( void )
|
||||||
|
{
|
||||||
|
struct lconv *lc;
|
||||||
|
int category = LC_MONETARY;
|
||||||
|
|
||||||
|
setlocale( category, "" );
|
||||||
|
lc = localeconv();
|
||||||
|
|
||||||
|
return (lc != NULL);
|
||||||
|
}
|
||||||
39
testsuites/psxtests/psxhdrs/locale/newlocale.c
Normal file
39
testsuites/psxtests/psxhdrs/locale/newlocale.c
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief newlocale() API Conformance Test
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 2018.
|
||||||
|
* Himanshu Sekhar Nayak
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software
|
||||||
|
* for any purpose with or without fee is hereby granted.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||||
|
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
int test( void );
|
||||||
|
|
||||||
|
int test( void )
|
||||||
|
{
|
||||||
|
locale_t newloc;
|
||||||
|
int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
|
||||||
|
char *locale = "loc1";
|
||||||
|
|
||||||
|
newloc = newlocale( category_mask, locale, (locale_t)0 );
|
||||||
|
|
||||||
|
return (newloc != NULL);
|
||||||
|
}
|
||||||
39
testsuites/psxtests/psxhdrs/locale/setlocale.c
Normal file
39
testsuites/psxtests/psxhdrs/locale/setlocale.c
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief setlocale() API Conformance Test
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 2018.
|
||||||
|
* Himanshu Sekhar Nayak
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software
|
||||||
|
* for any purpose with or without fee is hereby granted.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||||
|
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
int test( void );
|
||||||
|
|
||||||
|
int test( void )
|
||||||
|
{
|
||||||
|
int category = LC_ALL;
|
||||||
|
char *locale = "loc1";
|
||||||
|
char *ostring;
|
||||||
|
|
||||||
|
ostring = setlocale( category, locale );
|
||||||
|
|
||||||
|
return (ostring != NULL);
|
||||||
|
}
|
||||||
41
testsuites/psxtests/psxhdrs/locale/uselocale.c
Normal file
41
testsuites/psxtests/psxhdrs/locale/uselocale.c
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief uselocale() API Conformance Test
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 2018.
|
||||||
|
* Himanshu Sekhar Nayak
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software
|
||||||
|
* for any purpose with or without fee is hereby granted.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||||
|
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
int test( void );
|
||||||
|
|
||||||
|
int test( void )
|
||||||
|
{
|
||||||
|
locale_t newloc;
|
||||||
|
locale_t currentloc;
|
||||||
|
int category_mask = LC_CTYPE_MASK | LC_TIME_MASK;
|
||||||
|
char *locale = "loc1";
|
||||||
|
|
||||||
|
newloc = newlocale( category_mask, locale, (locale_t)0 );
|
||||||
|
currentloc = uselocale( newloc );
|
||||||
|
|
||||||
|
return (currentloc != NULL);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user