Skip to content

Instantly share code, notes, and snippets.

@bvanderveen
Forked from jacksonh/gist:3257926
Created August 4, 2012 22:34
Show Gist options
  • Save bvanderveen/3260382 to your computer and use it in GitHub Desktop.
Save bvanderveen/3260382 to your computer and use it in GitHub Desktop.
Objective-C assertion ideas
- (void) assertionIdeasLikeNUnit
{
[Assert that:@"foobar" is:[Equal to:@"other"]];
[Assert that:@"foobar" isNot:[Equal to:@"other"]];
[Assert that:collection isAll:[Less than:@10]];
[Assert that:collection isAll:[Less thanOrEqualTo:@10]];
[Assert that:collection isAll:[Less thanOrEqualTo:@10]];
[Assert that:collection isAll:[Greater than:@10]];
[Assert that:collection isAll:[Greater thanOrEqualTo:@10]];
[Assert that:collection isAll:[Greater thanOrEqualTo:@10]];
[Assert that:value is:[Less thanInteger:10]];
[Assert that:value is:[Less thanFloat:10f]];
[Assert that:value is:[Between low:@0 high:@10]];
[Assert that:value is:[Between low:lo high:hi using:comparer]];
[Assert that:nil is:[Equal toNil]];
[Assert that:bool is:[Equal toNO]];
[Assert that:bool is:[Equal toYES]];
[Assert that:pointer1 is:[Same as:pointer2]];
[Assert that:object is:[Kind of:[Foo class]]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment