mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Small array keyword fixes for NSPredicate
This commit is contained in:
parent
e58b83c1f3
commit
531d3b8559
3 changed files with 32 additions and 3 deletions
|
@ -151,6 +151,28 @@ testBlock(NSDictionary* dict)
|
|||
# endif
|
||||
END_SET("Block predicates");
|
||||
}
|
||||
|
||||
void testArray(void)
|
||||
{
|
||||
NSArray *array;
|
||||
NSPredicate *predicate;
|
||||
|
||||
array = [NSArray arrayWithObjects:
|
||||
[NSNumber numberWithInteger: 1],
|
||||
[NSNumber numberWithInteger: 2],
|
||||
[NSNumber numberWithInteger: 0],
|
||||
nil];
|
||||
|
||||
predicate = [NSPredicate predicateWithFormat: @"SELF[FIRST] = 1"];
|
||||
PASS([predicate evaluateWithObject: array], "first is one")
|
||||
|
||||
predicate = [NSPredicate predicateWithFormat: @"SELF[LAST] = 0"];
|
||||
PASS([predicate evaluateWithObject: array], "last is zero")
|
||||
|
||||
predicate = [NSPredicate predicateWithFormat: @"SELF[SIZE] = 3"];
|
||||
PASS([predicate evaluateWithObject: array], "size is three")
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
NSArray *filtered;
|
||||
|
@ -257,6 +279,8 @@ int main()
|
|||
PASS_EQUAL([a description], @"(yes)",
|
||||
"predicate created with format can filter an array")
|
||||
|
||||
testArray();
|
||||
|
||||
END_SET("basic")
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue