change ASMutableAttributedStringBuilderTests so that it is safe against different MAX macro

when MAX macro is defined in such a way in "sys/params.h", this test will become flaky,
fix so that it doesn't happen
This commit is contained in:
Onha Choe 2015-04-14 13:57:54 -07:00
parent 1316389f10
commit 74d2433d60

View File

@ -29,7 +29,8 @@
- (NSRange)_randomizedRangeForStringBuilder:(ASMutableAttributedStringBuilder *)builder
{
NSUInteger loc = arc4random() % (builder.length - 1);
NSUInteger len = MAX(arc4random() % (builder.length - loc), 1);
NSUInteger len = arc4random() % (builder.length - loc);
len = ((len > 0) ? len : 1);
return NSMakeRange(loc, len);
}