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

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jan 31 21:24:26 AEDT 2002


On 01-Feb-2002, p.incani <paulai at ugrad.unimelb.edu.au> wrote:
...
> 	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)]),

This module should not include any tests which will get integer
overflow on systems with 32-bit integers.  Those would be
testing integer overflow behaviour, not string__format.

That means it should not include integers greater than 2^31 - 1 or less
than -2^31.  It should also not include int__max_int+1 or int__min_int-1.

However, it would be a good idea to have a separate set of tests,
only enabled on 64-bit systems (e.g. via `(if int__bits_per_int >= 64)')
which tested values close to +/-2^63.

The results for int__max_int and int__min_int will be different on
64-bit systems, so as well as the `.exp' file for 32-bit systems
you will also need a `.exp2' file that contains the expected output for 
64-bit systems.

(You could reduce the duplication there a little by putting all of the tests
which depend on int__bits_per_int, int__max_int, or int__min_int
in a separate module.)

> 	test(56, "%.4f", [f(0.000012345)]),  %bugged!!

These "bugged!!" comments could do with some elaboration.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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