mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-02 04:38:33 +00:00
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:
parent
1316389f10
commit
74d2433d60
@ -29,7 +29,8 @@
|
|||||||
- (NSRange)_randomizedRangeForStringBuilder:(ASMutableAttributedStringBuilder *)builder
|
- (NSRange)_randomizedRangeForStringBuilder:(ASMutableAttributedStringBuilder *)builder
|
||||||
{
|
{
|
||||||
NSUInteger loc = arc4random() % (builder.length - 1);
|
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);
|
return NSMakeRange(loc, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user