From a6ecb7442a9d20cf48b2d2379acabb775cc110a7 Mon Sep 17 00:00:00 2001 From: Ben Rimmington Date: Thu, 16 Jan 2020 14:50:19 +0000 Subject: [PATCH] [BigIntTests] Update testRadicesAndNumerals() --- Tests/BigIntTests/BigIntTests.swift | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Tests/BigIntTests/BigIntTests.swift b/Tests/BigIntTests/BigIntTests.swift index 686fe88..62e341d 100644 --- a/Tests/BigIntTests/BigIntTests.swift +++ b/Tests/BigIntTests/BigIntTests.swift @@ -185,26 +185,25 @@ final class BigIntTests: XCTestCase { } func testRadicesAndNumerals() { - for _ in 0 ..< 100 { - let expectedNumber = BigInt(Int.random(in: .min ... .max)) - for radix in 2 ... 36 { - for uppercase in [false, true] { + for radix in 2 ... 36 { + for uppercase in [false, true] { + for _ in 0 ..< 100 { + let expectedNumber = BigInt(Int.random(in: .min ... .max)) let expectedString = String(expectedNumber, radix: radix, uppercase: uppercase) let actualNumber = BigInt(expectedString, radix: radix) XCTAssertNotNil(actualNumber) - if let actualNumber = actualNumber { - XCTAssertEqual(actualNumber, expectedNumber) - if radix == 10 { - XCTAssertEqual(actualNumber.description, expectedString) - } + XCTAssertEqual(actualNumber, expectedNumber) + if radix == 10 { + let actualString = expectedNumber.description + XCTAssertEqual(actualString, expectedString) } } } } } - + func testDivision() { let foo = BigInt("12345678901234567890123456789012345678901234567890123456789012345678901234567890")! let bar = BigInt("351235231535161613134135135135")!