• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting a handle on inf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting a handle on inf


  • Subject: Getting a handle on inf
  • From: Ian Piper <email@hidden>
  • Date: Mon, 26 Oct 2009 18:26:47 +0000

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Getting a handle on inf
      • From: Greg Parker <email@hidden>
    • Re: Getting a handle on inf
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Custom NSScroller
  • Next by Date: Re: Custom NSScroller
  • Previous by thread: Re: Custom NSScroller
  • Next by thread: Re: Getting a handle on inf
  • Index(es):
    • Date
    • Thread