diff --git a/exercises/practice/rail-fence-cipher/.meta/template.j2 b/exercises/practice/rail-fence-cipher/.meta/template.j2 index 80cdbad1..e8679de0 100644 --- a/exercises/practice/rail-fence-cipher/.meta/template.j2 +++ b/exercises/practice/rail-fence-cipher/.meta/template.j2 @@ -1,33 +1,33 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip -{%- if case["property"] == "encode" %} - run bash {{ solution }} -e {{ case["input"]["rails"] }} "{{ case["input"]["msg"] }}" +{%- if case.property == "encode" %} + run bash {{ solution }} -e {{ case.input.rails }} "{{ case.input.msg }}" {%- else %} - run bash {{ solution }} -d {{ case["input"]["rails"] }} "{{ case["input"]["msg"] }}" + run bash {{ solution }} -d {{ case.input.rails }} "{{ case.input.msg }}" {%- endif %} assert_success - assert_output "{{ case["expected"] }}" + assert_output "{{ case.expected }}" } {% endfor %} # Track specific tests -@test "encode with more rails than text" { +test_encode_with_more_rails_than_text () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -e 10 "hello" assert_success assert_output "hello" } -@test "decode with more rails than text" { +test_decode_with_more_rails_than_text () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -d 10 "hello" assert_success assert_output "hello" } -@test "decode the encoded text yields the original" { +test_decode_the_encoded_text_yields_the_original () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip plaintext="the quick brown fox jumped over the lazy dogs" rails=5 @@ -41,21 +41,21 @@ # Invocation errors -@test "no options" { +test_no_options () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh assert_failure assert_output # there is _some_ output } -@test "zero rails" { +test_zero_rails () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -e 0 abc assert_failure assert_output # there is _some_ output } -@test "negative rails" { +test_negative_rails () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -d -2 abc assert_failure diff --git a/exercises/practice/rail-fence-cipher/rail_fence_cipher.bats b/exercises/practice/rail-fence-cipher/rail_fence_cipher.bats index dea280d4..808f67a3 100644 --- a/exercises/practice/rail-fence-cipher/rail_fence_cipher.bats +++ b/exercises/practice/rail-fence-cipher/rail_fence_cipher.bats @@ -1,44 +1,44 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-06-29T16:53:24+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "encode with two rails" { +test_encode_encode_with_two_rails() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -e 2 "XOXOXOXOXOXOXOXOXO" assert_success assert_output "XXXXXXXXXOOOOOOOOO" } -@test "encode with three rails" { +test_encode_encode_with_three_rails() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -e 3 "WEAREDISCOVEREDFLEEATONCE" assert_success assert_output "WECRLTEERDSOEEFEAOCAIVDEN" } -@test "encode with ending in the middle" { +test_encode_encode_with_ending_in_the_middle() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -e 4 "EXERCISES" assert_success assert_output "ESXIEECSR" } -@test "decode with three rails" { +test_decode_decode_with_three_rails() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -d 3 "TEITELHDVLSNHDTISEIIEA" assert_success assert_output "THEDEVILISINTHEDETAILS" } -@test "decode with five rails" { +test_decode_decode_with_five_rails() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -d 5 "EIEXMSMESAORIWSCE" assert_success assert_output "EXERCISMISAWESOME" } -@test "decode with six rails" { +test_decode_decode_with_six_rails() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -d 6 "133714114238148966225439541018335470986172518171757571896261" assert_success @@ -47,21 +47,21 @@ load bats-extra # Track specific tests -@test "encode with more rails than text" { +test_encode_with_more_rails_than_text () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -e 10 "hello" assert_success assert_output "hello" } -@test "decode with more rails than text" { +test_decode_with_more_rails_than_text () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -d 10 "hello" assert_success assert_output "hello" } -@test "decode the encoded text yields the original" { +test_decode_the_encoded_text_yields_the_original () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip plaintext="the quick brown fox jumped over the lazy dogs" rails=5 @@ -75,21 +75,21 @@ load bats-extra # Invocation errors -@test "no options" { +test_no_options () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh assert_failure assert_output # there is _some_ output } -@test "zero rails" { +test_zero_rails () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -e 0 abc assert_failure assert_output # there is _some_ output } -@test "negative rails" { +test_negative_rails () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rail_fence_cipher.sh -d -2 abc assert_failure diff --git a/exercises/practice/raindrops/.meta/template.j2 b/exercises/practice/raindrops/.meta/template.j2 index 3a68a821..41409f3f 100644 --- a/exercises/practice/raindrops/.meta/template.j2 +++ b/exercises/practice/raindrops/.meta/template.j2 @@ -1,9 +1,9 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash {{ solution }} {{ case["input"]["number"] }} + run bash {{ solution }} {{ case.given }} assert_success - assert_output "{{ case["expected"] }}" + assert_output "{{ case.expected }}" } {% endfor %} diff --git a/exercises/practice/raindrops/raindrops.bats b/exercises/practice/raindrops/raindrops.bats index c655e800..fca4a5af 100644 --- a/exercises/practice/raindrops/raindrops.bats +++ b/exercises/practice/raindrops/raindrops.bats @@ -1,131 +1,130 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-08-14T05:27:24+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "the sound for 1 is 1" { +test_the_sound_for_1_is_1() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 1 assert_success assert_output "1" } -@test "the sound for 3 is Pling" { +test_the_sound_for_3_is_pling() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 3 assert_success assert_output "Pling" } -@test "the sound for 5 is Plang" { +test_the_sound_for_5_is_plang() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 5 assert_success assert_output "Plang" } -@test "the sound for 7 is Plong" { +test_the_sound_for_7_is_plong() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 7 assert_success assert_output "Plong" } -@test "the sound for 6 is Pling as it has a factor 3" { +test_the_sound_for_6_is_pling_as_it_has_a_factor_3() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 6 assert_success assert_output "Pling" } -@test "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" { +test_2_to_the_power_3_does_not_make_a_raindrop_sound_as_3_is_the_exponent_not_the_base() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 8 assert_success assert_output "8" } -@test "the sound for 9 is Pling as it has a factor 3" { +test_the_sound_for_9_is_pling_as_it_has_a_factor_3() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 9 assert_success assert_output "Pling" } -@test "the sound for 10 is Plang as it has a factor 5" { +test_the_sound_for_10_is_plang_as_it_has_a_factor_5() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 10 assert_success assert_output "Plang" } -@test "the sound for 14 is Plong as it has a factor of 7" { +test_the_sound_for_14_is_plong_as_it_has_a_factor_of_7() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 14 assert_success assert_output "Plong" } -@test "the sound for 15 is PlingPlang as it has factors 3 and 5" { +test_the_sound_for_15_is_plingplang_as_it_has_factors_3_and_5() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 15 assert_success assert_output "PlingPlang" } -@test "the sound for 21 is PlingPlong as it has factors 3 and 7" { +test_the_sound_for_21_is_plingplong_as_it_has_factors_3_and_7() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 21 assert_success assert_output "PlingPlong" } -@test "the sound for 25 is Plang as it has a factor 5" { +test_the_sound_for_25_is_plang_as_it_has_a_factor_5() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 25 assert_success assert_output "Plang" } -@test "the sound for 27 is Pling as it has a factor 3" { +test_the_sound_for_27_is_pling_as_it_has_a_factor_3() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 27 assert_success assert_output "Pling" } -@test "the sound for 35 is PlangPlong as it has factors 5 and 7" { +test_the_sound_for_35_is_plangplong_as_it_has_factors_5_and_7() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 35 assert_success assert_output "PlangPlong" } -@test "the sound for 49 is Plong as it has a factor 7" { +test_the_sound_for_49_is_plong_as_it_has_a_factor_7() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 49 assert_success assert_output "Plong" } -@test "the sound for 52 is 52" { +test_the_sound_for_52_is_52() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 52 assert_success assert_output "52" } -@test "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" { +test_the_sound_for_105_is_plingplangplong_as_it_has_factors_3_5_and_7() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 105 assert_success assert_output "PlingPlangPlong" } -@test "the sound for 3125 is Plang as it has a factor 5" { +test_the_sound_for_3125_is_plang_as_it_has_a_factor_5() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash raindrops.sh 3125 assert_success assert_output "Plang" } - diff --git a/exercises/practice/rational-numbers/.meta/template.j2 b/exercises/practice/rational-numbers/.meta/template.j2 index 21d0c146..d5e6359e 100644 --- a/exercises/practice/rational-numbers/.meta/template.j2 +++ b/exercises/practice/rational-numbers/.meta/template.j2 @@ -1,26 +1,26 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip -{%- if case["property"] in ["add", "sub", "mul", "div"] %} - {%- set op = {"add": "+", "sub": "-", "mul": "*", "div": "/"}[case["property"]] %} - {%- set args = [op, case["input"]["r1"] | join("/"), case["input"]["r2"] | join("/")] %} -{%- elif case["property"] == "abs" %} - {%- set args = ["abs", case["input"]["r"] | join("/")] %} -{%- elif case["property"] == "exprational" %} - {%- set args = ["pow", case["input"]["r"] | join("/"), case["input"]["n"]] %} -{%- elif case["property"] == "expreal" %} - {%- set args = ["rpow", case["input"]["x"], case["input"]["r"] | join("/")] %} -{%- elif case["property"] == "reduce" %} - {%- set args = ["reduce", case["input"]["r"] | join("/")] %} +{%- if case.property in ["add", "sub", "mul", "div"] %} + {%- set op = {"add": "+", "sub": "-", "mul": "*", "div": "/"}[case.property] %} + {%- set args = [op, case.input.r1 | join("/"), case.input.r2 | join("/")] %} +{%- elif case.property == "abs" %} + {%- set args = ["abs", case.input.r | join("/")] %} +{%- elif case.property == "exprational" %} + {%- set args = ["pow", case.input.r | join("/"), case.input.n] %} +{%- elif case.property == "expreal" %} + {%- set args = ["rpow", case.input.x, case.input.r | join("/")] %} +{%- elif case.property == "reduce" %} + {%- set args = ["reduce", case.input.r | join("/")] %} {%- endif %} run bash {{ solution }} "{{ args | join('" "') }}" assert_success -{%- if case["property"] == "expreal" %} - assert_output "{{ case["expected"] | string | truncate(8, True, "") }}" +{%- if case.property == "expreal" %} + assert_output "{{ case.expected | string | truncate(8, True, "") }}" {%- else %} - assert_output "{{ case["expected"] | join("/") }}" + assert_output "{{ case.expected | join("/") }}" {%- endif %} } {% endfor %} diff --git a/exercises/practice/rational-numbers/rational_numbers.bats b/exercises/practice/rational-numbers/rational_numbers.bats index 4b19a0e6..216cc131 100644 --- a/exercises/practice/rational-numbers/rational_numbers.bats +++ b/exercises/practice/rational-numbers/rational_numbers.bats @@ -1,303 +1,303 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-06-29T16:53:24+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "Add two positive rational numbers" { +test_arithmetic_addition_add_two_positive_rational_numbers() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "+" "1/2" "2/3" assert_success assert_output "7/6" } -@test "Add a positive rational number and a negative rational number" { +test_arithmetic_addition_add_a_positive_rational_number_and_a_negative_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "+" "1/2" "-2/3" assert_success assert_output "-1/6" } -@test "Add two negative rational numbers" { +test_arithmetic_addition_add_two_negative_rational_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "+" "-1/2" "-2/3" assert_success assert_output "-7/6" } -@test "Add a rational number to its additive inverse" { +test_arithmetic_addition_add_a_rational_number_to_its_additive_inverse() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "+" "1/2" "-1/2" assert_success assert_output "0/1" } -@test "Subtract two positive rational numbers" { +test_arithmetic_subtraction_subtract_two_positive_rational_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "-" "1/2" "2/3" assert_success assert_output "-1/6" } -@test "Subtract a positive rational number and a negative rational number" { +test_arithmetic_subtraction_subtract_a_positive_rational_number_and_a_negative_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "-" "1/2" "-2/3" assert_success assert_output "7/6" } -@test "Subtract two negative rational numbers" { +test_arithmetic_subtraction_subtract_two_negative_rational_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "-" "-1/2" "-2/3" assert_success assert_output "1/6" } -@test "Subtract a rational number from itself" { +test_arithmetic_subtraction_subtract_a_rational_number_from_itself() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "-" "1/2" "1/2" assert_success assert_output "0/1" } -@test "Multiply two positive rational numbers" { +test_arithmetic_multiplication_multiply_two_positive_rational_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "*" "1/2" "2/3" assert_success assert_output "1/3" } -@test "Multiply a negative rational number by a positive rational number" { +test_arithmetic_multiplication_multiply_a_negative_rational_number_by_a_positive_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "*" "-1/2" "2/3" assert_success assert_output "-1/3" } -@test "Multiply two negative rational numbers" { +test_arithmetic_multiplication_multiply_two_negative_rational_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "*" "-1/2" "-2/3" assert_success assert_output "1/3" } -@test "Multiply a rational number by its reciprocal" { +test_arithmetic_multiplication_multiply_a_rational_number_by_its_reciprocal() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "*" "1/2" "2/1" assert_success assert_output "1/1" } -@test "Multiply a rational number by 1" { +test_arithmetic_multiplication_multiply_a_rational_number_by_1() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "*" "1/2" "1/1" assert_success assert_output "1/2" } -@test "Multiply a rational number by 0" { +test_arithmetic_multiplication_multiply_a_rational_number_by_0() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "*" "1/2" "0/1" assert_success assert_output "0/1" } -@test "Divide two positive rational numbers" { +test_arithmetic_division_divide_two_positive_rational_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "/" "1/2" "2/3" assert_success assert_output "3/4" } -@test "Divide a positive rational number by a negative rational number" { +test_arithmetic_division_divide_a_positive_rational_number_by_a_negative_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "/" "1/2" "-2/3" assert_success assert_output "-3/4" } -@test "Divide two negative rational numbers" { +test_arithmetic_division_divide_two_negative_rational_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "/" "-1/2" "-2/3" assert_success assert_output "3/4" } -@test "Divide a rational number by 1" { +test_arithmetic_division_divide_a_rational_number_by_1() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "/" "1/2" "1/1" assert_success assert_output "1/2" } -@test "Absolute value of a positive rational number" { +test_absolute_value_absolute_value_of_a_positive_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "abs" "1/2" assert_success assert_output "1/2" } -@test "Absolute value of a positive rational number with negative numerator and denominator" { +test_absolute_value_absolute_value_of_a_positive_rational_number_with_negative_numerator_and_denominator() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "abs" "-1/-2" assert_success assert_output "1/2" } -@test "Absolute value of a negative rational number" { +test_absolute_value_absolute_value_of_a_negative_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "abs" "-1/2" assert_success assert_output "1/2" } -@test "Absolute value of a negative rational number with negative denominator" { +test_absolute_value_absolute_value_of_a_negative_rational_number_with_negative_denominator() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "abs" "1/-2" assert_success assert_output "1/2" } -@test "Absolute value of zero" { +test_absolute_value_absolute_value_of_zero() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "abs" "0/1" assert_success assert_output "0/1" } -@test "Absolute value of a rational number is reduced to lowest terms" { +test_absolute_value_absolute_value_of_a_rational_number_is_reduced_to_lowest_terms() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "abs" "2/4" assert_success assert_output "1/2" } -@test "Raise a positive rational number to a positive integer power" { +test_exponentiation_of_a_rational_number_raise_a_positive_rational_number_to_a_positive_integer_power() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "1/2" "3" assert_success assert_output "1/8" } -@test "Raise a negative rational number to a positive integer power" { +test_exponentiation_of_a_rational_number_raise_a_negative_rational_number_to_a_positive_integer_power() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "-1/2" "3" assert_success assert_output "-1/8" } -@test "Raise a positive rational number to a negative integer power" { +test_exponentiation_of_a_rational_number_raise_a_positive_rational_number_to_a_negative_integer_power() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "3/5" "-2" assert_success assert_output "25/9" } -@test "Raise a negative rational number to an even negative integer power" { +test_exponentiation_of_a_rational_number_raise_a_negative_rational_number_to_an_even_negative_integer_power() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "-3/5" "-2" assert_success assert_output "25/9" } -@test "Raise a negative rational number to an odd negative integer power" { +test_exponentiation_of_a_rational_number_raise_a_negative_rational_number_to_an_odd_negative_integer_power() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "-3/5" "-3" assert_success assert_output "-125/27" } -@test "Raise zero to an integer power" { +test_exponentiation_of_a_rational_number_raise_zero_to_an_integer_power() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "0/1" "5" assert_success assert_output "0/1" } -@test "Raise one to an integer power" { +test_exponentiation_of_a_rational_number_raise_one_to_an_integer_power() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "1/1" "4" assert_success assert_output "1/1" } -@test "Raise a positive rational number to the power of zero" { +test_exponentiation_of_a_rational_number_raise_a_positive_rational_number_to_the_power_of_zero() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "1/2" "0" assert_success assert_output "1/1" } -@test "Raise a negative rational number to the power of zero" { +test_exponentiation_of_a_rational_number_raise_a_negative_rational_number_to_the_power_of_zero() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "pow" "-1/2" "0" assert_success assert_output "1/1" } -@test "Raise a real number to a positive rational number" { +test_exponentiation_of_a_real_number_to_a_rational_number_raise_a_real_number_to_a_positive_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "rpow" "8" "4/3" assert_success assert_output "16.0" } -@test "Raise a real number to a negative rational number" { +test_exponentiation_of_a_real_number_to_a_rational_number_raise_a_real_number_to_a_negative_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "rpow" "9" "-1/2" assert_success assert_output "0.333333" } -@test "Raise a real number to a zero rational number" { +test_exponentiation_of_a_real_number_to_a_rational_number_raise_a_real_number_to_a_zero_rational_number() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "rpow" "2" "0/1" assert_success assert_output "1.0" } -@test "Reduce a positive rational number to lowest terms" { +test_reduction_to_lowest_terms_reduce_a_positive_rational_number_to_lowest_terms() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "reduce" "2/4" assert_success assert_output "1/2" } -@test "Reduce places the minus sign on the numerator" { +test_reduction_to_lowest_terms_reduce_places_the_minus_sign_on_the_numerator() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "reduce" "3/-4" assert_success assert_output "-3/4" } -@test "Reduce a negative rational number to lowest terms" { +test_reduction_to_lowest_terms_reduce_a_negative_rational_number_to_lowest_terms() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "reduce" "-4/6" assert_success assert_output "-2/3" } -@test "Reduce a rational number with a negative denominator to lowest terms" { +test_reduction_to_lowest_terms_reduce_a_rational_number_with_a_negative_denominator_to_lowest_terms() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "reduce" "3/-9" assert_success assert_output "-1/3" } -@test "Reduce zero to lowest terms" { +test_reduction_to_lowest_terms_reduce_zero_to_lowest_terms() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "reduce" "0/6" assert_success assert_output "0/1" } -@test "Reduce an integer to lowest terms" { +test_reduction_to_lowest_terms_reduce_an_integer_to_lowest_terms() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "reduce" "-14/7" assert_success assert_output "-2/1" } -@test "Reduce one to lowest terms" { +test_reduction_to_lowest_terms_reduce_one_to_lowest_terms() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rational_numbers.sh "reduce" "13/13" assert_success diff --git a/exercises/practice/rectangles/.meta/template.j2 b/exercises/practice/rectangles/.meta/template.j2 index 27db296b..bac9fafa 100644 --- a/exercises/practice/rectangles/.meta/template.j2 +++ b/exercises/practice/rectangles/.meta/template.j2 @@ -1,17 +1,17 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip -{%- if case["description"] == "no rows" %} +{%- if case.description == "no rows" %} run bash {{ solution }} -{%- elif case["description"] == "no columns" %} +{%- elif case.description == "no columns" %} run bash {{ solution }} <<<"" {%- else %} run bash {{ solution }} < ") }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip -{%- if case["property"] == "colorCode" %} - run bash {{ solution }} code {{ case["input"]["color"] }} +{%- if case.property == "colorCode" %} + run bash {{ solution }} code {{ case.given }} assert_success - assert_output "{{ case["expected"] }}" + assert_output "{{ case.expected }}" {%- endif %} -{%- if case["property"] == "colors" %} - run bash {{ solution }} {{ case["property"] }} +{%- if case.property == "colors" %} + run bash {{ solution }} {{ case.property }} assert_success - assert_equal "${{ "{" }}#lines[@]}" {{ case["expected"] | length }} -{%- for color in case["expected"] %} + assert_equal "${{ "{" }}#lines[@]}" {{ case.expected | length }} +{%- for color in case.expected %} assert_line --index {{ loop.index0 }} "{{ color }}" {%- endfor %} {%- endif %} diff --git a/exercises/practice/resistor-color/resistor_color.bats b/exercises/practice/resistor-color/resistor_color.bats index 71e226dd..26c505e0 100644 --- a/exercises/practice/resistor-color/resistor_color.bats +++ b/exercises/practice/resistor-color/resistor_color.bats @@ -1,30 +1,30 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-06-29T16:53:24+00:00 +# generated on 2026-11-08T07:20:04+00:00 -@test "Color codes -> Black" { +test_color_codes_black() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash resistor_color.sh code black assert_success assert_output "0" } -@test "Color codes -> White" { +test_color_codes_white() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash resistor_color.sh code white assert_success assert_output "9" } -@test "Color codes -> Orange" { +test_color_codes_orange() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash resistor_color.sh code orange assert_success assert_output "3" } -@test "Colors" { +test_colors() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash resistor_color.sh colors assert_success diff --git a/exercises/practice/reverse-string/.meta/template.j2 b/exercises/practice/reverse-string/.meta/template.j2 index 3d06f4ea..c726c698 100644 --- a/exercises/practice/reverse-string/.meta/template.j2 +++ b/exercises/practice/reverse-string/.meta/template.j2 @@ -1,17 +1,17 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash {{ solution }} "{{ case["input"]["value"] }}" + run bash {{ solution }} "{{ case.given }}" assert_success - assert_output "{{ case["expected"] }}" + assert_output "{{ case.expected }}" } {% endfor %} # bash-specific test: Focus the student's attention on the effects of # word splitting and filename expansion: # https://www.gnu.org/software/bash/manual/bash.html#Shell-Expansions -@test "avoid globbing" { +test_avoid_globbing() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh " a * b" diff --git a/exercises/practice/reverse-string/reverse_string.bats b/exercises/practice/reverse-string/reverse_string.bats index 5942e095..ab29bb57 100644 --- a/exercises/practice/reverse-string/reverse_string.bats +++ b/exercises/practice/reverse-string/reverse_string.bats @@ -1,44 +1,44 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-08-14T05:27:24+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "an empty string" { +test_an_empty_string() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh "" assert_success assert_output "" } -@test "a word" { +test_a_word() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh "robot" assert_success assert_output "tobor" } -@test "a capitalized word" { +test_a_capitalized_word() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh "Ramen" assert_success assert_output "nemaR" } -@test "a sentence with punctuation" { +test_a_sentence_with_punctuation() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh "I'm hungry!" assert_success assert_output "!yrgnuh m'I" } -@test "a palindrome" { +test_a_palindrome() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh "racecar" assert_success assert_output "racecar" } -@test "an even-sized word" { +test_an_even_sized_word() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh "drawer" assert_success @@ -49,7 +49,7 @@ load bats-extra # word splitting and filename expansion: # https://www.gnu.org/software/bash/manual/bash.html#Shell-Expansions -@test "avoid globbing" { +test_avoid_globbing() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash reverse_string.sh " a * b" diff --git a/exercises/practice/rna-transcription/.meta/template.j2 b/exercises/practice/rna-transcription/.meta/template.j2 index fd246c41..4b183bdb 100644 --- a/exercises/practice/rna-transcription/.meta/template.j2 +++ b/exercises/practice/rna-transcription/.meta/template.j2 @@ -1,27 +1,27 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash {{ solution }} "{{ case["input"]["dna"] }}" + run bash {{ solution }} "{{ case.given }}" assert_success - assert_output "{{ case["expected"] }}" + assert_output "{{ case.expected }}" } {% endfor %} -@test "Handles invalid character" { +test_handles_invalid_character () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash {{ solution }} ACGTXCTTA assert_failure assert_output "Invalid nucleotide detected." } -@test "Handles completely invalid string" { +test_handles_completely_invalid_string () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash {{ solution }} XXXX assert_failure assert_output "Invalid nucleotide detected." } -@test "Handles partially invalid string" { +test_handles_partially_invalid_string () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash {{ solution }} ACGTXCTTAA assert_failure diff --git a/exercises/practice/rna-transcription/rna_transcription.bats b/exercises/practice/rna-transcription/rna_transcription.bats index c37c4b81..40809b43 100644 --- a/exercises/practice/rna-transcription/rna_transcription.bats +++ b/exercises/practice/rna-transcription/rna_transcription.bats @@ -1,65 +1,65 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-08-14T05:27:25+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "Empty RNA sequence" { +test_empty_rna_sequence() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh "" assert_success assert_output "" } -@test "RNA complement of cytosine is guanine" { +test_rna_complement_of_cytosine_is_guanine() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh "C" assert_success assert_output "G" } -@test "RNA complement of guanine is cytosine" { +test_rna_complement_of_guanine_is_cytosine() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh "G" assert_success assert_output "C" } -@test "RNA complement of thymine is adenine" { +test_rna_complement_of_thymine_is_adenine() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh "T" assert_success assert_output "A" } -@test "RNA complement of adenine is uracil" { +test_rna_complement_of_adenine_is_uracil() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh "A" assert_success assert_output "U" } -@test "RNA complement" { +test_rna_complement() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh "ACGTGGTCTTAA" assert_success assert_output "UGCACCAGAAUU" } -@test "Handles invalid character" { +test_handles_invalid_character () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh ACGTXCTTA assert_failure assert_output "Invalid nucleotide detected." } -@test "Handles completely invalid string" { +test_handles_completely_invalid_string () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh XXXX assert_failure assert_output "Invalid nucleotide detected." } -@test "Handles partially invalid string" { +test_handles_partially_invalid_string () { #@test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash rna_transcription.sh ACGTXCTTAA assert_failure diff --git a/exercises/practice/roman-numerals/.meta/template.j2 b/exercises/practice/roman-numerals/.meta/template.j2 index 3a68a821..41409f3f 100644 --- a/exercises/practice/roman-numerals/.meta/template.j2 +++ b/exercises/practice/roman-numerals/.meta/template.j2 @@ -1,9 +1,9 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash {{ solution }} {{ case["input"]["number"] }} + run bash {{ solution }} {{ case.given }} assert_success - assert_output "{{ case["expected"] }}" + assert_output "{{ case.expected }}" } {% endfor %} diff --git a/exercises/practice/roman-numerals/roman_numerals.bats b/exercises/practice/roman-numerals/roman_numerals.bats index 90a71934..1a2222ad 100644 --- a/exercises/practice/roman-numerals/roman_numerals.bats +++ b/exercises/practice/roman-numerals/roman_numerals.bats @@ -1,194 +1,193 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-08-14T05:27:24+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "1 is I" { +test_1_is_i() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 1 assert_success assert_output "I" } -@test "2 is II" { +test_2_is_ii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 2 assert_success assert_output "II" } -@test "3 is III" { +test_3_is_iii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 3 assert_success assert_output "III" } -@test "4 is IV" { +test_4_is_iv() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 4 assert_success assert_output "IV" } -@test "5 is V" { +test_5_is_v() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 5 assert_success assert_output "V" } -@test "6 is VI" { +test_6_is_vi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 6 assert_success assert_output "VI" } -@test "9 is IX" { +test_9_is_ix() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 9 assert_success assert_output "IX" } -@test "16 is XVI" { +test_16_is_xvi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 16 assert_success assert_output "XVI" } -@test "27 is XXVII" { +test_27_is_xxvii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 27 assert_success assert_output "XXVII" } -@test "48 is XLVIII" { +test_48_is_xlviii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 48 assert_success assert_output "XLVIII" } -@test "49 is XLIX" { +test_49_is_xlix() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 49 assert_success assert_output "XLIX" } -@test "59 is LIX" { +test_59_is_lix() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 59 assert_success assert_output "LIX" } -@test "66 is LXVI" { +test_66_is_lxvi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 66 assert_success assert_output "LXVI" } -@test "93 is XCIII" { +test_93_is_xciii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 93 assert_success assert_output "XCIII" } -@test "141 is CXLI" { +test_141_is_cxli() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 141 assert_success assert_output "CXLI" } -@test "163 is CLXIII" { +test_163_is_clxiii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 163 assert_success assert_output "CLXIII" } -@test "166 is CLXVI" { +test_166_is_clxvi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 166 assert_success assert_output "CLXVI" } -@test "402 is CDII" { +test_402_is_cdii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 402 assert_success assert_output "CDII" } -@test "575 is DLXXV" { +test_575_is_dlxxv() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 575 assert_success assert_output "DLXXV" } -@test "666 is DCLXVI" { +test_666_is_dclxvi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 666 assert_success assert_output "DCLXVI" } -@test "911 is CMXI" { +test_911_is_cmxi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 911 assert_success assert_output "CMXI" } -@test "1024 is MXXIV" { +test_1024_is_mxxiv() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 1024 assert_success assert_output "MXXIV" } -@test "1666 is MDCLXVI" { +test_1666_is_mdclxvi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 1666 assert_success assert_output "MDCLXVI" } -@test "3000 is MMM" { +test_3000_is_mmm() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 3000 assert_success assert_output "MMM" } -@test "3001 is MMMI" { +test_3001_is_mmmi() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 3001 assert_success assert_output "MMMI" } -@test "3888 is MMMDCCCLXXXVIII" { +test_3888_is_mmmdccclxxxviii() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 3888 assert_success assert_output "MMMDCCCLXXXVIII" } -@test "3999 is MMMCMXCIX" { +test_3999_is_mmmcmxcix() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash roman_numerals.sh 3999 assert_success assert_output "MMMCMXCIX" } - diff --git a/exercises/practice/rotational-cipher/.meta/template.j2 b/exercises/practice/rotational-cipher/.meta/template.j2 index 438de560..e1ba5fed 100644 --- a/exercises/practice/rotational-cipher/.meta/template.j2 +++ b/exercises/practice/rotational-cipher/.meta/template.j2 @@ -1,9 +1,9 @@ {{ header }} {% for case in cases %} -@test "{{ case["description"] }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip - expected="{{ case["expected"] }}" - run bash {{ solution }} "{{ case["input"]["text"] }}" {{ case["input"]["shiftKey"] }} + expected="{{ case.expected }}" + run bash {{ solution }} "{{ case.input.text }}" {{ case.input.shiftKey }} assert_success assert_output "$expected" } diff --git a/exercises/practice/rotational-cipher/rotational_cipher.bats b/exercises/practice/rotational-cipher/rotational_cipher.bats index acca1c91..b2907aeb 100644 --- a/exercises/practice/rotational-cipher/rotational_cipher.bats +++ b/exercises/practice/rotational-cipher/rotational_cipher.bats @@ -1,9 +1,9 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-06-29T16:53:25+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "rotate a by 0, same output as input" { +test_rotate_a_by_0_same_output_as_input() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="a" run bash rotational_cipher.sh "a" 0 @@ -11,7 +11,7 @@ load bats-extra assert_output "$expected" } -@test "rotate a by 1" { +test_rotate_a_by_1() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="b" run bash rotational_cipher.sh "a" 1 @@ -19,7 +19,7 @@ load bats-extra assert_output "$expected" } -@test "rotate a by 26, same output as input" { +test_rotate_a_by_26_same_output_as_input() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="a" run bash rotational_cipher.sh "a" 26 @@ -27,7 +27,7 @@ load bats-extra assert_output "$expected" } -@test "rotate m by 13" { +test_rotate_m_by_13() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="z" run bash rotational_cipher.sh "m" 13 @@ -35,7 +35,7 @@ load bats-extra assert_output "$expected" } -@test "rotate n by 13 with wrap around alphabet" { +test_rotate_n_by_13_with_wrap_around_alphabet() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="a" run bash rotational_cipher.sh "n" 13 @@ -43,7 +43,7 @@ load bats-extra assert_output "$expected" } -@test "rotate capital letters" { +test_rotate_capital_letters() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="TRL" run bash rotational_cipher.sh "OMG" 5 @@ -51,7 +51,7 @@ load bats-extra assert_output "$expected" } -@test "rotate spaces" { +test_rotate_spaces() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="T R L" run bash rotational_cipher.sh "O M G" 5 @@ -59,7 +59,7 @@ load bats-extra assert_output "$expected" } -@test "rotate numbers" { +test_rotate_numbers() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="Xiwxmrk 1 2 3 xiwxmrk" run bash rotational_cipher.sh "Testing 1 2 3 testing" 4 @@ -67,7 +67,7 @@ load bats-extra assert_output "$expected" } -@test "rotate punctuation" { +test_rotate_punctuation() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="Gzo'n zvo, Bmviyhv!" run bash rotational_cipher.sh "Let's eat, Grandma!" 21 @@ -75,7 +75,7 @@ load bats-extra assert_output "$expected" } -@test "rotate all letters" { +test_rotate_all_letters() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="Gur dhvpx oebja sbk whzcf bire gur ynml qbt." run bash rotational_cipher.sh "The quick brown fox jumps over the lazy dog." 13 diff --git a/exercises/practice/run-length-encoding/.meta/template.j2 b/exercises/practice/run-length-encoding/.meta/template.j2 index 4f3e2bdc..007e3f4e 100644 --- a/exercises/practice/run-length-encoding/.meta/template.j2 +++ b/exercises/practice/run-length-encoding/.meta/template.j2 @@ -1,15 +1,15 @@ {{ header }} {% for case in cases %} -@test "{{ case["descriptions"] | join(": ") }}" { +{{ case.test_function_start }} {% if loop.first %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip - expected="{{ case["expected"] }}" -{%- if case["property"] == "consistency" %} - run bash run_length_encoding.sh encode "{{ case["input"]["string"] }}" + expected="{{ case.expected }}" +{%- if case.property == "consistency" %} + run bash run_length_encoding.sh encode "{{ case.given }}" assert_success encoded=$output run bash run_length_encoding.sh decode "$encoded" {%- else %} - run bash {{ solution }} {{ case["property"] }} "{{ case["input"]["string"] }}" + run bash {{ solution }} {{ case.property }} "{{ case.input.string }}" {%- endif %} assert_success assert_output "$expected" diff --git a/exercises/practice/run-length-encoding/run_length_encoding.bats b/exercises/practice/run-length-encoding/run_length_encoding.bats index dca27a6f..0c6d6b31 100644 --- a/exercises/practice/run-length-encoding/run_length_encoding.bats +++ b/exercises/practice/run-length-encoding/run_length_encoding.bats @@ -1,9 +1,9 @@ #!/usr/bin/env bats load bats-extra -# generated on 2026-06-29T16:53:25+00:00 +# generated on 2026-11-08T06:49:56+00:00 -@test "run-length encode a string: empty string" { +test_run_length_encode_a_string_empty_string() { # @test # [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="" run bash run_length_encoding.sh encode "" @@ -11,7 +11,7 @@ load bats-extra assert_output "$expected" } -@test "run-length encode a string: single characters only are encoded without count" { +test_run_length_encode_a_string_single_characters_only_are_encoded_without_count() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="XYZ" run bash run_length_encoding.sh encode "XYZ" @@ -19,7 +19,7 @@ load bats-extra assert_output "$expected" } -@test "run-length encode a string: string with no single characters" { +test_run_length_encode_a_string_string_with_no_single_characters() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="2A3B4C" run bash run_length_encoding.sh encode "AABBBCCCC" @@ -27,7 +27,7 @@ load bats-extra assert_output "$expected" } -@test "run-length encode a string: single characters mixed with repeated characters" { +test_run_length_encode_a_string_single_characters_mixed_with_repeated_characters() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="12WB12W3B24WB" run bash run_length_encoding.sh encode "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" @@ -35,7 +35,7 @@ load bats-extra assert_output "$expected" } -@test "run-length encode a string: multiple whitespace mixed in string" { +test_run_length_encode_a_string_multiple_whitespace_mixed_in_string() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="2 hs2q q2w2 " run bash run_length_encoding.sh encode " hsqq qww " @@ -43,7 +43,7 @@ load bats-extra assert_output "$expected" } -@test "run-length encode a string: lowercase characters" { +test_run_length_encode_a_string_lowercase_characters() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="2a3b4c" run bash run_length_encoding.sh encode "aabbbcccc" @@ -51,7 +51,7 @@ load bats-extra assert_output "$expected" } -@test "run-length decode a string: empty string" { +test_run_length_decode_a_string_empty_string() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="" run bash run_length_encoding.sh decode "" @@ -59,7 +59,7 @@ load bats-extra assert_output "$expected" } -@test "run-length decode a string: single characters only" { +test_run_length_decode_a_string_single_characters_only() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="XYZ" run bash run_length_encoding.sh decode "XYZ" @@ -67,7 +67,7 @@ load bats-extra assert_output "$expected" } -@test "run-length decode a string: string with no single characters" { +test_run_length_decode_a_string_string_with_no_single_characters() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="AABBBCCCC" run bash run_length_encoding.sh decode "2A3B4C" @@ -75,7 +75,7 @@ load bats-extra assert_output "$expected" } -@test "run-length decode a string: single characters with repeated characters" { +test_run_length_decode_a_string_single_characters_with_repeated_characters() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" run bash run_length_encoding.sh decode "12WB12W3B24WB" @@ -83,7 +83,7 @@ load bats-extra assert_output "$expected" } -@test "run-length decode a string: multiple whitespace mixed in string" { +test_run_length_decode_a_string_multiple_whitespace_mixed_in_string() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected=" hsqq qww " run bash run_length_encoding.sh decode "2 hs2q q2w2 " @@ -91,7 +91,7 @@ load bats-extra assert_output "$expected" } -@test "run-length decode a string: lowercase string" { +test_run_length_decode_a_string_lowercase_string() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="aabbbcccc" run bash run_length_encoding.sh decode "2a3b4c" @@ -99,7 +99,7 @@ load bats-extra assert_output "$expected" } -@test "encode and then decode: encode followed by decode gives original string" { +test_encode_and_then_decode_encode_followed_by_decode_gives_original_string() { # @test [[ $BATS_RUN_SKIPPED == "true" ]] || skip expected="zzz ZZ zZ" run bash run_length_encoding.sh encode "zzz ZZ zZ"