This commit is contained in:
Richard Frith-Macdonald 2022-03-07 10:13:44 +00:00
parent 61d14215fa
commit ae72ee4593
3 changed files with 22 additions and 2 deletions

View file

@ -40,6 +40,13 @@ testString(NSDictionary *dict)
PASS([p evaluateWithObject: dict], "%%K BEGINSWITH %%@");
p = [NSPredicate predicateWithFormat: @"(%K == %@) AND (%K == %@)", @"Record1.Name", @"John", @"Record2.Name", @"Mary"];
PASS([p evaluateWithObject: dict], "(%%K == %%@) AND (%%K == %%@)");
NSMutableArray *strings = [NSMutableArray arrayWithObjects: @"a", @"aa",
@"aaa", @"aaaa", nil];
NSArray *expect = [NSMutableArray arrayWithObjects: @"aaa", @"aaaa", nil];
p = [NSPredicate predicateWithFormat: @"self beginswith 'aaa'"];
[strings filterUsingPredicate: p];
PASS_EQUAL(strings, expect, "filter using BEGINSWITH")
}
void