diff --git a/Tests/UltimathnumTests/BinaryInteger+Division.swift.swift b/Tests/UltimathnumTests/BinaryInteger+Division.swift.swift index 3e43422c..e4046bb2 100644 --- a/Tests/UltimathnumTests/BinaryInteger+Division.swift.swift +++ b/Tests/UltimathnumTests/BinaryInteger+Division.swift.swift @@ -602,8 +602,8 @@ import TestKit func whereIs(_ type: T.Type) throws where T: SystemsIntegerAsSigned { for _ in 0 ..< conditional(debug: 32, release: 256) { let divisor = Nonzero(T.random(in: T.negatives)!) - let quotient = T.max - let remainder = divisor.value + 1 + let quotient = T.min + let remainder = T(-1) - divisor.value var dividend = divisor.value.multiplication(quotient).plus(Doublet(remainder)) var division = T.division(dividend.value, by: divisor) as Fallible> @@ -612,19 +612,19 @@ import TestKit try #require(division.value.quotient == quotient ) try #require(division.value.remainder == remainder) - dividend = dividend.value.minus(Doublet(T.lsb)) + dividend = dividend.value.plus(Doublet(T.lsb)) division = T.division(dividend.value, by: divisor) try #require(dividend.error == false) try #require(division.error == true) - try #require(division.value.quotient == T.min) + try #require(division.value.quotient == T.max) try #require(division.value.remainder .isZero) } } } @Test( - "BinaryInteger/division/edge-cases/2-by-1: edges of (+) by (-)", + "BinaryInteger/division/edge-cases/2-by-1: edges of (-) by (-)", Tag.List.tags(.generic, .important, .random), arguments: typesAsSystemsIntegerAsSigned, fuzzers ) func edgesOfNegativeByNegative( @@ -635,8 +635,8 @@ import TestKit func whereIs(_ type: T.Type) throws where T: SystemsIntegerAsSigned { for _ in 0 ..< conditional(debug: 32, release: 256) { let divisor = Nonzero(T.random(in: T.negatives)!) - let quotient = T.min - let remainder = T(-1) - divisor.value + let quotient = T.max + let remainder = divisor.value + 1 var dividend = divisor.value.multiplication(quotient).plus(Doublet(remainder)) var division = T.division(dividend.value, by: divisor) as Fallible> @@ -645,12 +645,12 @@ import TestKit try #require(division.value.quotient == quotient ) try #require(division.value.remainder == remainder) - dividend = dividend.value.plus(Doublet(T.lsb)) + dividend = dividend.value.minus(Doublet(T.lsb)) division = T.division(dividend.value, by: divisor) try #require(dividend.error == false) try #require(division.error == true) - try #require(division.value.quotient == T.max) + try #require(division.value.quotient == T.min) try #require(division.value.remainder .isZero) } }