mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +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
a124b3a52a
commit
87c717eaba
1 changed files with 24 additions and 1 deletions
|
@ -12,7 +12,30 @@ int main()
|
||||||
test_NSObject(@"NSNumber", [NSArray arrayWithObject:testObj]);
|
test_NSObject(@"NSNumber", [NSArray arrayWithObject:testObj]);
|
||||||
test_NSCoding([NSArray arrayWithObject:testObj]);
|
test_NSCoding([NSArray arrayWithObject:testObj]);
|
||||||
test_NSCopying(@"NSNumber", @"NSNumber",
|
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;
|
[arp release]; arp = nil;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue