Skip to content

Commit

Permalink
Fix a unit test.
Browse files Browse the repository at this point in the history
The random distance limit was too low for arbitrary integer values of zero.
  • Loading branch information
oscbyspro committed Nov 29, 2024
1 parent 64ef5d2 commit 0d70290
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tests/UltimathnumTests/BinaryInteger+Shift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ import TestKit
) func distanceIsInfiniteCountOrShift(
type: any BinaryInteger.Type, randomness: consuming FuzzerInt
) throws {

try whereIs(type)
func whereIs<T>(_ type: T.Type) throws where T: BinaryInteger {
for _ in 0 ..< 32 {
let value = T.entropic(through: Shift.max(or: 255), using: &randomness)
let zeros = UX(raw: value.ascending(Bit.zero))
let limit = UX.max - zeros
let zeros = UX(raw: value.ascending(Bit.zero))
let limit = Swift.max(UX.msb, UX.max - zeros)
let distance = Count(raw: UX.random(in: limit...UX.max, using: &randomness))

try #require(distance.isInfinite)
Expand Down

0 comments on commit 0d70290

Please sign in to comment.