1
/* Argument 'width' test.
2
$Id: dtostrf-width.c,v 1.1 2007/02/06 12:36:58 dmix Exp $
8
#define PATTERN_SIZE 20
11
PROGMEM static const struct dtostrf_s t[] = {
13
{ { .fl = .123 }, 0, 3, "0.123" },
14
{ { .fl = .123 }, 1, 3, "0.123" },
15
{ { .fl = .123 }, 5, 3, "0.123" },
16
{ { .fl = .123 }, 6, 3, " 0.123" },
17
{ { .fl = .123 }, 10, 3, " 0.123" },
18
{ { .fl = -.123 }, 10, 3, " -0.123" },
20
{ { .fl = 123.45 }, 0, 2, "123.45" },
21
{ { .fl = 123.45 }, 1, 2, "123.45" },
22
{ { .fl = 123.45 }, 6, 2, "123.45" },
23
{ { .fl = 123.45 }, 7, 2, " 123.45" },
24
{ { .fl = 123.45 }, 10, 2, " 123.45" },
25
{ { .fl = -123.45 }, 10, 2, " -123.45" },
27
{ { .fl = 10. }, 0, 0, "10" },
28
{ { .fl = 10. }, 1, 0, "10" },
29
{ { .fl = 10. }, 2, 0, "10" },
30
{ { .fl = 10. }, 3, 0, " 10" },
31
{ { .fl = 10. }, 10, 0, " 10" },
32
{ { .fl = -10. }, 10, 0, " -10" },
34
{ { .fl = .123 }, -1, 3, "0.123" },
35
{ { .fl = 123.45 }, -1, 2, "123.45" },
36
{ { .fl = 10. }, -1, 0, "10" },
38
{ { .fl = .123 }, -10, 3, "0.123 " },
39
{ { .fl = -.123 }, -10, 3, "-0.123 " },
40
{ { .fl = 123.45 }, -10, 2, "123.45 " },
41
{ { .fl = -123.45 }, -10, 2,"-123.45 " },
42
{ { .fl = 10. }, -10, 0, "10 " },
43
{ { .fl = -10. }, -10, 0, "-10 " },
49
for (i= 0; (size_t)i != sizeof(t)/sizeof(t[0]); i++)
50
run_dtostrf (t+i, i+1);