aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-21 09:31:24 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-21 09:31:24 -0800
commitcb7bdc3ea72f234d333e119ecd9fdb85b55faafe (patch)
tree28e1b605af4722179b1cc3055fd27ce38b648d84 /tests
parente71ed8514296ab1fabfa2340b17480a60e8c9100 (diff)
parentac28698a41d8cb1eb944947abe8a5a98a9f137c0 (diff)
Merge pull request #2139 from TV4Fun/memfixes
Fix errors in locale and allocate, and a few other tweaks
Diffstat (limited to 'tests')
-rw-r--r--tests/test_core.py4
-rw-r--r--tests/test_locale.c24
-rw-r--r--tests/test_locale.out12
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 733407ff..b96cbc36 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -6400,6 +6400,10 @@ def process(filename):
if os.environ.get('EMCC_FAST_COMPILER') != '1': return self.skip('this test will not pass in the old compiler')
self.do_run(open(path_from_root('tests', 'test_minmax.c')).read(), 'NAN != NAN\nSuccess!')
+ def test_locale(self):
+ if self.emcc_args is None: return self.skip('needs emcc')
+ self.do_run_from_file(path_from_root('tests', 'test_locale.c'), path_from_root('tests', 'test_locale.out'))
+
# Generate tests for everything
def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0,
typed_arrays=0, emcc_args=None, env=None):
diff --git a/tests/test_locale.c b/tests/test_locale.c
new file mode 100644
index 00000000..4aba30db
--- /dev/null
+++ b/tests/test_locale.c
@@ -0,0 +1,24 @@
+#include <locale.h>
+#include <stdio.h>
+
+int main()
+{
+ // Test basic functions from classic locale.
+ struct lconv* locale = localeconv();
+
+ printf("Testing locale information.\n");
+ printf("Decimal point: %s\n", locale->decimal_point);
+ printf("Thousands separator: %s\n", locale->thousands_sep);
+ printf("Grouping: %s\n", locale->grouping);
+ printf("International currency symbol: %s\n", locale->int_curr_symbol);
+ printf("Currency symbol: %s\n", locale->currency_symbol);
+ printf("Money decimal point: %s\n", locale->mon_decimal_point);
+ printf("Money thousands separator: %s\n", locale->mon_thousands_sep);
+ printf("Money Grouping: %s\n", locale->mon_grouping);
+ printf("Positive sign: %s\n", locale->positive_sign);
+ printf("Negative sign: %s\n", locale->negative_sign);
+
+ // If no runtime errors, assume the test passed.
+ printf("Locale tests passed.\n");
+ return 0;
+}
diff --git a/tests/test_locale.out b/tests/test_locale.out
new file mode 100644
index 00000000..7e8740fb
--- /dev/null
+++ b/tests/test_locale.out
@@ -0,0 +1,12 @@
+Testing locale information.
+Decimal point: .
+Thousands separator:
+Grouping:
+International currency symbol:
+Currency symbol:
+Money decimal point:
+Money thousands separator:
+Money Grouping:
+Positive sign:
+Negative sign:
+Locale tests passed.