mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
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:
parent
bc62c44b2b
commit
8a8836129c
1 changed files with 24 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue