Skip to content

Commit

Permalink
make test user locale independent
Browse files Browse the repository at this point in the history
  • Loading branch information
rmottola committed Jan 22, 2024
1 parent ecc5d80 commit 75fd954
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Tests/base/NSNumber/test03.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ int main()
NSComparisonResult result;

// Test comparing positive numbers
n1 = [NSDecimalNumber decimalNumberWithString:@"0.05"];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.10"];
n1 = [NSDecimalNumber decimalNumberWithString:@"0.05" locale:nil];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.10" locale:nil];
result = [n1 compare:n2];
PASS(result == NSOrderedAscending, "0.05 < 0.10");

// Test comparing negative numbers
n1 = [NSDecimalNumber decimalNumberWithString:@"-0.10"];
n2 = [NSDecimalNumber decimalNumberWithString:@"-0.05"];
n1 = [NSDecimalNumber decimalNumberWithString:@"-0.10" locale:nil];
n2 = [NSDecimalNumber decimalNumberWithString:@"-0.05" locale:nil];
result = [n1 compare:n2];
PASS(result == NSOrderedAscending, "-0.10 < -0.05");

// Test comparing a positive and a negative number
n1 = [NSDecimalNumber decimalNumberWithString:@"-0.10"];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.10"];
n1 = [NSDecimalNumber decimalNumberWithString:@"-0.10" locale:nil];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.10" locale:nil];
result = [n1 compare:n2];
PASS(result == NSOrderedAscending, "-0.10 < 0.10");

// Test comparing zeros
n1 = [NSDecimalNumber decimalNumberWithString:@"0.00"];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.00"];
n1 = [NSDecimalNumber decimalNumberWithString:@"0.00" locale:nil];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.00" locale:nil];
result = [n1 compare:n2];
PASS(result == NSOrderedSame, "0.00 == 0.00");

// Test comparing zero with a positive number
n1 = [NSDecimalNumber decimalNumberWithString:@"0.00"];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.02"];
n1 = [NSDecimalNumber decimalNumberWithString:@"0.00" locale:nil];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.02" locale:nil];
result = [n1 compare:n2];
PASS(result == NSOrderedAscending, "0.00 < 0.02");

// Test comparing zero with a negative number
n1 = [NSDecimalNumber decimalNumberWithString:@"-0.02"];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.00"];
n1 = [NSDecimalNumber decimalNumberWithString:@"-0.02" locale:nil];
n2 = [NSDecimalNumber decimalNumberWithString:@"0.00" locale:nil];
result = [n1 compare:n2];
PASS(result == NSOrderedAscending, "-0.02 < 0.00");

Expand Down

0 comments on commit 75fd954

Please sign in to comment.