From 00c0ba84eae65c8a458738297ad6cd660b1086db Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Sat, 14 Dec 2024 22:27:38 +0100 Subject: [PATCH 1/8] [Armstrong number]: Fix formatting (#783) * Fix formatting * Fix --- exercises/practice/armstrong-numbers/.meta/config.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/practice/armstrong-numbers/.meta/config.json b/exercises/practice/armstrong-numbers/.meta/config.json index e90322e97..8011bdcc1 100644 --- a/exercises/practice/armstrong-numbers/.meta/config.json +++ b/exercises/practice/armstrong-numbers/.meta/config.json @@ -1,5 +1,7 @@ { - "authors": ["meatball133"], + "authors": [ + "meatball133" + ], "files": { "solution": [ "Sources/ArmstrongNumbers/ArmstrongNumbers.swift" From 30f8e4c9b7b3db560a3fcaa16ce50a809e4e9c92 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Sun, 15 Dec 2024 00:03:02 +0100 Subject: [PATCH 2/8] [New Exercise]: Darts (#707) * Add Darts exercise * Add author * Fix * Sync exercise to problem spec --- config.json | 8 +++ .../practice/darts/.docs/instructions.md | 31 ++++++++ .../.meta/Sources/Darts/DartsExample.swift | 15 ++++ exercises/practice/darts/.meta/config.json | 18 +++++ exercises/practice/darts/.meta/template.swift | 16 +++++ exercises/practice/darts/.meta/tests.toml | 49 +++++++++++++ exercises/practice/darts/Package.swift | 21 ++++++ .../practice/darts/Sources/Darts/Darts.swift | 3 + .../darts/Tests/DartsTests/DartsTests.swift | 71 +++++++++++++++++++ .../Sources/Generator/generator-plugins.swift | 3 + 10 files changed, 235 insertions(+) create mode 100644 exercises/practice/darts/.docs/instructions.md create mode 100644 exercises/practice/darts/.meta/Sources/Darts/DartsExample.swift create mode 100644 exercises/practice/darts/.meta/config.json create mode 100644 exercises/practice/darts/.meta/template.swift create mode 100644 exercises/practice/darts/.meta/tests.toml create mode 100644 exercises/practice/darts/Package.swift create mode 100644 exercises/practice/darts/Sources/Darts/Darts.swift create mode 100644 exercises/practice/darts/Tests/DartsTests/DartsTests.swift diff --git a/config.json b/config.json index 96812a902..0376ea85c 100644 --- a/config.json +++ b/config.json @@ -408,6 +408,14 @@ "transforming" ] }, + { + "slug": "darts", + "name": "Darts", + "uuid": "bdbc6f27-bc98-4edf-9f1d-93dbe49da361", + "practices": [], + "prerequisites": [], + "difficulty": 2 + }, { "slug": "bob", "name": "Bob", diff --git a/exercises/practice/darts/.docs/instructions.md b/exercises/practice/darts/.docs/instructions.md new file mode 100644 index 000000000..6518201c7 --- /dev/null +++ b/exercises/practice/darts/.docs/instructions.md @@ -0,0 +1,31 @@ +# Instructions + +Calculate the points scored in a single toss of a Darts game. + +[Darts][darts] is a game where players throw darts at a [target][darts-target]. + +In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands: + +![Our dart scoreboard with values from a complete miss to a bullseye](https://assets.exercism.org/images/exercises/darts/darts-scoreboard.svg) + +- If the dart lands outside the target, player earns no points (0 points). +- If the dart lands in the outer circle of the target, player earns 1 point. +- If the dart lands in the middle circle of the target, player earns 5 points. +- If the dart lands in the inner circle of the target, player earns 10 points. + +The outer circle has a radius of 10 units (this is equivalent to the total radius for the entire target), the middle circle a radius of 5 units, and the inner circle a radius of 1. +Of course, they are all centered at the same point — that is, the circles are [concentric][] defined by the coordinates (0, 0). + +Given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), calculate the correct score earned by a dart landing at that point. + +## Credit + +The scoreboard image was created by [habere-et-dispertire][habere-et-dispertire] using [Inkscape][inkscape]. + +[darts]: https://en.wikipedia.org/wiki/Darts +[darts-target]: https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg +[concentric]: https://mathworld.wolfram.com/ConcentricCircles.html +[cartesian-coordinates]: https://www.mathsisfun.com/data/cartesian-coordinates.html +[real-numbers]: https://www.mathsisfun.com/numbers/real-numbers.html +[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire +[inkscape]: https://en.wikipedia.org/wiki/Inkscape diff --git a/exercises/practice/darts/.meta/Sources/Darts/DartsExample.swift b/exercises/practice/darts/.meta/Sources/Darts/DartsExample.swift new file mode 100644 index 000000000..5d602dc48 --- /dev/null +++ b/exercises/practice/darts/.meta/Sources/Darts/DartsExample.swift @@ -0,0 +1,15 @@ +import Foundation + +func dartScore(x: Double, y: Double) -> Int { + let distance = sqrt(x * x + y * y) + switch distance { + case 0...1: + return 10 + case 1...5: + return 5 + case 5...10: + return 1 + default: + return 0 + } +} diff --git a/exercises/practice/darts/.meta/config.json b/exercises/practice/darts/.meta/config.json new file mode 100644 index 000000000..d7184c4d9 --- /dev/null +++ b/exercises/practice/darts/.meta/config.json @@ -0,0 +1,18 @@ +{ + "authors": [ + "meatball133" + ], + "files": { + "solution": [ + "Sources/Darts/Darts.swift" + ], + "test": [ + "Tests/DartsTests/DartsTests.swift" + ], + "example": [ + ".meta/Sources/Darts/DartsExample.swift" + ] + }, + "blurb": "Calculate the points scored in a single toss of a Darts game.", + "source": "Inspired by an exercise created by a professor Della Paolera in Argentina" +} diff --git a/exercises/practice/darts/.meta/template.swift b/exercises/practice/darts/.meta/template.swift new file mode 100644 index 000000000..77fd528f3 --- /dev/null +++ b/exercises/practice/darts/.meta/template.swift @@ -0,0 +1,16 @@ +import XCTest +@testable import {{exercise|camelCase}} +class {{exercise|camelCase}}Tests: XCTestCase { + let runAll = Bool(ProcessInfo.processInfo.environment["RUNALL", default: "false"]) ?? false + + {% for case in cases %} + {% if forloop.first -%} + func test{{case.description |camelCase }}() { + {% else -%} + func test{{case.description |camelCase }}() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + {% endif -%} + XCTAssertEqual(dartScore(x: {{case.input.x | round:1 }}, y: {{case.input.y | round:1}}), {{case.expected}}) + } + {% endfor -%} +} diff --git a/exercises/practice/darts/.meta/tests.toml b/exercises/practice/darts/.meta/tests.toml new file mode 100644 index 000000000..fbe2976d4 --- /dev/null +++ b/exercises/practice/darts/.meta/tests.toml @@ -0,0 +1,49 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[9033f731-0a3a-4d9c-b1c0-34a1c8362afb] +description = "Missed target" + +[4c9f6ff4-c489-45fd-be8a-1fcb08b4d0ba] +description = "On the outer circle" + +[14378687-ee58-4c9b-a323-b089d5274be8] +description = "On the middle circle" + +[849e2e63-85bd-4fed-bc3b-781ae962e2c9] +description = "On the inner circle" + +[1c5ffd9f-ea66-462f-9f06-a1303de5a226] +description = "Exactly on center" + +[b65abce3-a679-4550-8115-4b74bda06088] +description = "Near the center" + +[66c29c1d-44f5-40cf-9927-e09a1305b399] +description = "Just within the inner circle" + +[d1012f63-c97c-4394-b944-7beb3d0b141a] +description = "Just outside the inner circle" + +[ab2b5666-b0b4-49c3-9b27-205e790ed945] +description = "Just within the middle circle" + +[70f1424e-d690-4860-8caf-9740a52c0161] +description = "Just outside the middle circle" + +[a7dbf8db-419c-4712-8a7f-67602b69b293] +description = "Just within the outer circle" + +[e0f39315-9f9a-4546-96e4-a9475b885aa7] +description = "Just outside the outer circle" + +[045d7d18-d863-4229-818e-b50828c75d19] +description = "Asymmetric position between the inner and middle circles" diff --git a/exercises/practice/darts/Package.swift b/exercises/practice/darts/Package.swift new file mode 100644 index 000000000..1dd8e0708 --- /dev/null +++ b/exercises/practice/darts/Package.swift @@ -0,0 +1,21 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "Darts", + products: [ + .library( + name: "Darts", + targets: ["Darts"]) + ], + dependencies: [], + targets: [ + .target( + name: "Darts", + dependencies: []), + .testTarget( + name: "DartsTests", + dependencies: ["Darts"]), + ] +) diff --git a/exercises/practice/darts/Sources/Darts/Darts.swift b/exercises/practice/darts/Sources/Darts/Darts.swift new file mode 100644 index 000000000..cc86ce15e --- /dev/null +++ b/exercises/practice/darts/Sources/Darts/Darts.swift @@ -0,0 +1,3 @@ +func dartScore(x: Double, y: Double) -> Int { + // Write your code for the 'Darts' exercise here. +} diff --git a/exercises/practice/darts/Tests/DartsTests/DartsTests.swift b/exercises/practice/darts/Tests/DartsTests/DartsTests.swift new file mode 100644 index 000000000..45491ab35 --- /dev/null +++ b/exercises/practice/darts/Tests/DartsTests/DartsTests.swift @@ -0,0 +1,71 @@ +import XCTest + +@testable import Darts + +class DartsTests: XCTestCase { + let runAll = Bool(ProcessInfo.processInfo.environment["RUNALL", default: "false"]) ?? false + + func testMissedTarget() { + XCTAssertEqual(dartScore(x: -9, y: 9), 0) + } + + func testOnTheOuterCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: 0, y: 10), 1) + } + + func testOnTheMiddleCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: -5, y: 0), 5) + } + + func testOnTheInnerCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: 0, y: -1), 10) + } + + func testExactlyOnCenter() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: 0, y: 0), 10) + } + + func testNearTheCenter() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: -0.1, y: -0.1), 10) + } + + func testJustWithinTheInnerCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: 0.7, y: 0.7), 10) + } + + func testJustOutsideTheInnerCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: 0.8, y: -0.8), 5) + } + + func testJustWithinTheMiddleCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: -3.5, y: 3.5), 5) + } + + func testJustOutsideTheMiddleCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: -3.6, y: -3.6), 1) + } + + func testJustWithinTheOuterCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: -7, y: 7), 1) + } + + func testJustOutsideTheOuterCircle() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: 7.1, y: -7.1), 0) + } + + func testAsymmetricPositionBetweenTheInnerAndMiddleCircles() throws { + try XCTSkipIf(true && !runAll) // change true to false to run this test + XCTAssertEqual(dartScore(x: 0.5, y: -4), 5) + } +} diff --git a/generator/Sources/Generator/generator-plugins.swift b/generator/Sources/Generator/generator-plugins.swift index e18be094b..353bd95bd 100644 --- a/generator/Sources/Generator/generator-plugins.swift +++ b/generator/Sources/Generator/generator-plugins.swift @@ -223,6 +223,9 @@ class GeneratorPlugins { } ext.registerFilter("round") { (value: Any?, args: [Any?]) in + if let inputNumber = value as? Int { + return inputNumber + } if let inputNumber = value as? Double { if let precision = args.first as? Int { let divisor = pow(10.0, Double(precision)) From 4dea7e2b6dc717d04c1e68cb1221dd33f6416df5 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Mon, 23 Dec 2024 21:30:53 +0100 Subject: [PATCH 3/8] Update CI configuration and add Swift Numerics dependency (#806) * Update CI configuration and add Swift Numerics dependency * Check if swift6 is available in macos 15 --- .github/workflows/ci.yml | 3 +-- Package.swift | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb81d2644..865e0abae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,12 @@ on: jobs: test: - runs-on: macos-13 + runs-on: macos-15 env: RUNALL: "true" steps: - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - name: Run tests run: swift test generator-tests: diff --git a/Package.swift b/Package.swift index 35292fd26..4002074ad 100644 --- a/Package.swift +++ b/Package.swift @@ -49,11 +49,13 @@ let practiceExerciseTargets: [Target] = practiceExercises.flatMap { return [ .target( name:"\($0.pascalCased)", + dependencies: [.product(name: "Numerics", package: "swift-numerics")], path:"./exercises/practice/\($0)/.meta/Sources"), .testTarget( name:"\($0.pascalCased)Tests", dependencies: [ - .target(name:"\($0.pascalCased)") + .target(name:"\($0.pascalCased)"), + .product(name: "Numerics", package: "swift-numerics") ], path:"./exercises/practice/\($0)/Tests") ] @@ -68,5 +70,6 @@ let package = Package( name: "xswift", targets: allTargets.filter { $0.type == .regular }.map { $0.name }) ], + dependencies: [.package(url: "https://github.com/apple/swift-numerics", from: "1.0.2")], targets: allTargets ) From a9f2f3fa8ebdbd0c2a3a93df32147c0c4a658394 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Wed, 25 Dec 2024 23:02:10 +0100 Subject: [PATCH 4/8] Remove obsolete LinuxMain.swift and XCTestManifests.swift files from various exercises (#812) --- .../BombDefuser/BombDefuserExemplar.swift | 6 ++++-- .../BombDefuserTests/BombDefuserTests.swift | 8 -------- .../BombDefuserTests/XCTestManifests.swift | 9 --------- .../concept/bomb-defuser/Tests/LinuxMain.swift | 6 ------ .../HighScoreBoardTests.swift | 12 ------------ .../HighScoreBoardTests/XCTestManifests.swift | 9 --------- .../high-score-board/Tests/LinuxMain.swift | 6 ------ .../LasagnaMasterTests.swift | 14 -------------- .../LasagnaMasterTests/XCTestManifests.swift | 9 --------- .../lasagna-master/Tests/LinuxMain.swift | 6 ------ .../concept/log-lines/Tests/LinuxMain.swift | 6 ------ .../Tests/LogLinesTests/LogLinesTests.swift | 18 ------------------ .../Tests/LogLinesTests/XCTestManifests.swift | 9 --------- .../magician-in-training/Tests/LinuxMain.swift | 6 ------ .../XCTestManifests.swift | 9 --------- .../master-mixologist/Tests/LinuxMain.swift | 6 ------ .../MasterMixologistTests.swift | 16 ---------------- .../XCTestManifests.swift | 9 --------- .../concept/pizza-slices/Tests/LinuxMain.swift | 6 ------ .../PizzaSlicesTests/PizzaSlicesTests.swift | 15 --------------- .../PizzaSlicesTests/XCTestManifests.swift | 9 --------- .../concept/poetry-club/Tests/LinuxMain.swift | 6 ------ .../PoetryClubTests/PoetryClubTests.swift | 16 ---------------- .../PoetryClubTests/XCTestManifests.swift | 9 --------- .../santas-helper/Tests/LinuxMain.swift | 6 ------ .../SantasHelperTests/SantasHelperTests.swift | 5 ----- .../SantasHelperTests/XCTestManifests.swift | 9 --------- .../concept/secret-agent/Tests/LinuxMain.swift | 6 ------ .../SecretAgentTests/SecretAgentTests.swift | 7 ------- .../SecretAgentTests/XCTestManifests.swift | 9 --------- .../WindowingSystemExemplar.swift | 2 +- .../windowing-system/Tests/LinuxMain.swift | 6 ------ .../WindowingSystemTests.swift | 14 -------------- .../WindowingSystemTests/XCTestManifests.swift | 9 --------- 34 files changed, 5 insertions(+), 293 deletions(-) delete mode 100644 exercises/concept/bomb-defuser/Tests/BombDefuserTests/XCTestManifests.swift delete mode 100644 exercises/concept/bomb-defuser/Tests/LinuxMain.swift delete mode 100644 exercises/concept/high-score-board/Tests/HighScoreBoardTests/XCTestManifests.swift delete mode 100644 exercises/concept/high-score-board/Tests/LinuxMain.swift delete mode 100644 exercises/concept/lasagna-master/Tests/LasagnaMasterTests/XCTestManifests.swift delete mode 100644 exercises/concept/lasagna-master/Tests/LinuxMain.swift delete mode 100644 exercises/concept/log-lines/Tests/LinuxMain.swift delete mode 100644 exercises/concept/log-lines/Tests/LogLinesTests/XCTestManifests.swift delete mode 100644 exercises/concept/magician-in-training/Tests/LinuxMain.swift delete mode 100644 exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/XCTestManifests.swift delete mode 100644 exercises/concept/master-mixologist/Tests/LinuxMain.swift delete mode 100644 exercises/concept/master-mixologist/Tests/MasterMixologistTests/XCTestManifests.swift delete mode 100644 exercises/concept/pizza-slices/Tests/LinuxMain.swift delete mode 100644 exercises/concept/pizza-slices/Tests/PizzaSlicesTests/XCTestManifests.swift delete mode 100644 exercises/concept/poetry-club/Tests/LinuxMain.swift delete mode 100644 exercises/concept/poetry-club/Tests/PoetryClubTests/XCTestManifests.swift delete mode 100644 exercises/concept/santas-helper/Tests/LinuxMain.swift delete mode 100644 exercises/concept/santas-helper/Tests/SantasHelperTests/XCTestManifests.swift delete mode 100644 exercises/concept/secret-agent/Tests/LinuxMain.swift delete mode 100644 exercises/concept/secret-agent/Tests/SecretAgentTests/XCTestManifests.swift delete mode 100644 exercises/concept/windowing-system/Tests/LinuxMain.swift delete mode 100644 exercises/concept/windowing-system/Tests/WindowingSystemTests/XCTestManifests.swift diff --git a/exercises/concept/bomb-defuser/.meta/Sources/BombDefuser/BombDefuserExemplar.swift b/exercises/concept/bomb-defuser/.meta/Sources/BombDefuser/BombDefuserExemplar.swift index 63b33268f..c4ab55737 100644 --- a/exercises/concept/bomb-defuser/.meta/Sources/BombDefuser/BombDefuserExemplar.swift +++ b/exercises/concept/bomb-defuser/.meta/Sources/BombDefuser/BombDefuserExemplar.swift @@ -1,9 +1,11 @@ -let flip = { (tuple: (String, String, String)) -> (String, String, String) in +typealias RotationClosure = @Sendable ((String, String, String)) -> (String, String, String) + +let flip: RotationClosure = { (tuple: (String, String, String)) -> (String, String, String) in let (a, b, c) = tuple return (b, a, c) } -let rotate = { (tuple: (String, String, String)) -> (String, String, String) in +let rotate: RotationClosure = { (tuple: (String, String, String)) -> (String, String, String) in let (a, b, c) = tuple return (b, c, a) } diff --git a/exercises/concept/bomb-defuser/Tests/BombDefuserTests/BombDefuserTests.swift b/exercises/concept/bomb-defuser/Tests/BombDefuserTests/BombDefuserTests.swift index 207d830ad..4a242a8f7 100644 --- a/exercises/concept/bomb-defuser/Tests/BombDefuserTests/BombDefuserTests.swift +++ b/exercises/concept/bomb-defuser/Tests/BombDefuserTests/BombDefuserTests.swift @@ -55,12 +55,4 @@ final class BombDefuserTests: XCTestCase { stringify(expected), stringify(got), "shuffle(0, (\"Brown\", \"Orange\", \"White\")): Expected \(expected), got \(got)") } - - static var allTests = [ - ("testFlip", testFlip), - ("testRotate", testRotate), - ("testShuffle1", testShuffle1), - ("testShuffle2", testShuffle2), - ("testShuffle3", testShuffle3), - ] } diff --git a/exercises/concept/bomb-defuser/Tests/BombDefuserTests/XCTestManifests.swift b/exercises/concept/bomb-defuser/Tests/BombDefuserTests/XCTestManifests.swift deleted file mode 100644 index 4f3db4589..000000000 --- a/exercises/concept/bomb-defuser/Tests/BombDefuserTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(BombDefuserTests.allTests) - ] - } -#endif diff --git a/exercises/concept/bomb-defuser/Tests/LinuxMain.swift b/exercises/concept/bomb-defuser/Tests/LinuxMain.swift deleted file mode 100644 index e46f25037..000000000 --- a/exercises/concept/bomb-defuser/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import BombDefuserTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += BombDefuserTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/high-score-board/Tests/HighScoreBoardTests/HighScoreBoardTests.swift b/exercises/concept/high-score-board/Tests/HighScoreBoardTests/HighScoreBoardTests.swift index 041184094..40625c84a 100644 --- a/exercises/concept/high-score-board/Tests/HighScoreBoardTests/HighScoreBoardTests.swift +++ b/exercises/concept/high-score-board/Tests/HighScoreBoardTests/HighScoreBoardTests.swift @@ -140,16 +140,4 @@ final class HighScoreBoardTests: XCTestCase { "Expected: \(expected)\nGot: \(got)\norderByPlayers should return the key/value pairs odered ascending by the player's score." ) } - - static var allTests = [ - ("testEmptyScores", testEmptyScores), - ("testAddPlayerExplicit", testAddPlayerExplicit), - ("testAddPlayerDefault", testAddPlayerDefault), - ("testRemovePlayer", testRemovePlayer), - ("testRemoveNonexistentPlayer", testRemoveNonexistentPlayer), - ("testResetScore", testResetScore), - ("testUpdateScore", testUpdateScore), - ("testOrderByPlayers", testOrderByPlayers), - ("testOrderByScores", testOrderByScores), - ] } diff --git a/exercises/concept/high-score-board/Tests/HighScoreBoardTests/XCTestManifests.swift b/exercises/concept/high-score-board/Tests/HighScoreBoardTests/XCTestManifests.swift deleted file mode 100644 index 27fdffe3a..000000000 --- a/exercises/concept/high-score-board/Tests/HighScoreBoardTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(HighScoreBoardTests.allTests) - ] - } -#endif diff --git a/exercises/concept/high-score-board/Tests/LinuxMain.swift b/exercises/concept/high-score-board/Tests/LinuxMain.swift deleted file mode 100644 index a05b76cc1..000000000 --- a/exercises/concept/high-score-board/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import HighScoreBoardTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += HighScoreBoardTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/lasagna-master/Tests/LasagnaMasterTests/LasagnaMasterTests.swift b/exercises/concept/lasagna-master/Tests/LasagnaMasterTests/LasagnaMasterTests.swift index 30d17de50..d3996f123 100644 --- a/exercises/concept/lasagna-master/Tests/LasagnaMasterTests/LasagnaMasterTests.swift +++ b/exercises/concept/lasagna-master/Tests/LasagnaMasterTests/LasagnaMasterTests.swift @@ -81,18 +81,4 @@ final class LasagnaMasterTests: XCTestCase { layers: "sauce", "noodles", "béchamel", "meat", "mozzarella", "noodles", "sauce", "ricotta", "eggplant", "mozzarella", "béchamel", "noodles", "meat", "sauce", "mozzarella")) } - - static var allTests = [ - ("testRemainingMinutesExplicit", testRemainingMinutesExplicit), - ("testRemainingMinutesDefault", testRemainingMinutesDefault), - ("testPreparationTime", testPreparationTime), - ("testPreparationTimeEmpty", testPreparationTimeEmpty), - ("testQuantities", testQuantities), - ("testQuantitiesNoSauce", testQuantitiesNoSauce), - ("testQuantitiesNoNoodles", testQuantitiesNoNoodles), - ("testToOz", testToOz), - ("testRedWineRedInequalLayerCount", testRedWineRedInequalLayerCount), - ("testRedWineRedEqualLayerCount", testRedWineRedEqualLayerCount), - ("testRedWineWhite", testRedWineWhite), - ] } diff --git a/exercises/concept/lasagna-master/Tests/LasagnaMasterTests/XCTestManifests.swift b/exercises/concept/lasagna-master/Tests/LasagnaMasterTests/XCTestManifests.swift deleted file mode 100644 index 86ffcbced..000000000 --- a/exercises/concept/lasagna-master/Tests/LasagnaMasterTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(LasagnaMasterTests.allTests) - ] - } -#endif diff --git a/exercises/concept/lasagna-master/Tests/LinuxMain.swift b/exercises/concept/lasagna-master/Tests/LinuxMain.swift deleted file mode 100644 index 5b59f7b4d..000000000 --- a/exercises/concept/lasagna-master/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import LasagnaMasterTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += LasagnaMasterTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/log-lines/Tests/LinuxMain.swift b/exercises/concept/log-lines/Tests/LinuxMain.swift deleted file mode 100644 index 2c9cdfc78..000000000 --- a/exercises/concept/log-lines/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import LogLinesTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += LogLinesTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/log-lines/Tests/LogLinesTests/LogLinesTests.swift b/exercises/concept/log-lines/Tests/LogLinesTests/LogLinesTests.swift index a99521299..0276c4a95 100644 --- a/exercises/concept/log-lines/Tests/LogLinesTests/LogLinesTests.swift +++ b/exercises/concept/log-lines/Tests/LogLinesTests/LogLinesTests.swift @@ -95,22 +95,4 @@ final class LogLinesTests: XCTestCase { let message = "Wha happon?" XCTAssertEqual(LogLevel.unknown.shortFormat(message: message), "42:Wha happon?") } - - static var allTests = [ - ("testInitTrace", testInitTrace), - ("testInitDebug", testInitDebug), - ("testInitInfo", testInitInfo), - ("testInitWarning", testInitWarning), - ("testInitError", testInitError), - ("testInitFatal", testInitFatal), - ("testInitUnknownEmpty", testInitUnknownEmpty), - ("testInitUnknownNonStandard", testInitUnknownNonStandard), - ("testShortTrace", testShortTrace), - ("testShortDebug", testShortDebug), - ("testShortInfo", testShortInfo), - ("testShortWarning", testShortWarning), - ("testShortError", testShortError), - ("testShortFatal", testShortFatal), - ("testShortUnknownEmpty", testShortUnknownEmpty), - ] } diff --git a/exercises/concept/log-lines/Tests/LogLinesTests/XCTestManifests.swift b/exercises/concept/log-lines/Tests/LogLinesTests/XCTestManifests.swift deleted file mode 100644 index 2b5cb9ee5..000000000 --- a/exercises/concept/log-lines/Tests/LogLinesTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(LogLinesTests.allTests) - ] - } -#endif diff --git a/exercises/concept/magician-in-training/Tests/LinuxMain.swift b/exercises/concept/magician-in-training/Tests/LinuxMain.swift deleted file mode 100644 index 4e9800ff5..000000000 --- a/exercises/concept/magician-in-training/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import MagicianInTrainingTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += MagicianInTrainingTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/XCTestManifests.swift b/exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/XCTestManifests.swift deleted file mode 100644 index b1ebd20f7..000000000 --- a/exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(MagicianInTrainingTests.allTests) - ] - } -#endif diff --git a/exercises/concept/master-mixologist/Tests/LinuxMain.swift b/exercises/concept/master-mixologist/Tests/LinuxMain.swift deleted file mode 100644 index 038543cb7..000000000 --- a/exercises/concept/master-mixologist/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import MasterMixologistTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += MasterMixologistTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/master-mixologist/Tests/MasterMixologistTests/MasterMixologistTests.swift b/exercises/concept/master-mixologist/Tests/MasterMixologistTests/MasterMixologistTests.swift index ef2b59e43..ff87b68ca 100644 --- a/exercises/concept/master-mixologist/Tests/MasterMixologistTests/MasterMixologistTests.swift +++ b/exercises/concept/master-mixologist/Tests/MasterMixologistTests/MasterMixologistTests.swift @@ -153,20 +153,4 @@ final class MasterMixologistTests: XCTestCase { checkTest(e: expectedBeers, g: got.beer) && checkTest(e: expectedSodas, g: got.soda), "Expected (beer: nil, soda: nil), got: \(got)") } - - static var allTests = [ - ("testTimeToPrepare", testTimeToPrepare), - ("testMakeWedges", testMakeWedges), - ("testMakeWedgesNoNeed", testMakeWedgesNoNeed), - ("testMakeWedgesNoLimes", testMakeWedgesNoLimes), - ("testMakeWedgesTooFewLimes", testMakeWedgesTooFewLimes), - ("testFinishShift", testFinishShift), - ("testFinishShiftJustRunOver", testFinishShiftJustRunOver), - ("testFinishShiftLeaveEarly", testFinishShiftLeaveEarly), - ("testOrderTracker", testOrderTracker), - ("testOrderOneEach", testOrderOneEach), - ("testOrderTrackerNoBeer", testOrderTrackerNoBeer), - ("testOrderTrackerNoSoda", testOrderTrackerNoSoda), - ("testOrderTrackerNils", testOrderTrackerNils), - ] } diff --git a/exercises/concept/master-mixologist/Tests/MasterMixologistTests/XCTestManifests.swift b/exercises/concept/master-mixologist/Tests/MasterMixologistTests/XCTestManifests.swift deleted file mode 100644 index 5c4947c8d..000000000 --- a/exercises/concept/master-mixologist/Tests/MasterMixologistTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(MasterMixologistTests.allTests) - ] - } -#endif diff --git a/exercises/concept/pizza-slices/Tests/LinuxMain.swift b/exercises/concept/pizza-slices/Tests/LinuxMain.swift deleted file mode 100644 index 2d46426d6..000000000 --- a/exercises/concept/pizza-slices/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import PizzaSlicesTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += PizzaSlicesTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/pizza-slices/Tests/PizzaSlicesTests/PizzaSlicesTests.swift b/exercises/concept/pizza-slices/Tests/PizzaSlicesTests/PizzaSlicesTests.swift index 4f7e918d3..3a0475c2d 100644 --- a/exercises/concept/pizza-slices/Tests/PizzaSlicesTests/PizzaSlicesTests.swift +++ b/exercises/concept/pizza-slices/Tests/PizzaSlicesTests/PizzaSlicesTests.swift @@ -71,19 +71,4 @@ final class PizzaSlicesTests: XCTestCase { let biggest = biggestSlice(diameterA: "0", slicesA: "8", diameterB: "16 inches", slicesB: "8") XCTAssertEqual(biggest, "Slice A is bigger") } - - static var allTests = [ - ("testSliceNormal", testSliceNormal), - ("testSliceNilDiameter", testSliceNilDiameter), - ("testSliceNilSlices", testSliceNilSlices), - ("testSliceBadDiameter", testSliceBadDiameter), - ("testSliceBadSlices", testSliceBadSlices), - ("testABiggest", testABiggest), - ("testBBiggest", testBBiggest), - ("testBothSame", testBothSame), - ("testANil", testANil), - ("testBNil", testBNil), - ("testBothNil", testBothNil), - ("testZeroIsValid", testZeroIsValid), - ] } diff --git a/exercises/concept/pizza-slices/Tests/PizzaSlicesTests/XCTestManifests.swift b/exercises/concept/pizza-slices/Tests/PizzaSlicesTests/XCTestManifests.swift deleted file mode 100644 index a37a77a60..000000000 --- a/exercises/concept/pizza-slices/Tests/PizzaSlicesTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(PizzaSlicesTests.allTests) - ] - } -#endif diff --git a/exercises/concept/poetry-club/Tests/LinuxMain.swift b/exercises/concept/poetry-club/Tests/LinuxMain.swift deleted file mode 100644 index 32c4ce62f..000000000 --- a/exercises/concept/poetry-club/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import PoetryClubTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += PoetryClubTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/poetry-club/Tests/PoetryClubTests/PoetryClubTests.swift b/exercises/concept/poetry-club/Tests/PoetryClubTests/PoetryClubTests.swift index e77d69c1c..433168cdb 100644 --- a/exercises/concept/poetry-club/Tests/PoetryClubTests/PoetryClubTests.swift +++ b/exercises/concept/poetry-club/Tests/PoetryClubTests/PoetryClubTests.swift @@ -79,20 +79,4 @@ final class PoetryClubTests: XCTestCase { try XCTSkipIf(true && !runAll) // change true to false to run this test XCTAssertEqual(secretRoomPassword("Open Sesame"), "OPEN SESAME!") } - - static var allTests = [ - ("testSplitNewlines", testSplitNewlines), - ("testSplitNoNewlines", testSplitNoNewlines), - ("testFirstLetter", testFirstLetter), - ("testFirstLetterEmpty", testFirstLetterEmpty), - ("testCapitalize", testCapitalize), - ("testTrimWithWhitespace", testTrimWithWhitespace), - ("testTrimWithoutWhitespace", testTrimWithoutWhitespace), - ("testLastLetter", testLastLetter), - ("testLastLetterEmpty", testLastLetterEmpty), - ("testBackdoorPassword", testBackdoorPassword), - ("testIthLetter", testIthLetter), - ("testIthLetterInvalid", testIthLetterInvalid), - ("testSecretRoomPassword", testSecretRoomPassword), - ] } diff --git a/exercises/concept/poetry-club/Tests/PoetryClubTests/XCTestManifests.swift b/exercises/concept/poetry-club/Tests/PoetryClubTests/XCTestManifests.swift deleted file mode 100644 index 1c316f6b3..000000000 --- a/exercises/concept/poetry-club/Tests/PoetryClubTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(PoetryClubTests.allTests) - ] - } -#endif diff --git a/exercises/concept/santas-helper/Tests/LinuxMain.swift b/exercises/concept/santas-helper/Tests/LinuxMain.swift deleted file mode 100644 index ea1c942fd..000000000 --- a/exercises/concept/santas-helper/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import SantasHelperTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += SantasHelperTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/santas-helper/Tests/SantasHelperTests/SantasHelperTests.swift b/exercises/concept/santas-helper/Tests/SantasHelperTests/SantasHelperTests.swift index d9507134f..1b7f17049 100644 --- a/exercises/concept/santas-helper/Tests/SantasHelperTests/SantasHelperTests.swift +++ b/exercises/concept/santas-helper/Tests/SantasHelperTests/SantasHelperTests.swift @@ -47,9 +47,4 @@ final class SantasHelperTests: XCTestCase { && actual.recipients == recipients ) } - static var allTests = [ - ("testCartesianToPolar", testCartesianToPolar), - ("testCartesianToPolarQ3", testCartesianToPolarQ3), - ("testCombineRecords", testCombineRecords), - ] } diff --git a/exercises/concept/santas-helper/Tests/SantasHelperTests/XCTestManifests.swift b/exercises/concept/santas-helper/Tests/SantasHelperTests/XCTestManifests.swift deleted file mode 100644 index b397e4869..000000000 --- a/exercises/concept/santas-helper/Tests/SantasHelperTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(SantasHelperTests.allTests) - ] - } -#endif diff --git a/exercises/concept/secret-agent/Tests/LinuxMain.swift b/exercises/concept/secret-agent/Tests/LinuxMain.swift deleted file mode 100644 index 75e8a0f09..000000000 --- a/exercises/concept/secret-agent/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import SecretAgentTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += SecretAgentTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/secret-agent/Tests/SecretAgentTests/SecretAgentTests.swift b/exercises/concept/secret-agent/Tests/SecretAgentTests/SecretAgentTests.swift index dd0a25c96..407a962ad 100644 --- a/exercises/concept/secret-agent/Tests/SecretAgentTests/SecretAgentTests.swift +++ b/exercises/concept/secret-agent/Tests/SecretAgentTests/SecretAgentTests.swift @@ -34,11 +34,4 @@ final class SecretAgentTests: XCTestCase { }) XCTAssertTrue(combo == (234, 91, 148)) } - - static var allTests = [ - ("testPasswordSuccess", testPasswordSuccess), - ("testPasswordFail", testPasswordFail), - ("testCombination1", testCombination1), - ("testCombination2", testCombination2), - ] } diff --git a/exercises/concept/secret-agent/Tests/SecretAgentTests/XCTestManifests.swift b/exercises/concept/secret-agent/Tests/SecretAgentTests/XCTestManifests.swift deleted file mode 100644 index 904c816d8..000000000 --- a/exercises/concept/secret-agent/Tests/SecretAgentTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(SecretAgentTests.allTests) - ] - } -#endif diff --git a/exercises/concept/windowing-system/.meta/Sources/WindowingSystem/WindowingSystemExemplar.swift b/exercises/concept/windowing-system/.meta/Sources/WindowingSystem/WindowingSystemExemplar.swift index fc46fe84b..6cc4a2946 100644 --- a/exercises/concept/windowing-system/.meta/Sources/WindowingSystem/WindowingSystemExemplar.swift +++ b/exercises/concept/windowing-system/.meta/Sources/WindowingSystem/WindowingSystemExemplar.swift @@ -18,7 +18,7 @@ struct Size { } } -class Window { +class Window: @unchecked Sendable { var title = "New Window" let screenSize = Size(width: 800, height: 600) var size = Size() diff --git a/exercises/concept/windowing-system/Tests/LinuxMain.swift b/exercises/concept/windowing-system/Tests/LinuxMain.swift deleted file mode 100644 index d70d97404..000000000 --- a/exercises/concept/windowing-system/Tests/LinuxMain.swift +++ /dev/null @@ -1,6 +0,0 @@ -import WindowingSystemTests -import XCTest - -var tests = [XCTestCaseEntry]() -tests += WindowingSystemTests.allTests() -XCTMain(tests) diff --git a/exercises/concept/windowing-system/Tests/WindowingSystemTests/WindowingSystemTests.swift b/exercises/concept/windowing-system/Tests/WindowingSystemTests/WindowingSystemTests.swift index 2c7c875f3..dc590a428 100644 --- a/exercises/concept/windowing-system/Tests/WindowingSystemTests/WindowingSystemTests.swift +++ b/exercises/concept/windowing-system/Tests/WindowingSystemTests/WindowingSystemTests.swift @@ -158,18 +158,4 @@ final class WindowingSystemTests: XCTestCase { window.display(), "New Window\nPosition: (0, 0), Size: (80 x 60)\n[This window intentionally left blank]\n") } - - static var allTests = [ - ("testNewWindow", testNewWindow), - ("testMainWindow", testMainWindow), - ("testMoveValid", testMoveValid), - ("testMoveTooFar", testMoveTooFar), - ("testMoveNegative", testMoveNegative), - ("testResizeValid", testResizeValid), - ("testResizeTooFar", testResizeTooFar), - ("testResizeNegative", testResizeNegative), - ("testUpdateTitle", testUpdateTitle), - ("testUpdateText", testUpdateText), - ("testUpdateTextNil", testUpdateTextNil), - ] } diff --git a/exercises/concept/windowing-system/Tests/WindowingSystemTests/XCTestManifests.swift b/exercises/concept/windowing-system/Tests/WindowingSystemTests/XCTestManifests.swift deleted file mode 100644 index 73d76229e..000000000 --- a/exercises/concept/windowing-system/Tests/WindowingSystemTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) - public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(WindowingSystemTests.allTests) - ] - } -#endif From 4394b310ec7e8cb0f20989b612577131ed52dbe7 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Wed, 25 Dec 2024 23:20:49 +0100 Subject: [PATCH 5/8] Remove redundant test cases from MagicianInTrainingTests (#814) --- .../MagicianInTrainingTests.swift | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/MagicianInTrainingTests.swift b/exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/MagicianInTrainingTests.swift index fefb02a97..f5bd8d04f 100644 --- a/exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/MagicianInTrainingTests.swift +++ b/exercises/concept/magician-in-training/Tests/MagicianInTrainingTests/MagicianInTrainingTests.swift @@ -112,24 +112,4 @@ final class MagicianInTrainingTests: XCTestCase { let stack = [7, 3, 7, 1, 5, 5, 3, 9, 9] XCTAssertEqual(evenCardCount(stack), 0) } - - static var allTests = [ - ("testGetCard", testGetCard), - ("testSetCard", testSetCard), - ("testSetCardIndexTooLow", testSetCardIndexTooLow), - ("testSetCardIndexTooHigh", testSetCardIndexTooHigh), - ("testInsertAtTop", testInsertAtTop), - ("testRemoveCard", testRemoveCard), - ("testRemoveCardIndexTooLow", testRemoveCardIndexTooLow), - ("testRemoveCardIndexTooHigh", testRemoveCardIndexTooHigh), - ("testRemoveTopCard", testRemoveTopCard), - ("testRemoveTopCardFromEmptyStack", testRemoveTopCardFromEmptyStack), - ("testInsertAtBottom", testInsertAtBottom), - ("testRemoveBottomCard", testRemoveBottomCard), - ("testRemoveBottomCardFromEmptyStack", testRemoveBottomCardFromEmptyStack), - ("testCheckSizeTrue", testCheckSizeTrue), - ("testCheckSizeFalse", testCheckSizeFalse), - ("testEvenCardCount", testEvenCardCount), - ("testEvenCardCountZero", testEvenCardCountZero), - ] } From 3c461689f67db24f5fee3e6d911a0bd969999775 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Wed, 25 Dec 2024 23:30:27 +0100 Subject: [PATCH 6/8] Update generator to swift 6.0 (#782) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update generator to swift 6.0 * Use beta versio * Update to use swift 6 formatter * Remove macos version mention * Set minimum macOS version to 12 in Package.swift * Sync branch (#809) * Sync docs and metadata (#771) * Bump actions/checkout from 4.1.7 to 4.2.0 (#772) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/692973e3d937129bcbf40652eb9f2f61becf3332...d632683dd7b4114ad314bca15554477dd762a938) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix avogadro constant (#777) * Update about.md (#778) * Update about.md Fix word-choice error. * Also make fixes in concept:numbers:introduction.md and exercises:freelancer-rates:introduction.md * Fix `NESButtons` typo (#779) * Fix `NESButtons` typo Just a little typo in the enum name. * fix other mentions of `NESButtons` * Bump actions/checkout from 4.2.0 to 4.2.2 (#775) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...11bd71901bbe5b1630ceea73d27597364c9af683) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [New Exercise]: Armstrong Numbers (#708) * Add Armstrong Numbers exercise * Add author * [Armstrong number]: Fix formatting (#783) * Fix formatting * Fix * [New Exercise]: Darts (#707) * Add Darts exercise * Add author * Fix * Sync exercise to problem spec * Update CI configuration and add Swift Numerics dependency (#806) * Update CI configuration and add Swift Numerics dependency * Check if swift6 is available in macos 15 --------- Signed-off-by: dependabot[bot] Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver * Remove uneeded import * Sync (#813) * Sync docs and metadata (#771) * Bump actions/checkout from 4.1.7 to 4.2.0 (#772) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/692973e3d937129bcbf40652eb9f2f61becf3332...d632683dd7b4114ad314bca15554477dd762a938) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix avogadro constant (#777) * Update about.md (#778) * Update about.md Fix word-choice error. * Also make fixes in concept:numbers:introduction.md and exercises:freelancer-rates:introduction.md * Fix `NESButtons` typo (#779) * Fix `NESButtons` typo Just a little typo in the enum name. * fix other mentions of `NESButtons` * Bump actions/checkout from 4.2.0 to 4.2.2 (#775) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...11bd71901bbe5b1630ceea73d27597364c9af683) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [New Exercise]: Armstrong Numbers (#708) * Add Armstrong Numbers exercise * Add author * [Armstrong number]: Fix formatting (#783) * Fix formatting * Fix * [New Exercise]: Darts (#707) * Add Darts exercise * Add author * Fix * Sync exercise to problem spec * Update CI configuration and add Swift Numerics dependency (#806) * Update CI configuration and add Swift Numerics dependency * Check if swift6 is available in macos 15 * Remove obsolete LinuxMain.swift and XCTestManifests.swift files from various exercises (#812) --------- Signed-off-by: dependabot[bot] Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver * Sync (#815) * Sync docs and metadata (#771) * Bump actions/checkout from 4.1.7 to 4.2.0 (#772) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/692973e3d937129bcbf40652eb9f2f61becf3332...d632683dd7b4114ad314bca15554477dd762a938) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix avogadro constant (#777) * Update about.md (#778) * Update about.md Fix word-choice error. * Also make fixes in concept:numbers:introduction.md and exercises:freelancer-rates:introduction.md * Fix `NESButtons` typo (#779) * Fix `NESButtons` typo Just a little typo in the enum name. * fix other mentions of `NESButtons` * Bump actions/checkout from 4.2.0 to 4.2.2 (#775) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...11bd71901bbe5b1630ceea73d27597364c9af683) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [New Exercise]: Armstrong Numbers (#708) * Add Armstrong Numbers exercise * Add author * [Armstrong number]: Fix formatting (#783) * Fix formatting * Fix * [New Exercise]: Darts (#707) * Add Darts exercise * Add author * Fix * Sync exercise to problem spec * Update CI configuration and add Swift Numerics dependency (#806) * Update CI configuration and add Swift Numerics dependency * Check if swift6 is available in macos 15 * Remove obsolete LinuxMain.swift and XCTestManifests.swift files from various exercises (#812) * Remove redundant test cases from MagicianInTrainingTests (#814) --------- Signed-off-by: dependabot[bot] Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver --------- Signed-off-by: dependabot[bot] Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Shaver --- .github/workflows/ci.yml | 4 +- Package.swift | 2 +- generator/Package.swift | 4 +- .../Sources/Generator/generator-help.swift | 2 +- generator/Sources/Generator/main.swift | 3 +- .../Tests/GeneratorTests/GeneratorTests.swift | 41 ++++++++++--------- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 865e0abae..eb0214761 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - name: Run tests run: swift test generator-tests: - runs-on: macos-13 + runs-on: macos-15 env: RUNALL: "true" steps: @@ -28,7 +28,7 @@ jobs: - name: Run tests run: swift test --package-path ./generator generator-template-tests: - runs-on: macos-13 + runs-on: macos-15 steps: - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 diff --git a/Package.swift b/Package.swift index 4002074ad..c566f2b74 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:6.0 import PackageDescription import Foundation diff --git a/generator/Package.swift b/generator/Package.swift index 318d64f6c..63701123f 100644 --- a/generator/Package.swift +++ b/generator/Package.swift @@ -6,12 +6,12 @@ import PackageDescription let package = Package( name: "Generator", platforms: [ - .macOS(.v10_15) // Set the minimum macOS version to 10.15 or any version greater than 10.15. + .macOS(.v12) // Set the minimum macOS version to 10.15 or any version greater than 10.15. ], dependencies: [ .package(url: "https://github.com/stencilproject/Stencil.git", from: "0.15.1"), .package(url: "https://github.com/LebJe/TOMLKit.git", from: "0.5.5"), - .package(url: "https://github.com/apple/swift-format", from: "508.0.1"), + .package(url: "https://github.com/apple/swift-format", from: "600.0.0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/generator/Sources/Generator/generator-help.swift b/generator/Sources/Generator/generator-help.swift index 76c19e46b..0c3aa21d8 100644 --- a/generator/Sources/Generator/generator-help.swift +++ b/generator/Sources/Generator/generator-help.swift @@ -25,7 +25,7 @@ class GeneratorHelp { } catch { throw GeneratorError.remoteError("No remote file found") } - let data = try String(contentsOf: url) ?? "" + let data = try String(contentsOf: url, encoding: .utf8) let fileData = Data(data.utf8) json = try JSONSerialization.jsonObject(with: fileData, options: []) as? [String: Any] ?? [:] } diff --git a/generator/Sources/Generator/main.swift b/generator/Sources/Generator/main.swift index b5db548dc..3134ba795 100644 --- a/generator/Sources/Generator/main.swift +++ b/generator/Sources/Generator/main.swift @@ -1,7 +1,6 @@ import Foundation import Stencil import SwiftFormat -import SwiftFormatConfiguration enum GeneratorError: Error { case invalidArgumentCount @@ -42,7 +41,7 @@ class Generator { var text = "" let configuration = Configuration() let swiftFormat = SwiftFormatter(configuration: configuration) - try swiftFormat.format(source: template, assumingFileURL: nil, to: &text) + try swiftFormat.format(source: template, assumingFileURL: nil, selection: .infinite, to: &text) try text.write(toFile: path, atomically: true, encoding: .utf8) } diff --git a/generator/Tests/GeneratorTests/GeneratorTests.swift b/generator/Tests/GeneratorTests/GeneratorTests.swift index 6909c9a16..26da747c0 100644 --- a/generator/Tests/GeneratorTests/GeneratorTests.swift +++ b/generator/Tests/GeneratorTests/GeneratorTests.swift @@ -1,25 +1,26 @@ -import XCTest +import Testing @testable import Generator -class GeneratorTests: XCTestCase { - func testAllTestsIncluded() { - let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-tests-included") - XCTAssertNoThrow(try generatorHelp.toml()) - let expected = ["1cf3e15a-a3d7-4a87-aeb3-ba1b43bc8dce", "3549048d-1a6e-4653-9a79-b0bda163e8d5", "b4c6dbb8-b4fb-42c2-bafd-10785abe7709"] - XCTAssertEqual(generatorHelp.uuids, expected) - } +@Test("Testing having all tests be included") +func testAllTestsIncluded() { + let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-tests-included") + #expect(throws: Never.self) {try generatorHelp.toml()} + let expected = ["1cf3e15a-a3d7-4a87-aeb3-ba1b43bc8dce", "3549048d-1a6e-4653-9a79-b0bda163e8d5", "b4c6dbb8-b4fb-42c2-bafd-10785abe7709"] + #expect(generatorHelp.uuids == expected) +} - func testAllTestsRemoved() { - let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-test-removed") - XCTAssertNoThrow(try generatorHelp.toml()) - let expected: [String] = [] - XCTAssertEqual(generatorHelp.uuids, expected) - } +@Test("Testing having all tests be removed") +func testAllTestsRemoved() { + let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/all-test-removed") + #expect(throws: Never.self) {try generatorHelp.toml()} + let expected: [String] = [] + #expect(generatorHelp.uuids == expected) +} - func testTwoTestsRemoved() { - let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/two-tests-removed") - XCTAssertNoThrow(try generatorHelp.toml()) - let expected = ["b4c6dbb8-b4fb-42c2-bafd-10785abe7709"] - XCTAssertEqual(generatorHelp.uuids, expected) - } +@Test("Testing having two tests be removed") +func testTwoTestsRemoved() { + let generatorHelp = GeneratorHelp(exercise: "two-fer", filePath: "./Tests/GeneratorTests/files/two-tests-removed") + #expect(throws: Never.self) {try generatorHelp.toml()} + let expected = ["b4c6dbb8-b4fb-42c2-bafd-10785abe7709"] + #expect(generatorHelp.uuids == expected) } From 4796c577ad23c8c62b24477b46a8efff86313a81 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Mon, 30 Dec 2024 22:02:07 +0100 Subject: [PATCH 7/8] Remove implementation of Matrix struct and add exercise placeholder (#819) --- .../matrix/Sources/Matrix/Matrix.swift | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/exercises/practice/matrix/Sources/Matrix/Matrix.swift b/exercises/practice/matrix/Sources/Matrix/Matrix.swift index 78bc9bcf7..0f71a9cbd 100644 --- a/exercises/practice/matrix/Sources/Matrix/Matrix.swift +++ b/exercises/practice/matrix/Sources/Matrix/Matrix.swift @@ -1,27 +1,3 @@ struct Matrix { - - let rows: [[Int]] - let columns: [[Int]] - - init(_ stringRepresentation: String) { - var rows = [[Int]]() - var columns = [[Int]]() - - let rowItems = stringRepresentation.split(separator: "\n") - for item in rowItems { - let elements = item.split(separator: " ").compactMap { Int(String($0)) } - rows.append(elements) - } - for i in 0.. Date: Tue, 31 Dec 2024 16:22:50 +0100 Subject: [PATCH 8/8] Update vehicle purchase instructions to be more clear (#820) * Update vehicle purchase instructions to be more cleaar * Fix * Update wording --- exercises/concept/vehicle-purchase/.docs/instructions.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exercises/concept/vehicle-purchase/.docs/instructions.md b/exercises/concept/vehicle-purchase/.docs/instructions.md index f9e937cfa..72605a19d 100644 --- a/exercises/concept/vehicle-purchase/.docs/instructions.md +++ b/exercises/concept/vehicle-purchase/.docs/instructions.md @@ -9,15 +9,17 @@ You have three tasks, one to determine if you will need one to help you choose b The auto dealers in your town are all running a five year, 0% interest promotion that you would like to take advantage of. But you are not sure if you can afford the monthly payments on the car you want. +The monthly payment is the cars total price divided by the number of months under the five year period. + Implement the `canIBuy(vehicle:price:monthlyBudget:)` function that takes the following arguments: - `vehicle` - The name of the vehicle you want to buy. - `price` - The price of the vehicle you want to buy. - `monthlyBudget` - The amount of money you can afford to pay each month. The function should return the following message based on the following conditions: -- If the price of the vehicle is less than or equal to the monthly budget, return the message `"Yes! I'm getting a "`. -- If the price of the vehicle is 10% above your monthly budget, return the message `"I'll have to be frugal if I want a "`. -- If the price of the vehicle is more than 10% above your monthly budget, return the message `"Darn! No for me"`. +- If the monthly payment of the vehicle is less than or equal to the monthly budget, return the message `"Yes! I'm getting a "`. +- If the monthly payment of the vehicle is above your monthly budget by up to 10% (inclusive), return the message `"I'll have to be frugal if I want a "`. +- If the monthly payment of the vehicle is more than 10% above your monthly budget, return the message `"Darn! No for me"`. ```swift canIBuy(vehicle: "1974 Ford Pinto", price: 516.32, monthlyBudget: 100.00)