Added some tests for round-trips through NSNumber.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33650 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2011-07-27 08:57:30 +00:00
parent bc62c44b2b
commit 8a8836129c

View file

@ -12,7 +12,30 @@ int main()
test_NSObject(@"NSNumber", [NSArray arrayWithObject:testObj]);
test_NSCoding([NSArray arrayWithObject:testObj]);
test_NSCopying(@"NSNumber", @"NSNumber",
[NSArray arrayWithObject:testObj],YES,NO);
[NSArray arrayWithObject:testObj],YES,NO);
{
// For more paranoid testing, you can change this to int or long long.
short i = 0;
int increment = 1;
while (i >= 0)
{
NSNumber *n = [[NSNumber alloc] initWithInt: i];
PASS(i == [n intValue], "int -> NSNumber -> int is identity operation for %d", i);
[n release];
i += increment;
if (i > 100) { increment++; }
}
i = -1;
increment = 1;
while (i <= 0)
{
NSNumber *n = [[NSNumber alloc] initWithInt: i];
PASS(i == [n intValue], "int -> NSNumber -> int is identity operation for %d", i);
[n release];
i -= increment;
if (i < -100) { increment++; }
}
}
[arp release]; arp = nil;
return 0;
}