-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite BinaryInteger+Geometry.swift tests (#110).
- Loading branch information
Showing
2 changed files
with
136 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//=----------------------------------------------------------------------------= | ||
// This source file is part of the Ultimathnum open source project. | ||
// | ||
// Copyright (c) 2023 Oscar Byström Ericsson | ||
// Licensed under Apache License, Version 2.0 | ||
// | ||
// See http://www.apache.org/licenses/LICENSE-2.0 for license information. | ||
//=----------------------------------------------------------------------------= | ||
|
||
import CoreKit | ||
|
||
//*============================================================================* | ||
// MARK: * Expect x Geometry | ||
//*============================================================================* | ||
|
||
@inlinable public func Ɣexpect<T>( | ||
_ value: T, | ||
isqrt expectation: T, | ||
at location: SourceLocation = #_sourceLocation | ||
) throws where T: BinaryInteger { | ||
|
||
let low = try #require(expectation.squared().optional()) | ||
#expect(value >= low, sourceLocation: location) | ||
|
||
guard let high = expectation.incremented().squared().optional() else { return } | ||
#expect(value < high, sourceLocation: location) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters