I’d like to unit test an NSString for it’s value, but I need to be able to accept two “correct” values. not just one. How would I do this ?
I know I can do something like:
STAssertEqualObjects(node.name, @"attachment", @"invalid name");
But how do I accept, for example, @"attachment" AND @"table" values as correct and not fail the unit test if the NSString equals to either one.
Thank you.
There’s no macro specifically for that. You could use
STAssertTrueand anNSArrayliteral containing the acceptable values:You need an extra pair of parentheses to hide the comma from the macro preprocessor that handles
STAssertTrue.Or you could just spell it out: