[Seaside-dev] Troubles with WANumberPrinter>>printFloat:on:

Michael Lucas-Smith mlucas-smith at cincom.com
Thu Jun 4 17:36:02 UTC 2009


>> b) I don't entirely know if my proposed solution is right
>>     
>
> It makes some of the tests fail in Squeak. So that is not a solution either.
>   
It seems like it should become a platform specific class.

The problem is that the test cases will never give the expected answers 
if the printer is platform specific.

Using the following code on VW I can get testFloatPrinter to pass:
printFloat: aNumber on: aStream
    | format |
    format := String new writeStream.
    aNumber integerPart truncated digitLength timesRepeat: [format 
nextPut: $0].
    format nextPut: $..
    precision timesRepeat: [format nextPut: $0].
    NumberPrintPolicy print: aNumber abs on: aStream using: format contents

However, despite this, tests such as TestFileSizePrinterBinary will fail 
printing 9000000 as 8.5 MiB with 8.6 MiB instead.
Tests like #testUsCurrency which change the value from 12.34 to $12.33 
fail because the printer prints it as $12.34

So it's not just the implementation that's broken, but you could also 
argue that the tests themselves are asserting the wrong thing.

Cheers,
Michael


More information about the seaside-dev mailing list