- struct status_t status;
- int rc;
- int tmp;
- char * buffer = malloc( 50 );
- status.s = malloc( 50 );
- puts( "- Signed min / max -\n" );
- TESTCASE( E_char, SIZE_MAX, 0, 0, CHAR_MIN, 10, "%hhd" );
- TESTCASE( E_char, SIZE_MAX, 0, 0, CHAR_MAX, 10, "%hhd" );
- TESTCASE( E_char, SIZE_MAX, 0, 0, 0, 10, "%hhd" );
- TESTCASE( E_short, SIZE_MAX, 0, 0, SHRT_MIN, 10, "%hd" );
- TESTCASE( E_short, SIZE_MAX, 0, 0, SHRT_MAX, 10, "%hd" );
- TESTCASE( E_short, SIZE_MAX, 0, 0, 0, 10, "%hd" );
- TESTCASE( E_done, SIZE_MAX, 0, 0, INT_MIN, 10, "%d" );
- TESTCASE( E_done, SIZE_MAX, 0, 0, INT_MAX, 10, "%d" );
- TESTCASE( E_done, SIZE_MAX, 0, 0, 0, 10, "%d" );
- TESTCASE( E_long, SIZE_MAX, 0, 0, LONG_MIN, 10, "%ld" );
- TESTCASE( E_long, SIZE_MAX, 0, 0, LONG_MAX, 10, "%ld" );
- TESTCASE( E_long, SIZE_MAX, 0, 0, 0l, 10, "%ld" );
- TESTCASE( E_llong, SIZE_MAX, 0, 0, LLONG_MIN, 10, "%lld" );
- TESTCASE( E_llong, SIZE_MAX, 0, 0, LLONG_MAX, 10, "%lld" );
- TESTCASE( E_llong, SIZE_MAX, 0, 0, 0ll, 10, "%lld" );
- puts( "- Unsigned min / max -\n" );
- UTESTCASE( E_char, SIZE_MAX, 0, 0, UCHAR_MAX, 10, "%hhu" );
- UTESTCASE( E_char, SIZE_MAX, 0, 0, (unsigned char)-1, 10, "%hhu" );
- UTESTCASE( E_short, SIZE_MAX, 0, 0, USHRT_MAX, 10, "%hu" );
- UTESTCASE( E_short, SIZE_MAX, 0, 0, (unsigned short)-1, 10, "%hu" );
- UTESTCASE( E_done, SIZE_MAX, 0, 0, UINT_MAX, 10, "%u" );
- UTESTCASE( E_done, SIZE_MAX, 0, 0, -1u, 10, "%u" );
- UTESTCASE( E_long, SIZE_MAX, 0, 0, ULONG_MAX, 10, "%lu" );
- UTESTCASE( E_long, SIZE_MAX, 0, 0, -1ul, 10, "%lu" );
- UTESTCASE( E_llong, SIZE_MAX, 0, 0, ULLONG_MAX, 10, "%llu" );
- UTESTCASE( E_llong, SIZE_MAX, 0, 0, -1ull, 10, "%llu" );
- puts( "- Hex and Octal, normal and alternative, upper and lowercase -\n" );
- UTESTCASE( E_done, SIZE_MAX, 0, 0, UINT_MAX, 16, "%X" );
- UTESTCASE( E_alt, SIZE_MAX, 0, 0, -1u, 16, "%#X" );
- UTESTCASE( E_done | E_lower, SIZE_MAX, 0, 0, UINT_MAX, 16, "%x" );
- UTESTCASE( E_alt | E_lower, SIZE_MAX, 0, 0, -1u, 16, "%#x" );
- UTESTCASE( E_done, SIZE_MAX, 0, 0, UINT_MAX, 8, "%o" );
- UTESTCASE( E_alt, SIZE_MAX, 0, 0, -1u, 8, "%#o" );
- puts( "- Plus flag -\n" );
- TESTCASE( E_plus, SIZE_MAX, 0, 0, INT_MIN, 10, "%+d" );
- TESTCASE( E_plus, SIZE_MAX, 0, 0, INT_MAX, 10, "%+d" );
- TESTCASE( E_plus, SIZE_MAX, 0, 0, 0, 10, "%+d" );
- UTESTCASE( E_plus, SIZE_MAX, 0, 0, UINT_MAX, 10, "%+u" );
- UTESTCASE( E_plus, SIZE_MAX, 0, 0, -1u, 10, "%+u" );
- puts( "- Space flag -\n" );
- TESTCASE( E_space, SIZE_MAX, 0, 0, INT_MIN, 10, "% d" );
- TESTCASE( E_space, SIZE_MAX, 0, 0, INT_MAX, 10, "% d" );
- TESTCASE( E_space, SIZE_MAX, 0, 0, 0, 10, "% d" );
- UTESTCASE( E_space, SIZE_MAX, 0, 0, UINT_MAX, 10, "% u" );
- UTESTCASE( E_space, SIZE_MAX, 0, 0, -1u, 10, "% u" );
- puts( "- Field width -\n" );
- TESTCASE( E_done, SIZE_MAX, 9, 0, INT_MIN, 10, "%9d" );
- TESTCASE( E_done, SIZE_MAX, 9, 0, INT_MAX, 10, "%9d" );
- TESTCASE( E_done, SIZE_MAX, 10, 0, INT_MIN, 10, "%10d" );
- TESTCASE( E_done, SIZE_MAX, 10, 0, INT_MAX, 10, "%10d" );
- TESTCASE( E_done, SIZE_MAX, 11, 0, INT_MIN, 10, "%11d" );
- TESTCASE( E_done, SIZE_MAX, 11, 0, INT_MAX, 10, "%11d" );
- TESTCASE( E_done, SIZE_MAX, 12, 0, INT_MIN, 10, "%12d" );
- TESTCASE( E_done, SIZE_MAX, 12, 0, INT_MAX, 10, "%12d" );
- puts( "- Field width (left bound) -\n" );
- TESTCASE( E_minus, SIZE_MAX, 9, 0, INT_MIN, 10, "%-9d" );
- TESTCASE( E_minus, SIZE_MAX, 9, 0, INT_MAX, 10, "%-9d" );
- TESTCASE( E_minus, SIZE_MAX, 10, 0, INT_MIN, 10, "%-10d" );
- TESTCASE( E_minus, SIZE_MAX, 10, 0, INT_MAX, 10, "%-10d" );
- TESTCASE( E_minus, SIZE_MAX, 11, 0, INT_MIN, 10, "%-11d" );
- TESTCASE( E_minus, SIZE_MAX, 11, 0, INT_MAX, 10, "%-11d" );
- TESTCASE( E_minus, SIZE_MAX, 12, 0, INT_MIN, 10, "%-12d" );
- TESTCASE( E_minus, SIZE_MAX, 12, 0, INT_MAX, 10, "%-12d" );
- puts( "- Field width, zero padding -\n");
- TESTCASE( E_done | E_zero, SIZE_MAX, 9, 0, INT_MIN, 10, "%09d" );
- TESTCASE( E_done | E_zero, SIZE_MAX, 9, 0, INT_MAX, 10, "%09d" );
- TESTCASE( E_done | E_zero, SIZE_MAX, 10, 0, INT_MIN, 10, "%010d" );
- TESTCASE( E_done | E_zero, SIZE_MAX, 10, 0, INT_MAX, 10, "%010d" );
- TESTCASE( E_done | E_zero, SIZE_MAX, 11, 0, INT_MIN, 10, "%011d" );
- TESTCASE( E_done | E_zero, SIZE_MAX, 11, 0, INT_MAX, 10, "%011d" );
- TESTCASE( E_done | E_zero, SIZE_MAX, 12, 0, INT_MIN, 10, "%012d" );
- TESTCASE( E_done | E_zero, SIZE_MAX, 12, 0, INT_MAX, 10, "%012d" );
- puts( "- Field width, zero padding (left bound) -\n" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 9, 0, INT_MIN, 10, "%-09d" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 9, 0, INT_MAX, 10, "%-09d" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 10, 0, INT_MIN, 10, "%-010d" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 10, 0, INT_MAX, 10, "%-010d" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 11, 0, INT_MIN, 10, "%-011d" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 11, 0, INT_MAX, 10, "%-011d" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 12, 0, INT_MIN, 10, "%-012d" );
- TESTCASE( E_minus | E_zero, SIZE_MAX, 12, 0, INT_MAX, 10, "%-012d" );
- return 0;