We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Busy writing simple tests as part of the CocoaPods Test Jam!
Created the following test:
- (void)testLocationInRangeMax { UInt64 midLocation = UINT64_MAX / 2; UInt64 maxLength = UINT64_MAX; DDRange maxRange = DDMakeRange(midLocation, maxLength); XCTAssertFalse(DDLocationInRange(midLocation + maxLength + 1, maxRange)); XCTAssertTrue(DDLocationInRange(midLocation, maxRange)); XCTAssertFalse(DDLocationInRange(midLocation - 1, maxRange)); XCTAssertFalse(DDLocationInRange(midLocation - 2, maxRange)); }
The first and last assertions will fail.
The third assertion passes only by chance.
=> DDLocationInRange(midLocation - 1, maxRange) => loc - range.location < range.length => midLocation -1 - midLocation < maxLength => (UINT64_MAX / 2) - 1 - (UINT64_MAX / 2) < UINT64_MAX => -1 < range.length => UINT64_MAX < UINT64_MAX // Since we're dealing with unsigned ints, -1 wraps back round to UNIT64_MAX => Return False
I won't commit this test as it will fail until DDRange is adjusted to take care of UINT64_MAX border cases. :)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Busy writing simple tests as part of the CocoaPods Test Jam!
Created the following test:
The first and last assertions will fail.
The third assertion passes only by chance.
I won't commit this test as it will fail until DDRange is adjusted to take care of UINT64_MAX border cases. :)
The text was updated successfully, but these errors were encountered: