Skip to content

Commit

Permalink
Add a couple of trivial testcases to compare floats
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Nov 6, 2023
1 parent 1942313 commit ec051d1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tests/base/NSNumber/test01.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ int main()
START_SET("NSNumber")
NSNumber *n;

START_SET("simple-number checks")
NSNumber *nn = [NSNumber numberWithFloat: 42.0];

n = [NSNumber numberWithFloat: M_PI];
PASS([nn compare: n] == NSOrderedDescending, "42 is greater than pi")
PASS([n compare: nn] == NSOrderedAscending, "pi is smaller than 42")
PASS([n compare: n] == NSOrderedSame, "pi is pi")
PASS([nn compare: nn] == NSOrderedSame, "42 is 42")

END_SET("simple-number checks")

START_SET("not-a-number checks")

NSNumber *nan = [NSDecimalNumber notANumber];
Expand Down

0 comments on commit ec051d1

Please sign in to comment.