19 check_sscanf (const char *s
, const char *format
, const float n
)
23 if (sscanf (s
, format
, &f
) != 1)
25 printf ("nothing found for \"%s\"\n", s
);
30 printf ("got %f expected %f from \"%s\"\n", f
, n
, s
);
39 if (setlocale (LC_ALL
, "fa_IR.UTF-8") == NULL
)
41 puts ("cannot set fa_IR locale");
45 int r
= check_sscanf (P3 PD P1 P4
, "%I8f", 3.14);
46 r
|= check_sscanf (P3 PT P1 P4 P5
, "%I'f", 3145);
47 r
|= check_sscanf (P3 PD P1 P4 P1 P5 P9
, "%If", 3.14159);
48 r
|= check_sscanf ("-" P3 PD P1 P4 P1 P5
, "%If", -3.1415);
49 r
|= check_sscanf ("+" PD P1 P4 P1 P5
, "%If", +.1415);
50 r
|= check_sscanf (P3 PD P1 P4 P1 P5
"e+" P2
, "%Ie", 3.1415e+2);
55 #define TEST_FUNCTION do_test ()
56 #include "../test-skeleton.c"