Skip to content

Commit

Permalink
Merge branch 'main' into add-eliuds-eggs
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored May 22, 2024
2 parents fba4343 + cb76145 commit 5c0d84f
Show file tree
Hide file tree
Showing 191 changed files with 4,367 additions and 3,590 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
- name: Automatic Rebase
uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691
env:
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/exercise-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ jobs:
fail-fast: false
matrix:
julia-version: ["1.6", "1", nightly]
os: [ubuntu-22.04, windows-2022, macOS-latest]
os: [ubuntu-22.04, windows-2022, macos-14]
exclude:
- julia-version: 1.6
os: macos-14

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29

- uses: julia-actions/setup-julia@f40c4b69330df1d22e7590c12e76dc2f9c66e0bc
- uses: julia-actions/setup-julia@f2258781c657ad9b4b88072c5eeaf9ec8c370874
with:
version: ${{ matrix.julia-version }}

- uses: julia-actions/cache@569d290d51d6c22c1cd4ceec591a1bf112aab9c0
- uses: julia-actions/cache@d48542bb7b6239a9391789f01d21a6bdde9ad5df

- name: Install test dependencies
run: julia --color=yes --project -e "using Pkg; Pkg.instantiate()"
Expand All @@ -45,20 +48,20 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29

- name: Pull julia-test-runner image
run: docker pull exercism/julia-test-runner

- name: Install Julia dependencies
run: julia --color=yes --project -e "using Pkg; Pkg.instantiate()"

- name: Generate test reports using julia-test-runner
id: generate-reports
run: julia --color=yes --project runtestrunner.jl

- name: Upload reports as artifact
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: test-reports
path: ${{ steps.generate-reports.outputs.results-path }}
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/no-important-files-changed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: No important files changed

on:
pull_request_target:
types: [opened]
branches: [main]
paths:
- "exercises/concept/**"
- "exercises/practice/**"
- "!exercises/*/*/.approaches/**"
- "!exercises/*/*/.articles/**"
- "!exercises/*/*/.docs/**"
- "!exercises/*/*/.meta/**"

permissions:
pull-requests: write

jobs:
check:
uses: exercism/github-actions/.github/workflows/check-no-important-files-changed.yml@main
with:
repository: ${{ github.event.pull_request.head.repo.owner.login }}/${{ github.event.pull_request.head.repo.name }}
ref: ${{ github.head_ref }}
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ This policy was initially adopted from the Front-end London Slack community and
A version history can be seen on [GitHub](https://github.com/exercism/website-copy/edit/main/pages/code_of_conduct.md).

_This policy is a "living" document, and subject to refinement and expansion in the future.
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Slack, Twitter, email) and any other Exercism entity or event._
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Discord, Forum, Twitter, email) and any other Exercism entity or event._

## Addendum

Expand Down
24 changes: 24 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,14 @@
"unicode"
]
},
{
"slug": "resistor-color",
"name": "Resistor Color",
"uuid": "ef7e22db-1f66-4d44-87f9-23d97f794628",
"practices": [],
"prerequisites": [],
"difficulty": 1
},
{
"slug": "resistor-color-trio",
"name": "Resistor Color Trio",
Expand Down Expand Up @@ -881,6 +889,22 @@
"practices": [],
"prerequisites": [],
"difficulty": 1
},
{
"slug": "two-fer",
"name": "Two-Fer",
"uuid": "91a8a9c0-041c-4e2e-97fc-dae149ef69f9",
"practices": [],
"prerequisites": [],
"difficulty": 1
},
{
"slug": "connect",
"name": "Connect",
"uuid": "6cd9edb0-35ba-4f32-b51b-a734d98e3a88",
"practices": [],
"prerequisites": [],
"difficulty": 5
}
]
},
Expand Down
98 changes: 50 additions & 48 deletions exercises/concept.wip/annalyns-infiltration/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,63 @@ if VERSION < v"1.1"
@eval eachrow(A) = (view(A, i, :) for i in axes(A, 1))
end

@testset "fast attack" begin
@test !can_do_fast_attack(true)
@test can_do_fast_attack(false)
end
@testset verbose = true "tests" begin
@testset "fast attack" begin
@test !can_do_fast_attack(true)
@test can_do_fast_attack(false)
end

@testset "spying" begin
character_state_combinations = Bool[
0 0 0 0;
0 0 1 1;
0 1 0 1;
0 1 1 1;
1 0 0 1;
1 0 1 1;
1 1 1 1;
]
@testset "spying" begin
character_state_combinations = Bool[
0 0 0 0;
0 0 1 1;
0 1 0 1;
0 1 1 1;
1 0 0 1;
1 0 1 1;
1 1 1 1;
]

for state in eachrow(character_state_combinations)
@test can_spy(state[1:3]...) == state[4]
for state in eachrow(character_state_combinations)
@test can_spy(state[1:3]...) == state[4]
end
end
end

@testset "signaling prisoner" begin
character_state_combinations = Bool[
0 0 0;
0 1 1;
1 0 0;
1 1 0;
]
@testset "signaling prisoner" begin
character_state_combinations = Bool[
0 0 0;
0 1 1;
1 0 0;
1 1 0;
]

for state in eachrow(character_state_combinations)
@test can_signal_prisoner(state[1:2]...) == state[3]
for state in eachrow(character_state_combinations)
@test can_signal_prisoner(state[1:2]...) == state[3]
end
end
end

