locale.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <locale.h>
  2. #include <limits.h>
  3. #include "test.h"
  4. void test_locale_h(void)
  5. {
  6. struct lconv *lc;
  7. int locale_categories[] = {
  8. LC_ALL,
  9. LC_COLLATE,
  10. LC_CTYPE,
  11. LC_MONETARY,
  12. LC_NUMERIC,
  13. };
  14. testing_header("locale.h");
  15. test_distinct(locale_categories);
  16. /* TODO: test setlocale() */
  17. testing_comment("testing results of localeconv()");
  18. lc = localeconv();
  19. test_string(lc->decimal_point, ".");
  20. test_string(lc->thousands_sep, "");
  21. test_string(lc->grouping, "");
  22. test_string(lc->int_curr_symbol, "");
  23. test_string(lc->currency_symbol, "");
  24. test_string(lc->mon_decimal_point, "");
  25. test_string(lc->mon_thousands_sep, "");
  26. test_string(lc->positive_sign, "");
  27. test_string(lc->negative_sign, "");
  28. test_int_equals(lc->frac_digits, CHAR_MAX);
  29. test_int_equals(lc->p_cs_precedes, CHAR_MAX);
  30. test_int_equals(lc->p_sep_by_space, CHAR_MAX);
  31. test_int_equals(lc->n_cs_precedes, CHAR_MAX);
  32. test_int_equals(lc->n_sep_by_space, CHAR_MAX);
  33. test_int_equals(lc->p_sign_posn, CHAR_MAX);
  34. test_int_equals(lc->n_sign_posn, CHAR_MAX);
  35. testing_end();
  36. }