diff --git a/_template/exercise_slug_test.sh b/_template/exercise_slug_test.sh index f029efa8..9fba7f86 100755 --- a/_template/exercise_slug_test.sh +++ b/_template/exercise_slug_test.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bats @test "Test name - first test shouldn't be skipped" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash exercise_slug.sh [ "$status" -eq 0 ] [ "$output" = "What's expected" ] } @test "Second test onwards should be skipped" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash exercise_slug.sh [ "$status" -eq 0 ] [ "$output" = "What's expected" ] diff --git a/bin/validate_exercises b/bin/validate_exercises index c5dbf4d8..00e47f7c 100755 --- a/bin/validate_exercises +++ b/bin/validate_exercises @@ -27,11 +27,8 @@ for exercise in *; do # Create implementation file from example cp example.sh ${exercise_name}.sh - # Unskip all the tests - sed -i 's/skip/# skip/g' $test_file - # Run the tests - bats $test_file + BATS_RUN_SKIPPED=true bats $test_file cd ../ done diff --git a/config/exercise_readme.go.tmpl b/config/exercise_readme.go.tmpl index 0085ee31..f6897790 100644 --- a/config/exercise_readme.go.tmpl +++ b/config/exercise_readme.go.tmpl @@ -11,7 +11,13 @@ Run the tests with: bats {{ .Spec.SnakeCaseName }}_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats {{ .Spec.SnakeCaseName }}_test.sh +``` {{ with .Spec.Credits -}} ## Source diff --git a/exercises/acronym/acronym_test.sh b/exercises/acronym/acronym_test.sh index 031dfa5e..67f1cbe5 100644 --- a/exercises/acronym/acronym_test.sh +++ b/exercises/acronym/acronym_test.sh @@ -1,42 +1,42 @@ #!/usr/bin/env bash @test 'basic' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash acronym.sh 'Portable Network Graphics' [ "$status" -eq 0 ] [ "$output" == 'PNG' ] } @test 'lowercase words' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash acronym.sh 'Ruby on Rails' [ "$status" -eq 0 ] [ "$output" == 'ROR' ] } @test 'punctuation' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash acronym.sh 'First In, First Out' [ "$status" -eq 0 ] [ "$output" == 'FIFO' ] } @test 'all caps word' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash acronym.sh 'GNU Image Manipulation Program' [ "$status" -eq 0 ] [ "$output" == 'GIMP' ] } @test 'punctuation without whitespace' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash acronym.sh 'Complementary metal-oxide semiconductor' [ "$status" -eq 0 ] [ "$output" == 'CMOS' ] } @test 'very long abbreviation' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash acronym.sh 'Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me' [ "$status" -eq 0 ] [ "$output" == 'ROTFLSHTMDCOALM' ] diff --git a/exercises/affine-cipher/affine_cipher_test.sh b/exercises/affine-cipher/affine_cipher_test.sh index 4c785782..f61b330c 100644 --- a/exercises/affine-cipher/affine_cipher_test.sh +++ b/exercises/affine-cipher/affine_cipher_test.sh @@ -3,63 +3,63 @@ # encode @test "encode yes" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 5 7 "yes" [ "$status" -eq 0 ] [ "$output" == "xbt" ] } @test "encode no" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 15 18 "no" [ "$status" -eq 0 ] [ "$output" == "fu" ] } @test "encode OMG" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 21 3 "OMG" [ "$status" -eq 0 ] [ "$output" == "lvz" ] } @test "encode O M G" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 25 47 "O M G" [ "$status" -eq 0 ] [ "$output" == "hjp" ] } @test "encode mindblowingly" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 11 15 "mindblowingly" [ "$status" -eq 0 ] [ "$output" == "rzcwa gnxzc dgt" ] } @test "encode numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 3 4 "Testing,1 2 3, testing." [ "$status" -eq 0 ] [ "$output" == "jqgjc rw123 jqgjc rw" ] } @test "encode deep thought" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 5 17 "Truth is fiction." [ "$status" -eq 0 ] [ "$output" == "iynia fdqfb ifje" ] } @test "encode all the letters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 17 33 "The quick brown fox jumps over the lazy dog." [ "$status" -eq 0 ] [ "$output" == "swxtj npvyk lruol iejdc blaxk swxmh qzglf" ] } @test "encode with a not coprime to m" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh encode 6 17 "This is a test." [ "$status" -eq 1 ] [ "$output" == "a and m must be coprime." ] @@ -68,49 +68,49 @@ # decode @test "decode exercism" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh decode 3 7 "tytgn fjr" [ "$status" -eq 0 ] [ "$output" == "exercism" ] } @test "decode a sentence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh decode 19 16 "qdwju nqcro muwhn odqun oppmd aunwd o" [ "$status" -eq 0 ] [ "$output" == "anobstacleisoftenasteppingstone" ] } @test "decode numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh decode 25 7 "odpoz ub123 odpoz ub" [ "$status" -eq 0 ] [ "$output" == "testing123testing" ] } @test "decode all the letters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh decode 17 33 "swxtj npvyk lruol iejdc blaxk swxmh qzglf" [ "$status" -eq 0 ] [ "$output" == "thequickbrownfoxjumpsoverthelazydog" ] } @test "decode with no spaces in input" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh decode 17 33 "swxtjnpvyklruoliejdcblaxkswxmhqzglf" [ "$status" -eq 0 ] [ "$output" == "thequickbrownfoxjumpsoverthelazydog" ] } @test "decode with too many spaces" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh decode 15 16 "vszzm cly yd cg qdp" [ "$status" -eq 0 ] [ "$output" == "jollygreengiant" ] } @test "decode with a not coprime to m" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash affine_cipher.sh decode 13 5 "Test" [ "$status" -eq 1 ] [ "$output" == "a and m must be coprime." ] diff --git a/exercises/all-your-base/README.md b/exercises/all-your-base/README.md index 4b302809..5267c34e 100644 --- a/exercises/all-your-base/README.md +++ b/exercises/all-your-base/README.md @@ -31,16 +31,19 @@ I think you got the idea! *Yes. Those three numbers above are exactly the same. Congratulations!* - Run the tests with: ```bash bats all_your_base_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. +To run all tests, including the ones with `skip` annotations, run: +```bash +BATS_RUN_SKIPPED=true bats all_your_base_test.sh +``` ## External utilities `Bash` is a language to write scripts that works closely with various system utilities, diff --git a/exercises/all-your-base/all_your_base_test.sh b/exercises/all-your-base/all_your_base_test.sh index 6db3e9c1..d33904cf 100644 --- a/exercises/all-your-base/all_your_base_test.sh +++ b/exercises/all-your-base/all_your_base_test.sh @@ -1,147 +1,147 @@ #!/usr/bin/env bash @test 'single_bit_to_one_decimal' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "1" 10 [[ "$status" -eq 0 ]] [[ "$output" == "1" ]] } @test 'binary_to_single_decimal' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "1 0 1" 10 [[ "$status" -eq 0 ]] [[ "$output" == "5" ]] } @test 'single_decimal_to_binary' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 10 "5" 2 [[ "$status" -eq 0 ]] [[ "$output" == "1 0 1" ]] } @test 'binary_to_multiple_decimal' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "1 0 1 0 1 0" 10 [[ "$status" -eq 0 ]] [[ "$output" == "4 2" ]] } @test 'decimal_to_binary' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 10 "4 2" 2 [[ "$status" -eq 0 ]] [[ "$output" == "1 0 1 0 1 0" ]] } @test 'trinary_to_hexadecimal' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 3 "1 1 2 0" 16 [[ "$status" -eq 0 ]] [[ "$output" == "2 10" ]] } @test 'hexadecimal_to_trinary' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 16 "2 10" 3 [[ "$status" -eq 0 ]] [[ "$output" == "1 1 2 0" ]] } @test '15_bit_integer' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 97 "3 46 60" 73 [[ "$status" -eq 0 ]] [[ "$output" == "6 10 45" ]] } @test 'empty_list' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "" 10 [[ "$status" -eq 0 ]] [[ "$output" == "" ]] } @test 'single_zero' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 10 "0" 2 [[ "$status" -eq 0 ]] [[ "$output" == "" ]] } @test 'multiple_zeroes' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 10 "0 0 0" 2 [[ "$status" -eq 0 ]] [[ "$output" == "" ]] } @test 'leading_zeros' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 7 "0 6 0" 10 [[ "$status" -eq 0 ]] [[ "$output" == "4 2" ]] } @test 'input_base_is_one' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 1 "0" 10 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'input_base_is_zero' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 0 "" 10 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'input_base_is_negative' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh -2 "1" 10 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'negative_digit' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "1 -1 1 0 1 0" 10 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'invalid_positive_digit' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "1 2 1 0 1 0" 10 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'output_base_is_one' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "1 0 1 0 1 0" 1 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'output_base_is_zero' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 10 "7" 0 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'output_base_is_negative' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh 2 "1" -7 [[ "$status" -gt 0 ]] [[ -n "$output" ]] } @test 'both_bases_are_negative' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash all_your_base.sh -2 "1" -7 [[ "$status" -gt 0 ]] [[ -n "$output" ]] diff --git a/exercises/allergies/README.md b/exercises/allergies/README.md index c60ef760..24af6f26 100644 --- a/exercises/allergies/README.md +++ b/exercises/allergies/README.md @@ -29,14 +29,19 @@ allergens that score 256, 512, 1024, etc.). Your program should ignore those components of the score. For example, if the allergy score is 257, your program should only report the eggs (1) allergy. - Run the tests with: ```bash bats allergies_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats allergies_test.sh +``` ## Source diff --git a/exercises/allergies/allergies_test.sh b/exercises/allergies/allergies_test.sh index e0169e73..64910364 100644 --- a/exercises/allergies/allergies_test.sh +++ b/exercises/allergies/allergies_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test 'no_allergies_means_not_allergic' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 0 allergic_to peanuts [[ $status -eq 0 ]] [[ $output = "false" ]] @@ -14,14 +14,14 @@ } @test 'is_allergic_to_eggs' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 1 allergic_to eggs [[ $status -eq 0 ]] [[ $output = "true" ]] } @test 'allergic_to_eggs_in_addition_to_other_stuff' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 5 allergic_to eggs [[ $status -eq 0 ]] [[ $output = "true" ]] @@ -34,7 +34,7 @@ } @test 'allergic_to_strawberries_but_not_peanuts' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 9 allergic_to eggs [[ $status -eq 0 ]] [[ $output = "true" ]] @@ -50,63 +50,63 @@ } @test 'no_allergies_at_all' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 0 list [[ $status -eq 0 ]] [[ $output == "" ]] } @test 'allergic_to_just_eggs' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 1 list [[ $status -eq 0 ]] [[ $output == "eggs" ]] } @test 'allergic_to_just_peanuts' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 2 list [[ $status -eq 0 ]] [[ $output == "peanuts" ]] } @test 'allergic_to_just_strawberries' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 8 list [[ $status -eq 0 ]] [[ $output == "strawberries" ]] } @test 'allergic_to_eggs_and_peanuts' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 3 list [[ $status -eq 0 ]] [[ $output == "eggs peanuts" ]] } @test 'allergic_to_more_than_eggs_but_not_peanuts' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 5 list [[ $status -eq 0 ]] [[ $output == "eggs shellfish" ]] } @test 'allergic_to_lots_of_stuff' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 248 list [[ $status -eq 0 ]] [[ $output == "strawberries tomatoes chocolate pollen cats" ]] } @test 'allergic_to_everything' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 255 list [[ $status -eq 0 ]] [[ $output == "eggs peanuts shellfish strawberries tomatoes chocolate pollen cats" ]] } @test 'ignore_non_allergen_score_parts' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash allergies.sh 509 list [[ $status -eq 0 ]] [[ $output == "eggs shellfish strawberries tomatoes chocolate pollen cats" ]] diff --git a/exercises/anagram/anagram_test.sh b/exercises/anagram/anagram_test.sh index 3da11f2d..94fb79e8 100755 --- a/exercises/anagram/anagram_test.sh +++ b/exercises/anagram/anagram_test.sh @@ -1,84 +1,84 @@ #!/usr/bin/env bash @test "no matches" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "diaper" "hello world zombies pants" [ "$status" -eq 0 ] [ "$output" == "" ] } @test "detects two anagrams" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "master" "stream pigeon maters" [ "$status" -eq 0 ] [ "$output" == "stream maters" ] } @test "does not detect anagram subsets" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "good" "dog goody" [ "$status" -eq 0 ] [ "$output" == "" ] } @test "detects anagram" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "listen" "enlists google inlets banana" [ "$status" -eq 0 ] [ "$output" == "inlets" ] } @test "detects three anagrams" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "allergy" "gallery ballerina regally clergy largely leading" [ "$status" -eq 0 ] [ "$output" == "gallery regally largely" ] } @test "does not detect non-anagrams with identical checksum" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "mass" "last" [ "$status" -eq 0 ] [ "$output" == "" ] } @test "detects anagrams case-insensitively" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "Orchestra" "cashregister Carthorse radishes" [ "$status" -eq 0 ] [ "$output" == "Carthorse" ] } @test "detects anagrams using case-insensitive subject" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "Orchestra" "cashregister carthorse radishes" [ "$status" -eq 0 ] [ "$output" == "carthorse" ] } @test "detects anagrams using case-insensitive possible matches" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "orchestra" "cashregister Carthorse radishes" [ "$status" -eq 0 ] [ "$output" == "Carthorse" ] } @test "does not detect a anagram if the original word is repeated" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "go" "go Go GO" [ "$status" -eq 0 ] [ "$output" == "" ] } @test "anagrams must use all letters exactly once" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "tapper" "patter" [ "$status" -eq 0 ] [ "$output" == "" ] } @test "capital word is not own anagram" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash anagram.sh "BANANA" "Banana" [ "$status" -eq 0 ] [ "$output" == "" ] diff --git a/exercises/armstrong-numbers/armstrong_numbers_test.sh b/exercises/armstrong-numbers/armstrong_numbers_test.sh index f3624c9c..ba3d6192 100755 --- a/exercises/armstrong-numbers/armstrong_numbers_test.sh +++ b/exercises/armstrong-numbers/armstrong_numbers_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test 'Single digits are Armstrong numbers' { - # skip + # [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 5 [ "$status" -eq 0 ] @@ -9,7 +9,7 @@ } @test 'There are no two digit Armstrong numbers' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 10 [ "$status" -eq 0 ] @@ -17,7 +17,7 @@ } @test 'A three digit number that is an Armstrong number' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 153 [ "$status" -eq 0 ] @@ -25,7 +25,7 @@ } @test 'A three digit number that is not an Armstrong number' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 100 [ "$status" -eq 0 ] @@ -33,7 +33,7 @@ } @test 'A four digit number that is an Armstrong number' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 9474 [ "$status" -eq 0 ] @@ -41,7 +41,7 @@ } @test 'A four digit number that is not an Armstrong number' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 9475 [ "$status" -eq 0 ] @@ -49,7 +49,7 @@ } @test 'A seven digit number that is an Armstrong number' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 9926315 [ "$status" -eq 0 ] @@ -57,7 +57,7 @@ } @test 'A seven digit number that is not an Armstrong number' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash armstrong_numbers.sh 9926314 [ "$status" -eq 0 ] diff --git a/exercises/atbash-cipher/atbash_cipher_test.sh b/exercises/atbash-cipher/atbash_cipher_test.sh index bc43c0db..fec3cb12 100644 --- a/exercises/atbash-cipher/atbash_cipher_test.sh +++ b/exercises/atbash-cipher/atbash_cipher_test.sh @@ -3,56 +3,56 @@ # encode @test "encode yes" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "yes" [ "$status" -eq 0 ] [ "$output" == "bvh" ] } @test "encode no" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "no" [ "$status" -eq 0 ] [ "$output" == "ml" ] } @test "encode OMG" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "OMG" [ "$status" -eq 0 ] [ "$output" == "lnt" ] } @test "encode spaces" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "O M G" [ "$status" -eq 0 ] [ "$output" == "lnt" ] } @test "encode mindblowingly" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "mindblowingly" [ "$status" -eq 0 ] [ "$output" == "nrmwy oldrm tob" ] } @test "encode numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "Testing,1 2 3, testing." [ "$status" -eq 0 ] [ "$output" == "gvhgr mt123 gvhgr mt" ] } @test "encode deep thought" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "Truth is fiction." [ "$status" -eq 0 ] [ "$output" == "gifgs rhurx grlm" ] } @test "encode all the letters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh encode "The quick brown fox jumps over the lazy dog." [ "$status" -eq 0 ] [ "$output" == "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" ] @@ -61,42 +61,42 @@ # decode @test "decode exercism" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh decode "vcvix rhn" [ "$status" -eq 0 ] [ "$output" == "exercism" ] } @test "decode a sentence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh decode "zmlyh gzxov rhlug vmzhg vkkrm thglm v" [ "$status" -eq 0 ] [ "$output" == "anobstacleisoftenasteppingstone" ] } @test "decode numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh decode "gvhgr mt123 gvhgr mt" [ "$status" -eq 0 ] [ "$output" == "testing123testing" ] } @test "decode all the letters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh decode "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" [ "$status" -eq 0 ] [ "$output" == "thequickbrownfoxjumpsoverthelazydog" ] } @test "decode with too many spaces" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh decode "vc vix r hn" [ "$status" -eq 0 ] [ "$output" == "exercism" ] } @test "decode with no spaces" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash atbash_cipher.sh decode "zmlyhgzxovrhlugvmzhgvkkrmthglmv" [ "$status" -eq 0 ] [ "$output" == "anobstacleisoftenasteppingstone" ] diff --git a/exercises/beer-song/README.md b/exercises/beer-song/README.md index 1002c592..292bb1ef 100644 --- a/exercises/beer-song/README.md +++ b/exercises/beer-song/README.md @@ -320,14 +320,19 @@ are some additional things you could try: Then please share your thoughts in a comment on the submission. Did this experiment make the code better? Worse? Did you learn anything from it? - Run the tests with: ```bash bats beer_song_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats beer_song_test.sh +``` ## Source diff --git a/exercises/beer-song/beer_song_test.sh b/exercises/beer-song/beer_song_test.sh index 3a71a836..ff7084b3 100644 --- a/exercises/beer-song/beer_song_test.sh +++ b/exercises/beer-song/beer_song_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test 'first_generic_verse' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected="99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall." run bash beer_song.sh 99 @@ -10,7 +10,7 @@ Take one down and pass it around, 98 bottles of beer on the wall." } @test '3rd_last_generic_verse' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="3 bottles of beer on the wall, 3 bottles of beer. Take one down and pass it around, 2 bottles of beer on the wall." run bash beer_song.sh 3 @@ -19,7 +19,7 @@ Take one down and pass it around, 2 bottles of beer on the wall." } @test '2nd_last_generic_verse' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2 bottles of beer on the wall, 2 bottles of beer. Take one down and pass it around, 1 bottle of beer on the wall." run bash beer_song.sh 2 @@ -28,7 +28,7 @@ Take one down and pass it around, 1 bottle of beer on the wall." } @test 'penultimate_verse' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="1 bottle of beer on the wall, 1 bottle of beer. Take it down and pass it around, no more bottles of beer on the wall." run bash beer_song.sh 1 @@ -37,7 +37,7 @@ Take it down and pass it around, no more bottles of beer on the wall." } @test 'verse_with_zero_bottles' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall." run bash beer_song.sh 0 @@ -46,7 +46,7 @@ Go to the store and buy some more, 99 bottles of beer on the wall." } @test 'first_two_verses' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall. @@ -58,7 +58,7 @@ Take one down and pass it around, 97 bottles of beer on the wall." } @test 'last_three_verses' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2 bottles of beer on the wall, 2 bottles of beer. Take one down and pass it around, 1 bottle of beer on the wall. @@ -74,7 +74,7 @@ Go to the store and buy some more, 99 bottles of beer on the wall." } @test 'all_verses' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall. @@ -381,21 +381,21 @@ Go to the store and buy some more, 99 bottles of beer on the wall." } @test 'no_arguments' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash beer_song.sh [[ $status -ne 0 ]] [[ $output == *"1 or 2 arguments expected"* ]] } @test 'too_many_arguments' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash beer_song.sh 1 2 3 [[ $status -ne 0 ]] [[ $output == *"1 or 2 arguments expected"* ]] } @test 'wrong_order_arguments' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash beer_song.sh 1 2 [[ $status -ne 0 ]] [[ $output = "Start must be greater than End" ]] diff --git a/exercises/binary-search/README.md b/exercises/binary-search/README.md index b74c44e7..3bf5934b 100644 --- a/exercises/binary-search/README.md +++ b/exercises/binary-search/README.md @@ -34,14 +34,19 @@ A binary search halves the number of items to check with each iteration, so locating an item (or determining its absence) takes logarithmic time. A binary search is a dichotomic divide and conquer search algorithm. - Run the tests with: ```bash bats binary_search_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats binary_search_test.sh +``` ## Source diff --git a/exercises/binary-search/binary_search_test.sh b/exercises/binary-search/binary_search_test.sh index 58bfe6a7..57765ab7 100644 --- a/exercises/binary-search/binary_search_test.sh +++ b/exercises/binary-search/binary_search_test.sh @@ -4,7 +4,7 @@ # sorted. Just assume that it is. @test "finds a value in an array with one element" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected=0 input=(6) run bash binary_search.sh 6 "${input[@]}" @@ -13,7 +13,7 @@ } @test "finds a value in the middle of an array" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected=3 input=(1 3 4 6 8 9 11) run bash binary_search.sh 6 "${input[@]}" @@ -22,7 +22,7 @@ } @test "finds a value at the beginning of an array" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected=0 input=(1 3 4 6 8 9 11) run bash binary_search.sh 1 "${input[@]}" @@ -31,7 +31,7 @@ } @test "finds a value at the end of an array" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected=6 input=(1 3 4 6 8 9 11) run bash binary_search.sh 11 "${input[@]}" @@ -40,7 +40,7 @@ } @test "finds a value in an array of odd length" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected=9 input=(1 3 5 8 13 21 34 55 89 144 233 377 634) run bash binary_search.sh 144 "${input[@]}" @@ -49,7 +49,7 @@ } @test "finds a value in an array of even length" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected=5 input=(1 3 5 8 13 21 34 55 89 144 233 377) run bash binary_search.sh 21 "${input[@]}" @@ -60,7 +60,7 @@ # error cases @test "identifies that a value is not included in the array" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="-1" input=(1 3 4 6 8 9 11) run bash binary_search.sh 7 "${input[@]}" @@ -69,7 +69,7 @@ } @test "a value smaller than the array's smallest value is not found" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="-1" input=(1 3 4 6 8 9 11) run bash binary_search.sh 0 "${input[@]}" @@ -78,7 +78,7 @@ } @test "a value larger than the array's largest value is not found" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="-1" input=(1 3 4 6 8 9 11) run bash binary_search.sh 13 "${input[@]}" @@ -87,7 +87,7 @@ } @test "nothing is found in an empty array" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="-1" input=() run bash binary_search.sh 1 "${input[@]}" @@ -96,7 +96,7 @@ } @test "nothing is found when the left and right bounds cross" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="-1" input=(1 2) run bash binary_search.sh 0 "${input[@]}" diff --git a/exercises/bob/bob_test.sh b/exercises/bob/bob_test.sh index 76805265..87224378 100755 --- a/exercises/bob/bob_test.sh +++ b/exercises/bob/bob_test.sh @@ -1,182 +1,182 @@ #!/usr/bin/env bash @test "stating something" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'Tom-ay-to, tom-aaaah-to.' [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "shouting" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'WATCH OUT!' [ "$status" -eq 0 ] [ "$output" == "Whoa, chill out!" ] } @test "shouting gibberish" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'FCECDFCAAB' [ "$status" -eq 0 ] [ "$output" == "Whoa, chill out!" ] } @test "asking a question" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'Does this cryogenic chamber make me look fat?' [ "$status" -eq 0 ] [ "$output" == "Sure." ] } @test "asking a numeric question" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'You are, what, like 15?' [ "$status" -eq 0 ] [ "$output" == "Sure." ] } @test "asking gibberish" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'fffbbcbeab?' [ "$status" -eq 0 ] [ "$output" == "Sure." ] } @test "talking forcefully" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh "Let's go make out behind the gym!" [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "using acronyms in regular speech" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh "It's OK if you don't want to go to the DMV." [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "forceful question" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'WHAT THE HELL WERE YOU THINKING?' [ "$status" -eq 0 ] [ "$output" == "Calm down, I know what I'm doing!" ] } @test "shouting numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh '1, 2, 3 GO!' [ "$status" -eq 0 ] [ "$output" == "Whoa, chill out!" ] } @test "no letters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh '1, 2, 3' [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "question with no letters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh '4?' [ "$status" -eq 0 ] [ "$output" == "Sure." ] } @test "shouting with special characters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!' [ "$status" -eq 0 ] [ "$output" == "Whoa, chill out!" ] } @test "shouting with no exclamation mark" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'I HATE THE DMV' [ "$status" -eq 0 ] [ "$output" == "Whoa, chill out!" ] } @test "statement containing question mark" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'Ending with ? means a question.' [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "non-letters with question" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh ':) ?' [ "$status" -eq 0 ] [ "$output" == "Sure." ] } @test "prattling on" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'Wait! Hang on. Are you going to be OK?' [ "$status" -eq 0 ] [ "$output" == "Sure." ] } @test "silence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh '' [ "$status" -eq 0 ] [ "$output" == "Fine. Be that way!" ] } @test "prolonged silence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh ' ' [ "$status" -eq 0 ] [ "$output" == "Fine. Be that way!" ] } @test "alternate silence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh $'\t\t\t\t\t\t\t\t\t\t' [ "$status" -eq 0 ] [ "$output" == "Fine. Be that way!" ] } @test "multiple line question" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh $'\nDoes this cryogenic chamber make me look fat?\nNo' [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "starting with whitespace" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh ' hmmmmmmm...' [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "ending with whitespace" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'Okay if like my spacebar quite a bit? ' [ "$status" -eq 0 ] [ "$output" == "Sure." ] } # This test might act differently depending on your platform @test "other whitespace" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh $'\n\r \t' [ "$status" -eq 0 ] [ "$output" == "Fine. Be that way!" ] } @test "non-question ending with whitespace" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh 'This is a statement ending with whitespace ' [ "$status" -eq 0 ] [ "$output" == "Whatever." ] } @test "no input is silence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash bob.sh [ "$status" -eq 0 ] [ "$output" == "Fine. Be that way!" ] diff --git a/exercises/change/README.md b/exercises/change/README.md index 322acf26..319c0e68 100644 --- a/exercises/change/README.md +++ b/exercises/change/README.md @@ -16,14 +16,19 @@ that the sum of the coins' value would equal the correct amount of change. - Can you ask for negative change? - Can you ask for a change value smaller than the smallest coin value? - Run the tests with: ```bash bats change_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats change_test.sh +``` ## Source diff --git a/exercises/change/change_test.sh b/exercises/change/change_test.sh index 2f79a82c..5bd45639 100644 --- a/exercises/change/change_test.sh +++ b/exercises/change/change_test.sh @@ -2,7 +2,7 @@ @test "single coin change" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected="25" coins=(1 5 10 25 100) run bash change.sh 25 "${coins[@]}" @@ -11,7 +11,7 @@ } @test "multiple coin change" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="5 10" coins=(1 5 10 25 100) run bash change.sh 15 "${coins[@]}" @@ -20,7 +20,7 @@ } @test "change with Lilliputian Coins" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="4 4 15" coins=(1 4 15 20 50) run bash change.sh 23 "${coins[@]}" @@ -29,7 +29,7 @@ } @test "change with Lower Elbonia Coins" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="21 21 21" coins=(1 5 10 21 25) run bash change.sh 63 "${coins[@]}" @@ -38,7 +38,7 @@ } @test "large target values" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2 2 5 20 20 50 100 100 100 100 100 100 100 100 100" coins=(1 2 5 10 20 50 100) run bash change.sh 999 "${coins[@]}" @@ -47,7 +47,7 @@ } @test "possible change without unit coins available" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2 2 2 5 10" coins=(2 5 10 20 50) run bash change.sh 21 "${coins[@]}" @@ -56,7 +56,7 @@ } @test "another possible change without unit coins available" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="4 4 4 5 5 5" coins=(4 5) run bash change.sh 27 "${coins[@]}" @@ -65,7 +65,7 @@ } @test "no coins make 0 change" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="" coins=(1 5 10 21 25) run bash change.sh 0 "${coins[@]}" @@ -74,7 +74,7 @@ } @test "error testing for change smaller than the smallest of coins" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="can't make target with given coins" coins=(5 10) run bash change.sh 3 "${coins[@]}" @@ -83,7 +83,7 @@ } @test "error if no combination can add up to target" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="can't make target with given coins" coins=(5 10) run bash change.sh 94 "${coins[@]}" @@ -92,7 +92,7 @@ } @test "cannot find negative change values" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="target can't be negative" coins=(1 2 5) run bash change.sh -5 "${coins[@]}" diff --git a/exercises/collatz-conjecture/collatz_conjecture_test.sh b/exercises/collatz-conjecture/collatz_conjecture_test.sh index 4cc97bd5..b97c6a75 100755 --- a/exercises/collatz-conjecture/collatz_conjecture_test.sh +++ b/exercises/collatz-conjecture/collatz_conjecture_test.sh @@ -1,42 +1,42 @@ #!/usr/bin/env bash @test "zero steps for one" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash collatz_conjecture.sh 1 [ "$status" -eq 0 ] [ "$output" -eq 0 ] } @test "divide if even" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash collatz_conjecture.sh 16 [ "$status" -eq 0 ] [ "$output" -eq 4 ] } @test "even and odd steps" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash collatz_conjecture.sh 12 [ "$status" -eq 0 ] [ "$output" -eq 9 ] } @test "large number of even and odd steps" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash collatz_conjecture.sh 1000000 [ "$status" -eq 0 ] [ "$output" -eq 152 ] } @test "zero is an error" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash collatz_conjecture.sh 0 [ "$status" -eq 1 ] [ "$output" == "Error: Only positive numbers are allowed" ] } @test "negative value is an error" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash collatz_conjecture.sh -15 [ "$status" -eq 1 ] [ "$output" == "Error: Only positive numbers are allowed" ] diff --git a/exercises/diamond/diamond_test.sh b/exercises/diamond/diamond_test.sh index a44ea780..2b7fa8db 100644 --- a/exercises/diamond/diamond_test.sh +++ b/exercises/diamond/diamond_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "Degenerate case with a single 'A' row" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected="$(cat << EOT A EOT @@ -12,7 +12,7 @@ EOT } @test "Degenerate case with no row containing 3 distinct groups of spaces" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="$(cat << EOT A B B @@ -25,7 +25,7 @@ EOT } @test "Smallest non-degenerate case with odd diamond side length" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="$(cat << EOT A B B @@ -40,7 +40,7 @@ EOT } @test "Smallest non-degenerate case with even diamond side length" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="$(cat << EOT A B B @@ -57,7 +57,7 @@ EOT } @test "Largest possible diamond" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="$(cat << EOT A B B diff --git a/exercises/difference-of-squares/difference_of_squares_test.sh b/exercises/difference-of-squares/difference_of_squares_test.sh index 15f465cb..c8639fa9 100755 --- a/exercises/difference-of-squares/difference_of_squares_test.sh +++ b/exercises/difference-of-squares/difference_of_squares_test.sh @@ -2,63 +2,63 @@ # Square the sum of the numbers up to the given number @test "square of sum 1" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh square_of_sum 1 [ "$status" -eq 0 ] [ "$output" = "1" ] } @test "square of sum 5" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh square_of_sum 5 [ "$status" -eq 0 ] [ "$output" = "225" ] } @test "square of sum 100" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh square_of_sum 100 [ "$status" -eq 0 ] [ "$output" = "25502500" ] } # Sum the squares of the numbers up to the given number @test "sum of squares 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh sum_of_squares 1 [ "$status" -eq 0 ] [ "$output" = "1" ] } @test "sum of squares 5" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh sum_of_squares 5 [ "$status" -eq 0 ] [ "$output" = "55" ] } @test "sum of squares 100" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh sum_of_squares 100 [ "$status" -eq 0 ] [ "$output" = "338350" ] } # Subtract sum of squares from square of sums @test "difference of squares 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh difference 1 [ "$status" -eq 0 ] [ "$output" = "0" ] } @test "difference of squares 5" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh difference 5 [ "$status" -eq 0 ] [ "$output" = "170" ] } @test "difference of squares 100" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash difference_of_squares.sh difference 100 [ "$status" -eq 0 ] [ "$output" = "25164150" ] diff --git a/exercises/diffie-hellman/README.md b/exercises/diffie-hellman/README.md index bb773e71..99fc8001 100644 --- a/exercises/diffie-hellman/README.md +++ b/exercises/diffie-hellman/README.md @@ -37,14 +37,19 @@ Bob calculates The calculations produce the same result! Alice and Bob now share secret s. - Run the tests with: ```bash bats diffie_hellman_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats diffie_hellman_test.sh +``` ## Source diff --git a/exercises/diffie-hellman/diffie_hellman_test.sh b/exercises/diffie-hellman/diffie_hellman_test.sh index b3bb1b63..c5704ca8 100644 --- a/exercises/diffie-hellman/diffie_hellman_test.sh +++ b/exercises/diffie-hellman/diffie_hellman_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "private key is in range" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip for i in 5 7 11 13 17 19 23 29 31 27 41 43 47; do run bash diffie_hellman.sh privateKey $i [[ $status -eq 0 ]] @@ -10,7 +10,7 @@ } @test "private key is random" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip # may fail due to randomness local -A keys=() local -i n=10 p=32000 @@ -23,7 +23,7 @@ } @test "can calculate public key using private key" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="8" local -i p=23 g=5 private=6 run bash diffie_hellman.sh publicKey $p $g $private @@ -32,7 +32,7 @@ } @test "can calculate secret key using other's public key" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2" local -i p=23 public=19 private=6 run bash diffie_hellman.sh secret $p $public $private @@ -41,7 +41,7 @@ } @test "key exchange" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip local -i i p=23 g=5 local -i alicePublic alicePrivate secret1 local -i bobPublic bobPrivate secret2 diff --git a/exercises/error-handling/error_handling_test.sh b/exercises/error-handling/error_handling_test.sh index 38eba5a7..b6187f10 100755 --- a/exercises/error-handling/error_handling_test.sh +++ b/exercises/error-handling/error_handling_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "correct arguments" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash error_handling.sh Alice [ "$status" -eq 0 ] @@ -9,7 +9,7 @@ } @test "one long argument" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash error_handling.sh "Alice and Bob" [ "$status" -eq 0 ] @@ -17,7 +17,7 @@ } @test "incorrect arguments" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash error_handling.sh Alice Bob [ "$status" -eq 1 ] @@ -25,7 +25,7 @@ } @test "print usage banner with no value given" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash error_handling.sh [ "$status" -eq 1 ] @@ -33,7 +33,7 @@ } @test "empty argument" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash error_handling.sh "" [ "$status" -eq 0 ] diff --git a/exercises/food-chain/README.md b/exercises/food-chain/README.md index 0320914f..975482ea 100644 --- a/exercises/food-chain/README.md +++ b/exercises/food-chain/README.md @@ -63,14 +63,19 @@ I know an old lady who swallowed a horse. She's dead, of course! ``` - Run the tests with: ```bash bats food_chain_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats food_chain_test.sh +``` ## Source diff --git a/exercises/food-chain/food_chain_test.sh b/exercises/food-chain/food_chain_test.sh index bb2485b7..d0b4184e 100644 --- a/exercises/food-chain/food_chain_test.sh +++ b/exercises/food-chain/food_chain_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test 'fly' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a fly. I don't know why she swallowed the fly. Perhaps she'll die." run bash food_chain.sh 1 1 @@ -10,7 +10,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'spider' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a spider. It wriggled and jiggled and tickled inside her. She swallowed the spider to catch the fly. @@ -21,7 +21,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'bird' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a bird. How absurd to swallow a bird! She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her. @@ -33,7 +33,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'cat' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a cat. Imagine that, to swallow a cat! She swallowed the cat to catch the bird. @@ -46,7 +46,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'dog' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a dog. What a hog, to swallow a dog! She swallowed the dog to catch the cat. @@ -60,7 +60,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'goat' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a goat. Just opened her throat and swallowed a goat! She swallowed the goat to catch the dog. @@ -75,7 +75,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'cow' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a cow. I don't know how she swallowed a cow! She swallowed the cow to catch the goat. @@ -91,7 +91,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'horse' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a horse. She's dead, of course!" run bash food_chain.sh 8 8 @@ -100,7 +100,7 @@ She's dead, of course!" } @test 'multiple_verses' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a fly. I don't know why she swallowed the fly. Perhaps she'll die. @@ -120,7 +120,7 @@ I don't know why she swallowed the fly. Perhaps she'll die." } @test 'full_song' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="I know an old lady who swallowed a fly. I don't know why she swallowed the fly. Perhaps she'll die. @@ -177,21 +177,21 @@ She's dead, of course!" } @test 'no_arguments' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash food_chain.sh [[ $status -ne 0 ]] [[ $output == *"2 arguments expected"* ]] } @test 'too_many_arguments' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash food_chain.sh 1 2 3 [[ $status -ne 0 ]] [[ $output == *"2 arguments expected"* ]] } @test 'wrong_order_arguments' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash food_chain.sh 8 1 [[ $status -ne 0 ]] [[ $output = *"Start must be less than or equal to End"* ]] diff --git a/exercises/forth/README.md b/exercises/forth/README.md index f23aa27b..67850f14 100644 --- a/exercises/forth/README.md +++ b/exercises/forth/README.md @@ -25,16 +25,19 @@ enough.) Words are case-insensitive. - Run the tests with: ```bash bats forth_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. +To run all tests, including the ones with `skip` annotations, run: +```bash +BATS_RUN_SKIPPED=true bats forth_test.sh +``` ## External utilities `Bash` is a language to write scripts that works closely with various system utilities, diff --git a/exercises/forth/forth_test.sh b/exercises/forth/forth_test.sh index e4a6f04a..38a4acb2 100644 --- a/exercises/forth/forth_test.sh +++ b/exercises/forth/forth_test.sh @@ -2,7 +2,7 @@ # parsing and numbers @test numbers_only { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash forth.sh < ' ] diff --git a/exercises/house/README.md b/exercises/house/README.md index 4773b156..e08f3467 100644 --- a/exercises/house/README.md +++ b/exercises/house/README.md @@ -105,14 +105,19 @@ that ate the malt that lay in the house that Jack built. ``` - Run the tests with: ```bash bats house_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats house_test.sh +``` ## Source diff --git a/exercises/house/house_test.sh b/exercises/house/house_test.sh index 5621df9b..ed49722e 100644 --- a/exercises/house/house_test.sh +++ b/exercises/house/house_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "verse 1" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected="This is the house that Jack built." run bash house.sh 1 1 [[ $status -eq 0 ]] @@ -9,7 +9,7 @@ } @test "verse 2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected=$(cat < for more details. - Run the tests with: ```bash bats pig_latin_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats pig_latin_test.sh +``` ## Source diff --git a/exercises/pig-latin/pig_latin_test.sh b/exercises/pig-latin/pig_latin_test.sh index dc546415..e64bf4b0 100644 --- a/exercises/pig-latin/pig_latin_test.sh +++ b/exercises/pig-latin/pig_latin_test.sh @@ -3,42 +3,42 @@ # "ay" is added to words that start with vowels @test word_beginning_with_a { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh apple [[ $status -eq 0 ]] [[ $output == "appleay" ]] } @test word_beginning_with_e { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh ear [[ $status -eq 0 ]] [[ $output == "earay" ]] } @test word_beginning_with_i { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh igloo [[ $status -eq 0 ]] [[ $output == "iglooay" ]] } @test word_beginning_with_o { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh object [[ $status -eq 0 ]] [[ $output == "objectay" ]] } @test word_beginning_with_u { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh under [[ $status -eq 0 ]] [[ $output == "underay" ]] } @test word_beginning_with_equ { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh equal [[ $status -eq 0 ]] [[ $output == "equalay" ]] @@ -47,28 +47,28 @@ # first letter and ay are moved to the end of words that start with consonants @test word_beginning_with_p { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh pig [[ $status -eq 0 ]] [[ $output == "igpay" ]] } @test word_beginning_with_k { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh koala [[ $status -eq 0 ]] [[ $output == "oalakay" ]] } @test word_beginning_with_x { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh xenon [[ $status -eq 0 ]] [[ $output == "enonxay" ]] } @test word_beginning_with_q_no_u { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh qat [[ $status -eq 0 ]] [[ $output == "atqay" ]] @@ -77,35 +77,35 @@ # some letter clusters are treated like a single consonant @test word_beginning_with_ch { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh chair [[ $status -eq 0 ]] [[ $output == "airchay" ]] } @test word_beginning_with_squ { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh square [[ $status -eq 0 ]] [[ $output == "aresquay" ]] } @test word_beginning_with_th { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh therapy [[ $status -eq 0 ]] [[ $output == "erapythay" ]] } @test word_beginning_with_thr { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh thrush [[ $status -eq 0 ]] [[ $output == "ushthray" ]] } @test word_beginning_with_sch { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh school [[ $status -eq 0 ]] [[ $output == "oolschay" ]] @@ -114,14 +114,14 @@ # some letter clusters are treated like a single vowel @test word_beginning_with_yt { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh yttria [[ $status -eq 0 ]] [[ $output == "yttriaay" ]] } @test word_beginning_with_xr { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh xray [[ $status -eq 0 ]] [[ $output == "xrayay" ]] @@ -130,21 +130,21 @@ # position of y in a word determines if it is a consonant or a vowel @test word_beginning_with_y { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh yellow [[ $status -eq 0 ]] [[ $output == "ellowyay" ]] } @test word_rhythm { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh rhythm [[ $status -eq 0 ]] [[ $output == "ythmrhay" ]] } @test word_my { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh my [[ $status -eq 0 ]] [[ $output == "ymay" ]] @@ -152,7 +152,7 @@ # phrases are translated @test a_whole_phrase { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pig_latin.sh quick fast run [[ $status -eq 0 ]] [[ $output == "ickquay astfay unray" ]] diff --git a/exercises/prime-factors/README.md b/exercises/prime-factors/README.md index 1dc1adee..af6d059b 100644 --- a/exercises/prime-factors/README.md +++ b/exercises/prime-factors/README.md @@ -29,14 +29,19 @@ You can check this yourself: - = 60 - Success! - Run the tests with: ```bash bats prime_factors_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats prime_factors_test.sh +``` ## Source diff --git a/exercises/prime-factors/prime_factors_test.sh b/exercises/prime-factors/prime_factors_test.sh index 520cc44d..97df59ba 100644 --- a/exercises/prime-factors/prime_factors_test.sh +++ b/exercises/prime-factors/prime_factors_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "no factors" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected="" run bash prime_factors.sh 1 [[ $status -eq 0 ]] @@ -9,7 +9,7 @@ } @test "prime number" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2" run bash prime_factors.sh 2 [[ $status -eq 0 ]] @@ -17,7 +17,7 @@ } @test "square of a prime" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="3 3" run bash prime_factors.sh 9 [[ $status -eq 0 ]] @@ -25,7 +25,7 @@ } @test "cube of a prime" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2 2 2" run bash prime_factors.sh 8 [[ $status -eq 0 ]] @@ -33,7 +33,7 @@ } @test "product of primes and non-primes" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="2 2 3" run bash prime_factors.sh 12 [[ $status -eq 0 ]] @@ -41,7 +41,7 @@ } @test "product of primes" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="5 17 23 461" run bash prime_factors.sh 901255 [[ $status -eq 0 ]] @@ -49,7 +49,7 @@ } @test "factors include a large prime" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected="11 9539 894119" run bash prime_factors.sh 93819012551 [[ $status -eq 0 ]] diff --git a/exercises/protein-translation/README.md b/exercises/protein-translation/README.md index 6e56607d..f3652f46 100644 --- a/exercises/protein-translation/README.md +++ b/exercises/protein-translation/README.md @@ -41,14 +41,19 @@ UAA, UAG, UGA | STOP Learn more about [protein translation on Wikipedia](http://en.wikipedia.org/wiki/Translation_(biology)) - Run the tests with: ```bash bats protein_translation_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats protein_translation_test.sh +``` ## Source diff --git a/exercises/protein-translation/protein_translation_test.sh b/exercises/protein-translation/protein_translation_test.sh index c487f2fd..6c5939d4 100644 --- a/exercises/protein-translation/protein_translation_test.sh +++ b/exercises/protein-translation/protein_translation_test.sh @@ -3,168 +3,168 @@ # Translate input RNA sequences into proteins @test "Methionine RNA sequence" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "AUG" [[ $status -eq 0 ]] [[ $output == "Methionine" ]] } @test "Phenylalanine RNA sequence 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UUU" [[ $status -eq 0 ]] [[ $output == "Phenylalanine" ]] } @test "Phenylalanine RNA sequence 2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UUC" [[ $status -eq 0 ]] [[ $output == "Phenylalanine" ]] } @test "Leucine RNA sequence 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UUA" [[ $status -eq 0 ]] [[ $output == "Leucine" ]] } @test "Leucine RNA sequence 2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UUG" [[ $status -eq 0 ]] [[ $output == "Leucine" ]] } @test "Serine RNA sequence 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UCU" [[ $status -eq 0 ]] [[ $output == "Serine" ]] } @test "Serine RNA sequence 2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UCC" [[ $status -eq 0 ]] [[ $output == "Serine" ]] } @test "Serine RNA sequence 3" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UCA" [[ $status -eq 0 ]] [[ $output == "Serine" ]] } @test "Serine RNA sequence 4" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UCG" [[ $status -eq 0 ]] [[ $output == "Serine" ]] } @test "Tyrosine RNA sequence 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UAU" [[ $status -eq 0 ]] [[ $output == "Tyrosine" ]] } @test "Tyrosine RNA sequence 2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UAC" [[ $status -eq 0 ]] [[ $output == "Tyrosine" ]] } @test "Cysteine RNA sequence 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGU" [[ $status -eq 0 ]] [[ $output == "Cysteine" ]] } @test "Cysteine RNA sequence 2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGC" [[ $status -eq 0 ]] [[ $output == "Cysteine" ]] } @test "Tryptophan RNA sequence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGG" [[ $status -eq 0 ]] [[ $output == "Tryptophan" ]] } @test "STOP codon RNA sequence 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UAA" [[ $status -eq 0 ]] [[ $output == "" ]] } @test "STOP codon RNA sequence 2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UAG" [[ $status -eq 0 ]] [[ $output == "" ]] } @test "STOP codon RNA sequence 3" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGA" [[ $status -eq 0 ]] [[ $output == "" ]] } @test "Translate RNA strand into correct protein list" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "AUGUUUUGG" [[ $status -eq 0 ]] [[ $output == "Methionine Phenylalanine Tryptophan" ]] } @test "Translation stops if STOP codon at beginning of sequence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UAGUGG" [[ $status -eq 0 ]] [[ $output == "" ]] } @test "Translation stops if STOP codon at end of two-codon sequence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGGUAG" [[ $status -eq 0 ]] [[ $output == "Tryptophan" ]] } @test "Translation stops if STOP codon at end of three-codon sequence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "AUGUUUUAA" [[ $status -eq 0 ]] [[ $output == "Methionine Phenylalanine" ]] } @test "Translation stops if STOP codon in middle of three-codon sequence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGGUAGUGG" [[ $status -eq 0 ]] [[ $output == "Tryptophan" ]] } @test "Translation stops if STOP codon in middle of six-codon sequence" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGGUGUUAUUAAUGGUUU" [[ $status -eq 0 ]] [[ $output == "Tryptophan Cysteine Tyrosine" ]] } @test "Error case" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash protein_translation.sh "UGG---AUG" [[ $status -eq 1 ]] [[ $output == "Invalid codon" ]] diff --git a/exercises/proverb/README.md b/exercises/proverb/README.md index 09760806..3f0303dc 100644 --- a/exercises/proverb/README.md +++ b/exercises/proverb/README.md @@ -16,14 +16,19 @@ And all for the want of a nail. Note that the list of inputs may vary; your solution should be able to handle lists of arbitrary length and content. No line of the output text should be a static, unchanging string; all should vary according to the input given. - Run the tests with: ```bash bats proverb_test.sh ``` -After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests. +After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests. + +To run all tests, including the ones with `skip` annotations, run: + +```bash +BATS_RUN_SKIPPED=true bats proverb_test.sh +``` ## Source diff --git a/exercises/proverb/proverb_test.sh b/exercises/proverb/proverb_test.sh index 4335d9ad..df12f997 100644 --- a/exercises/proverb/proverb_test.sh +++ b/exercises/proverb/proverb_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "zero pieces" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip expected="" run bash proverb.sh [[ $status -eq 0 ]] @@ -9,7 +9,7 @@ } @test "one piece" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip expected=$(cat <