@testset "freeing prisoner" begin
character_state_combinations = Bool[
0 0 0 0 0;
0 0 0 1 1;
0 0 1 0 1;
0 0 1 1 1;
0 1 0 0 0;
0 1 0 1 0;
0 1 1 0 0;
0 1 1 1 0;
1 0 0 0 0;
1 0 0 1 1;
1 0 1 0 0;
1 0 1 1 1;
1 1 0 0 0;
1 1 0 1 0;
1 1 1 0 0;
1 1 1 1 0;
]
@testset "freeing prisoner" begin
character_state_combinations = Bool[
0 0 0 0 0;
0 0 0 1 1;
0 0 1 0 1;
0 0 1 1 1;
0 1 0 0 0;
0 1 0 1 0;
0 1 1 0 0;
0 1 1 1 0;
1 0 0 0 0;
1 0 0 1 1;
1 0 1 0 0;
1 0 1 1 1;
1 1 0 0 0;
1 1 0 1 0;
1 1 1 0 0;
1 1 1 1 0;
]

for state in eachrow(character_state_combinations)
@test can_free_prisoner(state[1:4]...) == state[5]
for state in eachrow(character_state_combinations)
@test can_free_prisoner(state[1:4]...) == state[5]
end
end
end
26 changes: 14 additions & 12 deletions exercises/concept.wip/annalyns-infiltration2/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ include("game.jl")
# This exercise isn't about mathematical methods to determine the distribution of a random sample,
# therefore we only test that all possible values are returned at least once.

@testset "fog" begin
@test Set(is_foggy() for _ in 1:1000) == Set([true, false])
end
@testset verbose = true "tests" begin
@testset "fog" begin
@test Set(is_foggy() for _ in 1:1000) == Set([true, false])
end

@testset "distracted dog" begin
@test Set(is_dog_distracted() for _ in 1:1000) == Set([true, false])
end
@testset "distracted dog" begin
@test Set(is_dog_distracted() for _ in 1:1000) == Set([true, false])
end

@testset "loot purse" begin
@test Set(loot() for _ in 1:1000) == Set(3:13)
end
@testset "loot purse" begin
@test Set(loot() for _ in 1:1000) == Set(3:13)
end

@testset "loot crate" begin
crate = Set(["Cabbage", "Daring Dagger", "Sneaky Shoes"])
@test Set(loot(crate) for _ in 1:1000) == crate
@testset "loot crate" begin
crate = Set(["Cabbage", "Daring Dagger", "Sneaky Shoes"])
@test Set(loot(crate) for _ in 1:1000) == crate
end
end
80 changes: 41 additions & 39 deletions exercises/concept.wip/dnd-char/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,51 @@ using Test

include("dnd-character.jl")

@testset "Randomly generated ability is within range" begin
for i in 1:1000
@test 3 <= ability() <= 18
@testset verbose = true "tests" begin
@testset "Randomly generated ability is within range" begin
for i in 1:1000
@test 3 <= ability() <= 18
end
end
end

@testset "Ability modifiers are integers" begin
@test typeof(modifier(7)) <: Integer
end

@testset "Ability modifiers" begin
@test modifier(3) == -4
@test modifier(4) == -3
@test modifier(5) == -3
@test modifier(6) == -2
@test modifier(7) == -2
@test modifier(8) == -1
@test modifier(9) == -1
@test modifier(10) == 0
@test modifier(11) == 0
@test modifier(12) == 1
@test modifier(13) == 1
@test modifier(14) == 2
@test modifier(15) == 2
@test modifier(16) == 3
@test modifier(17) == 3
@test modifier(18) == 4
end
@testset "Ability modifiers are integers" begin
@test typeof(modifier(7)) <: Integer
end

@testset "Randomly generated character is valid" begin
# Helper method to check if all abilities of a character are within the expected ranges.
function ischaracter(c)
3 <= c.strength <= 18 &&
3 <= c.dexterity <= 18 &&
3 <= c.constitution <= 18 &&
3 <= c.intelligence <= 18 &&
3 <= c.wisdom <= 18 &&
3 <= c.charisma <= 18 &&
c.hitpoints == 10 + modifier(c.constitution)
@testset "Ability modifiers" begin
@test modifier(3) == -4
@test modifier(4) == -3
@test modifier(5) == -3
@test modifier(6) == -2
@test modifier(7) == -2
@test modifier(8) == -1
@test modifier(9) == -1
@test modifier(10) == 0
@test modifier(11) == 0
@test modifier(12) == 1
@test modifier(13) == 1
@test modifier(14) == 2
@test modifier(15) == 2
@test modifier(16) == 3
@test modifier(17) == 3
@test modifier(18) == 4
end

for i in 1:1000
c = DNDCharacter()
@test ischaracter(c)
@testset "Randomly generated character is valid" begin
# Helper method to check if all abilities of a character are within the expected ranges.
function ischaracter(c)
3 <= c.strength <= 18 &&
3 <= c.dexterity <= 18 &&
3 <= c.constitution <= 18 &&
3 <= c.intelligence <= 18 &&
3 <= c.wisdom <= 18 &&
3 <= c.charisma <= 18 &&
c.hitpoints == 10 + modifier(c.constitution)
end

for i in 1:1000
c = DNDCharacter()
@test ischaracter(c)
end
end
end
Loading

0 comments on commit 5c0d84f

Please sign in to comment.