On 06/21/16 11:54, Iván Matellanes wrote:
+ struct ostream_print_test { + enum { CHAR } type; + union { + char c; + } param; + ios_io_state state; + ios_flags flags; + int precision; + int fill; + int width; + const char *expected_text; + ios_io_state expected_flags; + } tests[] = { + /* char */ + {CHAR, {.c = 'a'}, IOSTATE_badbit, 0, 6, ' ', 0, "", IOSTATE_badbit|IOSTATE_failbit}, + {CHAR, {.c = 'a'}, IOSTATE_eofbit, 0, 6, ' ', 0, "", IOSTATE_eofbit|IOSTATE_failbit}, + {CHAR, {.c = 'a'}, IOSTATE_goodbit, 0, 6, ' ', 0, "a", IOSTATE_goodbit}, + {CHAR, {.c = 'a'}, IOSTATE_goodbit, 0, 6, ' ', 4, " a", IOSTATE_goodbit}, + {CHAR, {.c = 'a'}, IOSTATE_goodbit, 0, 6, 'x', 3, "xxa", IOSTATE_goodbit}, + {CHAR, {.c = 'a'}, IOSTATE_goodbit, FLAGS_left, 6, ' ', 4, "a ", IOSTATE_goodbit}, + {CHAR, {.c = 'a'}, IOSTATE_goodbit, FLAGS_left|FLAGS_internal, 6, ' ', 4, " a", IOSTATE_goodbit}, + {CHAR, {.c = 'a'}, IOSTATE_goodbit, FLAGS_internal|FLAGS_hex|FLAGS_showbase, 6, ' ', 4, " a", IOSTATE_goodbit}, + {CHAR, {.c = '9'}, IOSTATE_goodbit, FLAGS_oct|FLAGS_showbase|FLAGS_uppercase, 6, 'i', 2, "i9", IOSTATE_goodbit}, + {CHAR, {.c = '9'}, IOSTATE_goodbit, FLAGS_showpos|FLAGS_scientific, 0, 'i', 2, "i9", IOSTATE_goodbit}, + {CHAR, {.c = 'e'}, IOSTATE_goodbit, FLAGS_left|FLAGS_right|FLAGS_uppercase, 0, '*', 8, "e*******", IOSTATE_goodbit} + }; This is not portable (the {.c = 'a'} part).
Thanks, Piotr