[m-rev.] for review: test cases and expected output for the new string__format.

p.incani paulai at ugrad.unimelb.edu.au
Fri Feb 1 11:15:44 AEDT 2002


Estimated hours taken: 20

The following files test all conversion specifiers of string__format.

tests/general/string_format_test_complete.m
	Complete test script for string__format, testing all conversion
	specifiers with over 400 test cases.

tests/general/string_format_test_complete.exp
	Expected output for above test cases.


string_format_test_complete.m
=============================
:- module string_format_test_complete.
:- interface.
:- import_module io.

:- pred main(io__state, io__state).
:- mode main(di, uo) is det.

:- implementation.
:- import_module integer, list, char, string, bool, std_util, int, float, require.

%----------------------------- TESTING STUFF --------------------------------%

	%
	% function aids in writing test cases.
	%
:- pred test(int, string, list(string__poly_type), io__state, io__state).
:- mode test(in, in, in, di, uo) is det.
test(TestNum, Format, PolyList) -->
	io__write_int(TestNum),
	io__write_string(" ]"),
	{string__format(Format, PolyList, StringOld)},
	io__write_string(StringOld),
	io__write_string("["),
	io__nl.


%----------------------------------------------------------------------------%

main -->
		%
		% TESTING %d AND %i
		%
	io__write_string("TESTING %d AND %i\n"),
	test(1, "%d", [i(5)]),
	test(2, "%.6d", [i(123)]),
	test(3, "%.3d", [i(1234)]),
	test(4, "%06d", [i(12)]),
	test(5, "%-06d", [i(34)]),
	test(6, "%06.8d", [i(123)]),
	test(7, "%-04d", [i(23)]),
	test(8, "%8.3d", [i(5)]),
	test(9, "%-06.5d", [i(93)]),
	test(10, "%1.4d", [i(5)]),
	test(11, "%.6d", [i(-63)]),
	test(12, "%#08.5d", [i(232)]),
	test(13, "%-+08.5d", [i(-234)]),
	test(14, "%- 08.5d", [i(234)]),
	test(15, "%08.5d", [i(24)]),
	test(16, "%08.5d", [i(-34)]),
	test(17, "%-08.5d", [i(24)]),
	test(18, "%-08.5d", [i(23)]),
	test(19, "%.4d", [i(122323)]),
	test(20, "%+6d", [i(123)]),
	test(21, "%+06d", [i(123)]),
	test(22, "%+.6d", [i(123)]),
	test(23, "%-5i", [i(123)]),
	test(24, "%%%5.1dHello", [i(5)]),
	test(25, "%.0d", [i(0)]),
	test(26, "%.0d", [i(4)]),
	test(27, "%3.0d", [i(23)]),
	test(28, "%.4d", [i(0)]),
	test(29, "%56.4d", [i(0)]),
	test(30, "%23.5d", [i(0)]),
	test(31, "%5d", [i(0)]),
	test(32, "%4.3d", [i(0)]),
	test(33, "%04.5d", [i(-123443)]),
	test(34, "%-06.3d", [i(23)]),
	test(36, "% +4d", [i(23)]),
	test(37, "%d", [i(-2147483648)]),		%ask about this test case.
	test(38, "%0100d", [i(-2147483648)]),
	test(39, "%d", [i(123812381238719237912837912873)]),
	test(40, "%d", [i(-1234234234324)]),
	test(41, "%-50d", [i(132123343434343234234)]),
	test(42, "%2.4d", [i(-212134234234234234234232342342342342342342342342342343)]),
	test(43, "%0100d", [i(12398798798791729837987989879798)]),
	test(44, "%*.*d", [i(100), i(0), i(0)]),
	test(45, "%d", [i(int__max_int)]),
	test(46, "%d", [i(int__min_int)]),
	test(45, "%d", [i(int__max_int+1)]),
	test(46, "%d", [i(int__min_int-1)]),
		%
		% TESTING %o
		%
	io__write_string("TESTING %o\n"),
 	test(1, "%o", [i(123)]),
	test(2, "%o", [i(-123)]),
	test(3, "%0.5o", [i(64)]),
	test(4, "%#o", [i(34)]),
	test(5, "%15o", [i(int__max_int)]),
	test(6, "%-#o", [i(34)]),
	test(7, "%.0o", [i(0)]),
	test(8, "%#0.0o", [i(0)]),
	test(9, "%#012o", [i(23)]),
	test(10, "%0100.34o", [i(123)]),
	test(11, "%5.6o", [i(99)]),
		%
		% TESTING %x AND %X
		%
	io__write_string("TESTING %x AND %X\n"),
	test(1, "%x", [i(123)]),
	test(2, "%X", [i(-123)]),
	test(3, "%0.5x", [i(64)]),
	test(4, "%#2x", [i(34)]),
	test(5, "%#20.2X", [i(-34)]),
	test(6, "%#x", [i(0)]),
	test(7, "%#.0x", [i(0)]),
	test(8, "% 14.34x", [i(int__max_int)]),
	test(9, "%05X", [i(16)]),
	test(10, "%.0x", [i(0)]),
	test(11, "%#1x", [i(16)]),
	test(12, "% X", [i(256)]),
	test(13, "%-0x", [i(int__min_int)]),
	test(14, "%014.2x", [i(123)]),
	test(15, "%014.56X", [i(int__max_int)]),
	test(16, "%#14.56x", [i(int__max_int)]),
	test(17, "%#-X", [i(1324)]),
	test(18, "%#010x", [i(234)]),
	test(19, "%#01x", [i(234)]),
	test(20, "%#1x", [i(939434)]),
	test(21, "%#+023x", [i(-23)]),
		%
		% TESTING %u
		%
	io__write_string("TESTING %u\n"),
	test(1, "%u", [i(4)]),
        test(2, "%u", [i(-6)]),
        test(3, "%u", [i(-2147483648)]),
        test(4, "%.0u", [i(0)]),
        test(5, "%10u", [i(-23)]),
        test(6, "%12.23u", [i(-1)]),
        test(7, "%+10u", [i(-4)]),
        test(8, "%+010u", [i(4)]),
        test(9, "%-#010u", [i(-5)]),
        test(10, "% u", [i(-43433434343434434343434)]),
	test(11, "%.0u", [i(0)]),
	test(12, "%100.14u", [i(-13)]),
	test(13, "%-030u", [i(232323232323)]),
	test(14, "%#1u", [i(23232332)]),
	test(15, "%+.23u", [i(-23409283408234)]),
	test(16, "%012.5u", [i(1223442)]),
	test(17, "%015u", [i(122)]),
	test(18, "%-+0#.13u%%", [i(-123233434)]),
	test(19, "% 13u", [i(23)]),
	test(20, "%05.4u", [i(1229)]),
	test(21, "%+12.5u", [i(-12)]),
		%
		% TESTING %f
		%
	io__write_string("TESTING %f\n"),
	test(1, "%f", [f(12.1232)]),
	test(2, "%f", [f(3.23)]),
	test(3, "%+f",[f(34.3)]),
	test(4, "%+10f", [f(34.3)]),
	test(5, "%+9f", [f(34.3)]),
	test(6, "%+11f", [f(34.3)]),
	test(7, "% 11f", [f(33453453453453454.3)]),
	test(8, "%.12f", [f(3454545454545454545452.23)]),
	test(9, "%100.12f", [f(23.233)]),
	test(10, "%#f", [f(3.14)]),
	test(11, "%.0f", [f(3.00)]),
	test(12, "%#.0f", [f(3.00)]),
	test(13, "%15.34f", [f(23.244)]),
	test(14, "%20.50f", [f(24.233)]), % behaviour undefined.
	test(15, "%.50f", [f(24.233)]),
	test(16, "%.0f", [f(1.32)]),
	test(17, "%#.0f", [f(1.32)]),
	test(18, "%.0f", [f(0.0)]),
	test(19, "%0+10f", [f(1.0)]),
	test(20, "%0 10f", [f(1.0)]),
	test(21, "%013.3f", [f(1.1234)]),
	test(22, "%014.0f", [f(123.2)]),
	test(23, "%-20.3f", [f(-1.3333)]),
	test(24, "%#015.0f", [f(-12.99999999999999)]),
	test(26, "%.0f", [f(-1.999999999999)]),
	test(27, "%5.4f", [f(-1232132.99999999999)]),
	test(28, "% 023.1f", [f(1231.499)]),
	test(29, "%.3f", [f(12.233)]),
	test(30, "%.4f", [f(1.1232333)]),
	test(31, "%.4f", [f(12.2934)]),
	test(32, "%f", [f(12.2923)]),
	test(33, "%.3f", [f(121222.122)]),
	test(34, "%.9f", [f(121222.122)]),
	test(35, "%.10f", [f(121222.122)]),
	test(36, "%.6f", [f(121222.122)]),
	test(37, "%.6f", [f(12.23345)]),
	test(38, "%f", [f(1.999999999)]),
	test(39, "%f", [f(12.2334999)]),
	test(40, "%.6f", [f(12.2334999)]),
	test(41, "%.6f", [f(12.23345)]),
	test(42, "%.6f", [f(12.233455)]),
	test(43, "%.6f", [f(12.23349)]),
	test(44, "%f", [f(1999.499)]),
	test(45, "%.6f", [f(1999.499)]),
	test(46, "%.6f", [f(12.23446)]),
	test(47, "%.7f", [f(12.2000000)]),
	test(48, "%.4f", [f(121212.2323)]),
	test(49, "%.5f", [f(1234.99)]),
	test(50, "%#.5f", [f(1234.99)]),
	test(51, "%#.4f", [f(1234.99)]),
	test(52, "%#.4f", [f(1234.5)]),
	test(53, "%#.4f", [f(1234.6)]),
	test(54, "%.4f", [f(121212.2323)]),
	test(55, "%+.4f", [f(121212.2323)]),
	test(56, "%.4f", [f(0.000012345)]),  %bugged!!
	test(57, "%.4f", [f(0.00012345)]),
	test(58, "%.1f", [f(0.01234)]),
	test(59, "%.0f", [f(0.01234)]),
	test(60, "%.2f", [f(0.00123)]),
	test(61, "%.1f", [f(0.000123)]),
	test(62, "%.4f", [f(0.000123)]),
	test(63, "%.2f", [f(0.000123)]),
	test(64, "%.6f", [f(0.000123)]),
	test(65, "%.3f", [f(0.000002343)]),  %bugged!!
	test(66, "%.4f", [f(0.001234)]),
	test(67, "%.5f", [f(0.001234)]),
	test(68, "%.5f", [f(0.0012345)]),
	test(69, "%.6f", [f(0.001323323232323)]),
	test(70, "%.3f", [f(0.001234343)]),
	test(71, "%.5f", [f(0.001234343)]),
	test(72, "%.4f", [f(0.000012345)]),   %bugged!!
	test(73, "%.5f", [f(0.000012345)]),   %bugged!!
	test(74, "%.3f", [f(0.000012345)]),   %bugged!!
	test(75, "%.4f", [f(0.0000123543)]),
	test(76, "%.7f", [f(0.001323323232323)]),
	test(77, "%.2f", [f(0.001323323232323)]),
	test(78, "%.4f", [f(0.000023234)]),   %bugged!!
	test(79, "%.2f", [f(0.001212)]),
	test(80, "%.3f", [f(0.000877)]),
	test(81, "%f", [f(0.0002322323)]),
	test(82, "%f", [f(0.00001213)]),      %bugged!!
	test(83, "%f", [f(0.00012323232323)]),
	test(84, "%.0f", [f(0.00001213)]),
	test(85, "%f", [f(0.0003489)]),
	test(86, "%f", [f(0.00003213)]),
	test(87, "%f", [f(1231239123791827391827398172398712987391283.123123123123123123123123123123123123)]),
	test(88, "%f", [f(123123123.123987293729873928379283798273)]),
	test(89, "%f", [f(23293898989893434343434.343434344)]),
	test(90, "%f", [f(0.00000000000000000121233)]),
	test(91, "%.30f", [f(0.0000000000000000000002342344444444444444444444444444444443434343)]),
	test(92, "%10.100f", [f(12122.113133131313131343409809)]),
	test(93, "%0+100.34f", [f(123123.23232323232323232323232323298329)]),
	test(94, "%.23f", [f(123234.2332234343444440909809809098098089009098978787868655434)]),
	test(95, "%10.3f", [f(132.123123232323)]),
	test(96, "%.0f", [f(0.0)]),
	test(97, "%.0f", [f(34.3434)]),
	test(98, "%.0f", [f(1.2323)]),
		%
		% TESTING %F
		%
	test(1, "%F", [f(12.1232)]),
	test(2, "%F", [f(3.23)]),
	test(3, "%+F",[f(34.3)]),
	test(4, "%+10F", [f(34.3)]),
	test(5, "%+9F", [f(34.3)]),
	test(6, "%+11F", [f(34.3)]),
	test(7, "% 11F", [f(34.3)]),
	test(8, "%.12F", [f(32.23)]),
	test(9, "%100.12F", [f(23.233)]),
	test(10, "%#F", [f(3.14)]),
	test(11, "%.0F", [f(3.00)]),
	test(12, "%#.0F", [f(3.00)]),
	test(13, "%15.34F", [f(23.244)]),
	test(14, "%20.50F", [f(24.233)]), % behaviour undefined.
	test(15, "%.50F", [f(24.233)]),
	test(16, "%.0F", [f(1.32)]),
	test(17, "%#.0F", [f(1.32)]),
	test(18, "%.0F", [f(0.0)]),
	test(19, "%0+10F", [f(1.0)]),
	test(20, "%0 10F", [f(1.0)]),
	test(21, "%013.3F", [f(1.1234)]),
	test(22, "%014.0F", [f(123.2)]),
	test(23, "%-20.3F", [f(-1.3333)]),
	test(24, "%#015.0F", [f(-12.99999999999999)]),
	test(26, "%.0F", [f(-1.999999999999)]),
	test(27, "%5.4F", [f(-1232132.99999999999)]),
	test(28, "% 023.1F", [f(1231.499)]),
	test(29, "%.3F", [f(12.233)]),
	test(30, "%.4F", [f(1.1232333)]),
	test(31, "%.4F", [f(12.2934)]),
	test(32, "%F", [f(12.2923)]),
	test(33, "%.3F", [f(121222.122)]),
	test(34, "%.9F", [f(121222.122)]),
	test(35, "%.10F", [f(121222.122)]),
	test(36, "%.6F", [f(121222.122)]),
	test(37, "%.6F", [f(12.23345)]),
	test(38, "%F", [f(1.999999999)]),
	test(39, "%F", [f(12.2334999)]),
	test(40, "%.6F", [f(12.2334999)]),
	test(41, "%.6F", [f(12.23345)]),
	test(42, "%.6F", [f(12.233455)]),
	test(43, "%.6F", [f(12.23349)]),
	test(44, "%F", [f(1999.499)]),
	test(45, "%.6F", [f(1999.499)]),
	test(46, "%.6F", [f(12.23446)]),
	test(47, "%.7F", [f(12.2000000)]),
	test(48, "%.4F", [f(121212.2323)]),
	test(49, "%.5F", [f(1234.99)]),
	test(50, "%#.5F", [f(1234.99)]),
	test(51, "%#.4F", [f(1234.99)]),
	test(52, "%#.4F", [f(1234.5)]),
	test(53, "%#.4F", [f(1234.6)]),
	test(54, "%.4F", [f(121212.2323)]),
	test(55, "%+.4F", [f(121212.2323)]),
	test(56, "%.4F", [f(0.000012345)]),
	test(57, "%.4F", [f(0.00012345)]),
	test(58, "%.1F", [f(0.01234)]),
	test(59, "%.0F", [f(0.01234)]),
	test(60, "%.2F", [f(0.00123)]),
	test(61, "%.1F", [f(0.000123)]),
	test(62, "%.4F", [f(0.000123)]),
	test(63, "%.2F", [f(0.000123)]),
	test(64, "%.6F", [f(0.000123)]),
	test(65, "%.3F", [f(0.000002343)]),
	test(66, "%.4F", [f(0.001234)]),
	test(67, "%.5F", [f(0.001234)]),
	test(68, "%.5F", [f(0.0012345)]),
	test(69, "%.6F", [f(0.001323323232323)]),
	test(70, "%.3F", [f(0.001234343)]),
	test(71, "%.5F", [f(0.001234343)]),
	test(72, "%.4F", [f(0.000012345)]),
	test(73, "%.5F", [f(0.000012345)]),
	test(74, "%.3F", [f(0.000012345)]),
	test(75, "%.4F", [f(0.0000123543)]),
	test(76, "%.7F", [f(0.001323323232323)]),
	test(77, "%.2F", [f(0.001323323232323)]),
	test(78, "%.4F", [f(0.000023234)]),
	test(79, "%.2F", [f(0.001212)]),
	test(80, "%.3F", [f(0.000877)]),
	test(81, "%F", [f(0.0002322323)]),
	test(82, "%F", [f(0.00001213)]),
	test(83, "%F", [f(0.00012323232323)]),
		%
		% TESTING %e AND %E
		%
	io__write_string("TESTING %e AND %E\n"),
	test(1, "%e", [f(0.00012)]),
	test(2, "%e", [f(0.0012)]),
	test(3, "%.3e", [f(0.0012)]),
	test(4, "%9e", [f(0.0012)]),
	test(5, "%9.3e", [f(0.0012)]),
	test(6, "%10.3e", [f(0.0012)]),
	test(7, "%15.3e", [f(0.0012)]),
	test(8, "%.0e", [f(0.00)]),
	test(9, "%10.7e", [f(12.2323)]),
	test(10, "%e", [f(2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222.2222222222222222)]),
	test(11, "%e", [f(0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004353434)]),
	test(12, "%e", [f(23.2323)]),
	test(13, "%e", [f(-12323.23238729879873947934793874938749374)]),
	test(14, "%e", [f(123.239999999)]),
	test(15, "%e", [f(-0.000000000000000000000000000000232323)]),
	test(16, "%.13e", [f(12.000002323200)]),
	test(17, "%#.0e", [f(12.2323)]),
	test(18, "%13.4e", [f(123.2323)]),
	test(19, "%100.10e", [f(10.10)]),
	test(20, "%0100.10e", [f(10.023)]),
	test(21, "%0e", [f(-34.34)]),
	test(22, "%13e", [f(-34.34)]),
	test(23, "%14e", [f(-34.34)]),
	test(24, "%15e", [f(-34.34)]),
	test(25, "%9.7e", [f(1.2)]),
	test(26, "%.100e", [f(1.45)]),
	test(27, "%.3e", [f(0.0)]),
	test(28, "%.5e", [f(0.00000000000000)]),
	test(29, "%015.15e", [f(23.23)]),
	test(30, "%e", [f(3333333333333.444444444444444444444444)]),
	test(31, "%.8e", [f(0.0000000000000000000000000000000000000000000000000000000000000023232322323)]),
	test(32, "%10.2e", [f(12.2)]),
	test(33, "%9.6e", [f(34.34)]),
	test(34, "%.0e", [f(34.23)]),
	test(35, "%4.0e", [f(23.232323)]),
	test(36, "%.0e", [f(0.0)]),
	test(37, "%#.0E", [f(0.0)]),
	test(38, "%020e", [f(1.23)]),
	test(39, "%- 15e", [f(4.34)]),
	test(40, "%40e", [f(2.232989877)]),
	test(41, "%12.5e", [f(3.34)]),
	test(42, "%#15.9e", [f(9.99999999999999)]),
	test(43, "%.34e", [f(23423423049802394802399999999999999999999999.9999999999999999999999)]),
	test(44, "%.100e", [f(0.000000000000000000000000000000000000000000000000000000002342342349994594594959)]),
	test(45, "%#e", [f(1.2)]),
		%
		% TESTING %g AND %G
		%
	io__write_string("TESTING %g and %G\n"),
	test(1, "%g", [f(0.00012)]),
	test(2, "%g", [f(0.0012)]),
	test(3, "%.3g", [f(0.0012)]),
	test(4, "%9g", [f(0.0012)]),
	test(5, "%9.3g", [f(0.0012)]),
	test(6, "%10.3g", [f(0.0012)]),
	test(7, "%15.3g", [f(0.0012)]),
	test(8, "%.0g", [f(0.00)]),
	test(9, "%10.7g", [f(12.2323)]),
	test(10, "%g", [f(2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222.2222222222222222)]),
	test(11, "%g", [f(0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004353434)]),
	test(12, "%g", [f(23.2323)]),
	test(13, "%g", [f(-12323.23238729879873947934793874938749374)]),
	test(14, "%g", [f(123.239999999)]),
	test(15, "%g", [f(-0.000000000000000000000000000000232323)]),
	test(16, "%.13g", [f(12.000002323200)]),
	test(17, "%#.0g", [f(12.2323)]),
	test(18, "%13.4g", [f(123.2323)]),
	test(19, "%100.10g", [f(10.10)]),
	test(20, "%0100.10g", [f(10.023)]),
	test(21, "%0g", [f(-34.34)]),
	test(22, "%13g", [f(-34.34)]),
	test(23, "%14g", [f(-34.34)]),
	test(24, "%15g", [f(-34.34)]),
	test(25, "%9.7g", [f(1.2)]),
	test(26, "%.100g", [f(1.45)]),
	test(27, "%.3g", [f(0.0)]),
	test(28, "%.5g", [f(0.00000000000000)]),
	test(29, "%015.15g", [f(23.23)]),
	test(30, "%g", [f(3333333333333.444444444444444444444444)]),
	test(31, "%.8g", [f(0.0000000000000000000000000000000000000000000000000000000000000023232322323)]),
	test(32, "%10.2g", [f(12.2)]),
	test(33, "%9.6g", [f(34.34)]),
	test(34, "%.0g", [f(34.23)]),
	test(35, "%4.0g", [f(23.232323)]),
	test(36, "%.0g", [f(0.0)]),
	test(37, "%#.0g", [f(0.0)]),
	test(38, "%020g", [f(1.23)]),
	test(39, "%- 15g", [f(4.34)]),
	test(40, "%40g", [f(2.232989877)]),
	test(41, "%12.5g", [f(3.34)]),
	test(42, "%#15.9g", [f(9.99999999999999)]),
	test(43, "%.34g", [f(23423423049802394802399999999999999999999999.9999999999999999999999)]),
	test(44, "%.100g", [f(0.000000000000000000000000000000000000000000000000000000002342342349994594594959)]),
	test(45, "%#20g", [f(23.23)]),
	test(46, "%20g", [f(23.23)]),
	test(47, "%.4g", [f(0.0000000000123434)]),
	test(48, "%.6g", [f(0.0000000000012)]),
	test(49, "%g", [f(13.00)]),
	test(50, "%g", [f(0.000000000000004)]),
	test(51, "%.7g", [f(0.000122234234)]),
	test(52, "%#g", [f(1.2)]),
	test(53, "%020g", [f(34.3)]),
	test(54, "% 020g", [f(123.34)]),
	test(55, "%.0g", [f(0.0)]),
	test(56, "%10.3g", [f(23.232399)]),
	test(57, "%#.0g", [f(9.99999999)]),
	test(58, "%100.13g", [f(123.34334)]),
		%
		% TESTING %c
		%
	io__write_string("TESTING %c\n"),
	test(1, "%c", [c(a)]),
	test(2, "%10c", [c(a)]),
	test(3, "%.5c", [c(a)]),
	test(4, "%-10c", [c(a)]),
	test(5, "%#-+14c", [c(b)]),
	test(6, "%010c", [c(x)]),
	test(7, "%    12.4c", [c(f)]),
	test(8, "%.0c", [c(a)]),
	test(9, "%0.0c", [c(z)]),
	test(10, "%%%c", [c('6')]),
		%
		% TESTING %s
		%
	io__write_string("TESTING %s\n"),
	test(1, "%s", [s("Hello Paul")]),
	test(2, "%100s", [s("Hello World!")]),
	test(3, "%.3s", [s("Hello Cosmos!")]),
	test(4, "%.0s", [s("greetings")]),
	test(5, "%0.0s", [s("nothing")]),
	test(5, "%-100s", [s("melbourne uni")]),
	test(6, "%030s", [s("yeh right buddy")]),
	test(7, "%100.2s", [s("onetwothreefour")]),
	test(8, "%1.100s", [s("hello")]),
	test(9, "%+34.3s", [s("1+13")]),
	test(10, "%-100s", [s("paul")]),
	test(11, "%.4s", [s("")]),
		%
		% TESTING %p
		%
	io__write_string("TESTING %p\n"),
	test(1, "%p", [i(100)]),
	test(2, "%100p", [i(32)]),
	test(3, "%-100p",  [i(223232323)]),
	test(4, "%100.2p", [i(223232323)]),
	test(5, "%0100p", [i(123923929389283982389239)]),
	test(6, "%p", [i(12)]),
	test(7, "%0100.34p", [i(1232998938434)]),
	test(8, "%010p", [i(3434)]),
	test(9, "%10p", [i(2323)]),
	test(10, "%12p", [i(23)]),
	test(11, "%p", [i(12323090293029309232873823)]),
	test(12, "%p", [i(-2398729387429387429384729839283)]).




