Skip to content

Commit

Permalink
Add BinaryInteger/squared() to tests from previous commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
oscbyspro committed Oct 22, 2024
1 parent fda354b commit 95dea44
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Tests/UltimathnumTests/BinaryInteger+Multiplication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ import TestKit2
try whereIs(type)

func whereIs<T>(_ type: T.Type) throws where T: BinaryInteger {
try withOnlyOneCallToRequire { require in
try withOnlyOneCallToRequire(type) { require in
for _ in 0 ..< conditional(debug: 16, release: 32) {
let lhs = T.entropic(through: Shift.max(or: 255), using: &randomness)
let rhs = T.entropic(through: Shift.max(or: 255), using: &randomness)
Expand All @@ -362,6 +362,11 @@ import TestKit2
require((lhs &* rhsComplement) == lowComplement)
require((lhsComplement &* rhsComplement) == low)
}

for _ in 0 ..< conditional(debug: 16, release: 32) {
let int = T.entropic(through: Shift.max(or: 255), using: &randomness)
require(int.complement().squared().value == int.squared().value)
}
}
}
}
Expand All @@ -374,7 +379,7 @@ import TestKit2
try whereIs(type)

func whereIs<T>(_ type: T.Type) throws where T: BinaryInteger {
try withOnlyOneCallToRequire { require in
try withOnlyOneCallToRequire(type) { require in
for _ in 0 ..< 32 {
let lhs = T.entropic(through: Shift.max(or: 255), using: &randomness)
let rhs = T.zero
Expand Down

0 comments on commit 95dea44

Please sign in to comment.