From 650bfd77695b519bcad49afba9af65dff685ed13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Bystr=C3=B6m=20Ericsson?= Date: Tue, 29 Oct 2024 06:15:40 +0100 Subject: [PATCH] Rewrite of TextInt+Letters.swift tests (#110). --- Tests/UltimathnumTests/TextInt+Letters.swift | 34 ++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/Tests/UltimathnumTests/TextInt+Letters.swift b/Tests/UltimathnumTests/TextInt+Letters.swift index 53b50b16..7eb874ae 100644 --- a/Tests/UltimathnumTests/TextInt+Letters.swift +++ b/Tests/UltimathnumTests/TextInt+Letters.swift @@ -8,25 +8,41 @@ //=----------------------------------------------------------------------------= import CoreKit -import TestKit +import TestKit2 //*============================================================================* // MARK: * Text Int x Letters //*============================================================================* -final class TextIntTestsOnLetters: XCTestCase { +@Suite(Tag.List.tags(.exhaustive), ParallelizationTrait.serialized) +struct TextIntTestsOnLetters { //=------------------------------------------------------------------------= // MARK: Tests //=------------------------------------------------------------------------= - - func testInitBool() { - Test().same(TextInt.Letters(uppercase: false), TextInt.Letters.lowercase) - Test().same(TextInt.Letters(uppercase: true ), TextInt.Letters.uppercase) + + @Test("TextInt.Letters: start", arguments: [ + + (instance: TextInt.Letters.lowercase, start: 97 as U8), + (instance: TextInt.Letters.uppercase, start: 65 as U8), + + ] as [(TextInt.Letters, U8)]) + func start(instance: TextInt.Letters, start: U8) throws { + #expect(instance.start == start) + + let numerals = try TextInt.Numerals(radix: 36, letters: instance) + #expect(try numerals.decode(start) == 10) + #expect(try numerals.encode(10) == start) } - func testGetStart() { - Test().same(TextInt.Letters.lowercase.start, U8(UInt8(ascii: "a"))) - Test().same(TextInt.Letters.uppercase.start, U8(UInt8(ascii: "A"))) + @Test("TextInt.Letters: uppercase", arguments: [ + + (instance: TextInt.Letters.lowercase, uppercase: false), + (instance: TextInt.Letters.uppercase, uppercase: true ), + + ] as [(TextInt.Letters, Bool)]) + func uppercase(instance: TextInt.Letters, uppercase: Bool) { + #expect((instance == TextInt.Letters (uppercase: uppercase))) + #expect((instance == TextInt.Letters .uppercase) == uppercase) } }