string_format_test_complete.exp
===============================
TESTING %d AND %i
1 ]5[
2 ]000123[
3 ]1234[
4 ]000012[
5 ]34    [
6 ]00000123[
7 ]23  [
8 ]     005[
9 ]00093 [
10 ]0005[
11 ]-000063[
12 ]   00232[
13 ]-00234  [
14 ] 00234  [
15 ]   00024[
16 ]  -00034[
17 ]00024   [
18 ]00023   [
19 ]122323[
20 ]  +123[
21 ]+00123[
22 ]+000123[
23 ]123  [
24 ]%    5Hello[
25 ][
26 ]4[
27 ] 23[
28 ]0000[
29 ]                                                    0000[
30 ]                  00000[
31 ]    0[
32 ] 000[
33 ]-123443[
34 ]023   [
36 ] +23[
37 ]-2147483648[
38 ]-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002147483648[
39 ]1187674409[
40 ]-1578620372[
41 ]-2064139590                                       [
42 ]96733497[
43 ]0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001014299638[
44 ]                                                                                                    [
45 ]2147483647[
46 ]-2147483648[
45 ]-2147483648[
46 ]2147483647[
TESTING %o
1 ]173[
2 ]37777777605[
3 ]00100[
4 ]042[
5 ]    17777777777[
6 ]042[
7 ][
8 ]0[
9 ]000000000027[
10 ]                                                                  0000000000000000000000000000000173[
11 ]000143[
TESTING %x AND %X
1 ]7b[
2 ]FFFFFF85[
3 ]00040[
4 ]0x22[
5 ]          0XFFFFFFDE[
6 ]0[
7 ][
8 ]000000000000000000000000007fffffff[
9 ]00010[
10 ][
11 ]0x10[
12 ]100[
13 ]80000000[
14 ]            7b[
15 ]0000000000000000000000000000000000000000000000007FFFFFFF[
16 ]0x0000000000000000000000000000000000000000000000007fffffff[
17 ]0X52C[
18 ]0x000000ea[
19 ]0xea[
20 ]0xe55aa[
21 ]0x0000000000000ffffffe9[
TESTING %u
1 ]4[
2 ]4294967290[
3 ]2147483648[
4 ][
5 ]4294967273[
6 ]00000000000004294967295[
7 ]4294967292[
8 ]0000000004[
9 ]4294967291[
10 ]318803446[
11 ][
12 ]                                                                                      00004294967283[
13 ]394998339                     [
14 ]23232332[
15 ]00000000000002583322262[
16 ]     1223442[
17 ]000000000000122[
18 ]0004171733862%[
19 ]           23[
20 ] 1229[
21 ]  4294967284[
TESTING %f
1 ]12.123200[
2 ]3.230000[
3 ]+34.300000[
4 ]+34.300000[
5 ]+34.300000[
6 ] +34.300000[
7 ] 33453453453453500.000000[
8 ]3454545454545449779200.000000000000[
9 ]                                                                                     23.233000000000[
10 ]3.140000[
11 ]3[
12 ]3.[
13 ]23.2439999999999997726263245567679405[
14 ]24.23300000000000054001247917767614126205444335937500[
15 ]24.23300000000000054001247917767614126205444335937500[
16 ]1[
17 ]1.[
18 ]0[
19 ]+01.000000[
20 ] 01.000000[
21 ]000000001.123[
22 ]00000000000123[
23 ]-1.333              [
24 ]-0000000000013.[
26 ]-2[
27 ]-1232133.0000[
28 ] 00000000000000001231.5[
29 ]12.233[
30 ]1.1232[
31 ]12.2934[
32 ]12.292300[
33 ]121222.122[
34 ]121222.122000000[
35 ]121222.1220000000[
36 ]121222.122000[
37 ]12.233450[
38 ]2.000000[
39 ]12.233500[
40 ]12.233500[
41 ]12.233450[
42 ]12.233455[
43 ]12.233490[
44 ]1999.499000[
45 ]1999.499000[
46 ]12.234460[
47 ]12.2000000[
48 ]121212.2323[
49 ]1234.99000[
50 ]1234.99000[
51 ]1234.9900[
52 ]1234.5000[
53 ]1234.6000[
54 ]121212.2323[
55 ]+121212.2323[
56 ]0.0000[
57 ]0.0001[
58 ]0.0[
59 ]0[
60 ]0.00[
61 ]0.0[
62 ]0.0001[
63 ]0.00[
64 ]0.000123[
65 ]0.000[
66 ]0.0012[
67 ]0.00123[
68 ]0.00123[
69 ]0.001323[
70 ]0.001[
71 ]0.00123[
72 ]0.0000[
73 ]0.00001[
74 ]0.000[
75 ]0.0000[
76 ]0.0013233[
77 ]0.00[
78 ]0.0000[
79 ]0.00[
80 ]0.001[
81 ]0.000232[
82 ]0.000012[
83 ]0.000123[
84 ]0[
85 ]0.000349[
86 ]0.000032[
87 ]1231239123791830075145298109151456811548672.000000[
88 ]123123123.123987[
89 ]23293898989893398298624.000000[
90 ]0.000000[
91 ]0.000000000000000000000234234444[
92 ]12122.1131331313008558936417102813720703125000000000000000000000000000000000000000000000000000000000000000[
93 ]+0000000000000000000000000000000000000000000000000000000000123123.2323232320050010457634925842285156[
94 ]123234.23322343399922829121351[
95 ]   132.123[
96 ]0[
97 ]34[
98 ]1[
1 ]12.1232[
2 ]3.23[
3 ]+34.3[
4 ]     +34.3[
5 ]    +34.3[
6 ]      +34.3[
7 ]       34.3[
8 ]32.23[
9 ]                                                                                              23.233[
10 ]3.14000[
11 ]3[
12 ]3.[
13 ]23.24399999999999977262632455676794[
14 ]24.233000000000000540012479177676141262054443359375[
15 ]24.233000000000000540012479177676141262054443359375[
16 ]1[
17 ]1.[
18 ]0[
19 ]+000000001[
20 ] 000000001[
21 ]0000000001.12[
22 ]0000000001D+02[
23 ]-1.33               [
24 ]-000000001.D+01[
26 ]-2[
27 ]-1.232D+06[
28 ] 000000000000000001D+03[
29 ]12.2[
30 ]1.123[
31 ]12.29[
32 ]12.2923[
33 ]1.21D+05[
34 ]121222.122[
35 ]121222.122[
36 ]121222[
37 ]12.2334[
38 ]2[
39 ]12.2335[
40 ]12.2335[
41 ]12.2334[
42 ]12.2335[
43 ]12.2335[
44 ]1999.5[
45 ]1999.5[
46 ]12.2345[
47 ]12.2[
48 ]1.212D+05[
49 ]1235[
50 ]1235.0[
51 ]1235.[
52 ]1234.[
53 ]1235.[
54 ]1.212D+05[
55 ]+1.212D+05[
56 ]1.234D-05[
57 ]0.0001234[
58 ]0.01[
59 ]0.01[
60 ]0.0012[
61 ]0.0001[
62 ]0.000123[
63 ]0.00012[
64 ]0.000123[
65 ]2.34D-06[
66 ]0.001234[
67 ]0.001234[
68 ]0.0012345[
69 ]0.00132332[
70 ]0.00123[
71 ]0.0012343[
72 ]1.234D-05[
73 ]1.2345D-05[
74 ]1.23D-05[
75 ]1.235D-05[
76 ]0.001323323[
77 ]0.0013[
78 ]2.323D-05[
79 ]0.0012[
80 ]0.000877[
81 ]0.000232232[
82 ]1.213D-05[
83 ]0.000123232[
TESTING %e AND %E
1 ]1.200000e-04[
2 ]1.200000e-03[
3 ]1.200e-03[
4 ]1.200000e-03[
5 ]1.200e-03[
6 ] 1.200e-03[
7 ]      1.200e-03[
8 ]0e+00[
9 ]1.2232300e+01[
10 ]2.222222e+189[
11 ]4.353434e-203[
12 ]2.323230e+01[
13 ]-1.232323e+04[
14 ]1.232400e+02[
15 ]-2.323230e-31[
16 ]1.2000002323200e+01[
17 ]1.e+01[
18 ]   1.2323e+02[
19 ]                                                                                    1.0100000000e+01[
20 ]0000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0023000000e+01[
21 ]-3.434000e+01[
22 ]-3.434000e+01[
23 ] -3.434000e+01[
24 ]  -3.434000e+01[
25 ]1.2000000e+00[
26 ]1.4499999999999999555910790149937383830547332763671875000000000000000000000000000000000000000000000000e+00[
27 ]0.000e+00[
28 ]0.00000e+00[
29 ]2.323000000000000e+01[
30 ]3.333333e+12[
31 ]2.32323223e-63[
32 ]  1.22e+01[
33 ]3.434000e+01[
34 ]3e+01[
35 ]2e+01[
36 ]0e+00[
37 ]0.E+00[
38 ]000000001.230000e+00[
39 ] 4.340000e+00  [
40 ]                            2.232990e+00[
41 ] 3.34000e+00[
42 ]1.000000000e+01[
43 ]2.3423423049802402009439767930001807e+43[
44 ]2.3423423499945900921761360771830171562830033048219610361207652030508123994109640539239773487442506417e-57[
45 ]1.200000e+00[
TESTING %g and %G
1 ]0.00012[
2 ]0.0012[
3 ]0.0012[
4 ]   0.0012[
5 ]   0.0012[
6 ]    0.0012[
7 ]         0.0012[
8 ]0[
9 ]   12.2323[
10 ]2.22222e+189[
11 ]4.35343e-203[
12 ]23.2323[
13 ]-12323.2[
14 ]123.24[
15 ]-2.32323e-31[
16 ]12.0000023232[
17 ]1.e+01[
18 ]        123.2[
19 ]                                                                                                10.1[
20 ]000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010.023[
21 ]-34.34[
22 ]       -34.34[
23 ]        -34.34[
24 ]         -34.34[
25 ]      1.2[
26 ]1.4499999999999999555910790149937383830547332763671875[
27 ]0[
28 ]0[
29 ]000000000023.23[
30 ]3.33333e+12[
31 ]2.3232322e-63[
32 ]        12[
33 ]    34.34[
34 ]3e+01[
35 ]2e+01[
36 ]0[
37 ]0.[
38 ]00000000000000001.23[
39 ] 4.34          [
40 ]                                 2.23299[
41 ]        3.34[
42 ]     10.0000000[
43 ]2.342342304980240200943976793000181e+43[
44 ]2.342342349994590092176136077183017156283003304821961036120765203050812399410964053923977348744250642e-57[
45 ]             23.2300[
46 ]               23.23[
47 ]1.234e-11[
48 ]1.2e-12[
49 ]13[
50 ]4e-15[
51 ]0.0001222342[
52 ]1.20000[
53 ]000000000000000034.3[
54 ] 0000000000000123.34[
55 ]0[
56 ]      23.2[
57 ]1.e+01[
58 ]                                                                                           123.34334[
TESTING %c
1 ]a[
2 ]         a[
3 ]a[
4 ]a         [
5 ]b             [
6 ]         x[
7 ]           f[
8 ]a[
9 ]z[
10 ]%6[
TESTING %s
1 ]Hello Paul[
2 ]                                                                                        Hello World![
3 ]Hel[
4 ][
5 ][
5 ]melbourne uni                                                                                       [
6 ]               yeh right buddy[
7 ]                                                                                                  on[
8 ]hello[
9 ]                               1+1[
10 ]paul                                                                                                [
11 ][
TESTING %p
1 ]0x64[
2 ]                                                                                                0x20[
3 ]0xd4e4143                                                                                           [
4 ]                                                                                           0xd4e4143[
5 ]0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ae3f2ff7[
6 ]0xc[
7 ]                                                                0x000000000000000000000000001476b742[
8 ]0x00000d6a[
9 ]     0x913[
10 ]        0x17[
11 ]0xf6a2815f[
12 ]0x442d394d[

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list