mirror of
https://github.com/json-c/json-c.git
synced 2026-03-25 16:09:06 +08:00
move locale change to be global for perf
This commit is contained in:
@@ -11,6 +11,7 @@ check_PROGRAMS += test_parse_int64
|
||||
check_PROGRAMS += test_null
|
||||
check_PROGRAMS += test_cast
|
||||
check_PROGRAMS += test_parse
|
||||
check_PROGRAMS += test_locale
|
||||
|
||||
test1_LDADD = $(LIBJSON_LA)
|
||||
|
||||
@@ -36,6 +37,8 @@ test_cast_LDADD = $(LIBJSON_LA)
|
||||
|
||||
test_parse_LDADD = $(LIBJSON_LA)
|
||||
|
||||
test_locale_LDADD = $(LIBJSON_LA)
|
||||
|
||||
TESTS = test1.test test2.test test4.test testReplaceExisting.test parse_int64.test test_null.test test_cast.test test_parse.test
|
||||
|
||||
TESTS+= test_printbuf.test
|
||||
|
||||
30
tests/test_locale.c
Normal file
30
tests/test_locale.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "json.h"
|
||||
#include "json_tokener.h"
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif /* HAVE_LOCALE_H */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
json_object *new_obj;
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale(LC_NUMERIC, "de_DE");
|
||||
#else
|
||||
printf("No locale\n");
|
||||
#endif
|
||||
|
||||
MC_SET_DEBUG(1);
|
||||
|
||||
new_obj = json_tokener_parse("[1.2,3.4,123456.78,5.0]");
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user