Hi all,

Following up on my query about unit tests yesterday... I am writing another test checking boundary conditions for a calculation. In the normal running program I am feeding a very large number (1000000000000000000000000000000000000000) into one text field and the result displayed in the other text field is "inf". I want to write a test to explore this, so I did this:

- (void)testVeryLargeNumberShouldReturnInf {
        testConverter = Converter.new;
        
[testConverter setValue:[NSNumber numberWithFloat: 1000000000000000000000000000000000000000.0] forKey:@"originalTemp"];
        
NSNumber *newTemperatureInC = [NSNumber numberWithFloat:(float) [testConverter convertFToC]];
        
STAssertEquals("inf", [newTemperatureInC floatValue], @"Expecting inf; we got %f", [newTemperatureInC floatValue]);
        [testTempConverter release];
        
}

When I run this test I see this message: Expecting inf; we got inf

I tried this:

STAssertEquals("inf", [newTemperatureInC stringValue], @"Expecting inf; we got %s", [newTemperatureInC stringValue]);

and saw this message: Expecting inf; we got ¿√Ωpˇ

So I am guessing that when I get a float displayed as "inf" this is not the string it seems to be. Also, it looks like the string value of whatever is coming back is not something that I can use. Can anyone suggest how I might handle a test case like this?

Thanks,


Ian.
--_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to