123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- FTYPE FSUF;
- CONCAT (__VA_ARGS__, LSUF),
- struct test_input
- {
- STRUCT_FOREACH_FLOAT_FTYPE
- };
- struct test {
- const char *s;
- const char *fmt;
- int size;
- int rc;
- struct test_input t;
- };
- { \
- s, fmt, size, rc, { GEN_TEST_STRTOD_FOREACH (ENTRY, val) } \
- }
- struct htests
- {
- const char *fmt;
- const char *exp[4];
- struct test_input t;
- };
- { \
- fmt, exp1, exp2, exp3, exp4, { GEN_TEST_STRTOD_FOREACH (ENTRY, val) } \
- }
- static int \
- test_
- { \
- char buf[50], sbuf[5]; \
- int status = 0; \
- int i, rc = 0, rc1 = 0; \
- for (i = 0; i < sizeof (stest) / sizeof (stest[0]); i++) \
- { \
- rc = FTOSTR (sbuf, stest[i].size, stest[i].fmt, stest[i].t.FSUF); \
- rc1 = (strcmp (sbuf, stest[i].s) != 0) || (rc != stest[i].rc); \
- if (rc1) \
- { \
- printf (
- sbuf, rc, stest[i].s, stest[i].rc); \
- status++; \
- } \
- } \
- for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) \
- { \
- rc = FTOSTR (buf, tests[i].size, tests[i].fmt, tests[i].t.FSUF); \
- rc1 = (strcmp (buf, tests[i].s) != 0) || (rc != tests[i].rc); \
- if (rc1) \
- { \
- printf (
- buf, rc, tests[i].s, tests[i].rc); \
- status++; \
- } \
- } \
- for (i = 0; i < sizeof (htest) / sizeof (htest[0]); i++) \
- { \
- rc = FTOSTR (buf, 50, htest[i].fmt, htest[i].t.FSUF); \
- if (strcmp (buf, htest[i].exp[0]) == 0 || \
- strcmp (buf, htest[i].exp[1]) == 0 || \
- strcmp (buf, htest[i].exp[2]) == 0 || \
- strcmp (buf, htest[i].exp[3]) == 0) \
- continue; \
- else \
- { \
- printf (
- "or %s\n", buf, rc, htest[i].exp[0], htest[i].exp[1], \
- htest[i].exp[2], htest[i].exp[3]); \
- status++; \
- } \
- } \
- return status; \
- }
|