scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0036-localeconv.c (1085B)


      1 #include <assert.h>
      2 #include <limits.h>
      3 #include <locale.h>
      4 #include <stdio.h>
      5 
      6 /*
      7 output:
      8 testing
      9 done
     10 end:
     11 */
     12 
     13 int
     14 main()
     15 {
     16 	struct lconv *lc;
     17 
     18 	puts("testing");
     19 	assert(setlocale(LC_ALL, "C"));
     20 	assert((lc = localeconv()) != NULL);
     21 	assert(!strcmp(lc->decimal_point, "."));
     22 	assert(!strcmp(lc->thousands_sep, ""));
     23 	assert(!strcmp(lc->grouping, ""));
     24 	assert(!strcmp(lc->int_curr_symbol, ""));
     25 	assert(!strcmp(lc->currency_symbol, ""));
     26 	assert(!strcmp(lc->mon_decimal_point, ""));
     27 	assert(!strcmp(lc->mon_thousands_sep, ""));
     28 	assert(!strcmp(lc->mon_grouping, ""));
     29 	assert(!strcmp(lc->positive_sign, ""));
     30 	assert(!strcmp(lc->negative_sign, ""));
     31 	assert(!strcmp(lc->currency_symbol, ""));
     32 	assert(!strcmp(lc->int_curr_symbol, ""));
     33 	assert(lc->int_frac_digits == CHAR_MAX);
     34 	assert(lc->frac_digits == CHAR_MAX);
     35 	assert(lc->p_cs_precedes == CHAR_MAX);
     36 	assert(lc->n_cs_precedes == CHAR_MAX);
     37 	assert(lc->p_sep_by_space == CHAR_MAX);
     38 	assert(lc->n_sep_by_space == CHAR_MAX);
     39 	assert(lc->p_sign_posn == CHAR_MAX);
     40 	assert(lc->n_sign_posn == CHAR_MAX);
     41 	puts("done");
     42 
     43 	return 0;
     44 }