From cfc2cd7c9770fe9f500b513eeb9a444608f88f07 Mon Sep 17 00:00:00 2001 From: Ben Rimmington Date: Sun, 19 Jan 2020 12:32:11 +0000 Subject: [PATCH] [BigIntTests] Add `measure {}` to testFactorial() --- Tests/BigIntTests/BigIntTests.swift | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Tests/BigIntTests/BigIntTests.swift b/Tests/BigIntTests/BigIntTests.swift index ae8236f..c05ba11 100644 --- a/Tests/BigIntTests/BigIntTests.swift +++ b/Tests/BigIntTests/BigIntTests.swift @@ -73,11 +73,18 @@ final class BigIntTests: XCTestCase { """ func testFactorial() { - let factorial512 = fac(BigInt(512)) - XCTAssertEqual(String(factorial512, radix: 36, uppercase: true), - Self.descriptionFactorial512Radix36) - XCTAssertEqual(BigInt(Self.descriptionFactorial512Radix36, radix: 36), - factorial512) + var expectedNumber: BigInt! + var actualNumber: BigInt! + var actualString: String! + + measure { + expectedNumber = BigInt(Self.descriptionFactorial512Radix36, radix: 36) + actualNumber = fac(BigInt(512)) + actualString = String(actualNumber, radix: 36, uppercase: true) + } + + XCTAssertEqual(actualNumber, expectedNumber) + XCTAssertEqual(actualString, Self.descriptionFactorial512Radix36) } func testExample() {