From dba1f63d4e2b5831d3a4107ffd559785c30fd466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindstr=C3=B6m?= Date: Thu, 16 May 2019 11:34:40 +0700 Subject: [PATCH 1/2] Enable running all tests with unmodified file These skips are to many an annoyance when using bats, since it doesn't have any command line flag to ignore skipped tests. By setting the environment variable $BATS_RUN_SKIPPED to `true`, you can now get bats to run all tests for the exercise. Also, moved instructive comment in test file for gigasecond to two-fer. This seems to fit better here than in gigasecond, since this is the first exercise on the track with skips. --- _template/exercise_slug_test.sh | 4 +- bin/validate_exercises | 5 +- config/exercise_readme.go.tmpl | 8 ++- exercises/acronym/acronym_test.sh | 12 ++--- exercises/affine-cipher/affine_cipher_test.sh | 32 ++++++------ exercises/anagram/anagram_test.sh | 24 ++++----- .../armstrong_numbers_test.sh | 16 +++--- exercises/atbash-cipher/atbash_cipher_test.sh | 28 +++++----- exercises/bob/bob_test.sh | 52 +++++++++---------- .../collatz_conjecture_test.sh | 12 ++--- exercises/diamond/diamond_test.sh | 10 ++-- .../difference_of_squares_test.sh | 18 +++---- .../error-handling/error_handling_test.sh | 10 ++-- exercises/gigasecond/gigasecond_test.sh | 15 ++---- exercises/grains/grains_test.sh | 22 ++++---- exercises/hamming/hamming_test.sh | 16 +++--- exercises/isbn-verifier/isbn_verifier_test.sh | 34 ++++++------ exercises/isogram/isogram_test.sh | 24 ++++----- exercises/leap/leap_test.sh | 16 +++--- exercises/luhn/luhn_test.sh | 28 +++++----- .../nucleotide-count/nucleotide_count_test.sh | 10 ++-- exercises/pangram/pangram_test.sh | 20 +++---- exercises/phone-number/phone_number_test.sh | 28 +++++----- exercises/raindrops/raindrops_test.sh | 36 ++++++------- .../reverse-string/reverse_string_test.sh | 10 ++-- .../rna_transcription_test.sh | 18 +++---- .../roman-numerals/roman_numerals_test.sh | 38 +++++++------- .../scrabble-score/scrabble_score_test.sh | 22 ++++---- exercises/triangle/triangle_test.sh | 34 ++++++------ exercises/two-fer/two_fer_test.sh | 20 +++++-- exercises/word-count/word_count_test.sh | 22 ++++---- 31 files changed, 328 insertions(+), 316 deletions(-) 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/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/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/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/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/gigasecond/gigasecond_test.sh b/exercises/gigasecond/gigasecond_test.sh index 602798a6..785a4d31 100755 --- a/exercises/gigasecond/gigasecond_test.sh +++ b/exercises/gigasecond/gigasecond_test.sh @@ -1,12 +1,7 @@ #!/usr/bin/env bash @test 'date only specificaion of time' { - # this is used to skip the test - # normally, we skip every test except for the first one - # (the first one is always commented out) - # this allows for a person to focus on solving a test at a time - # you can comment out or delete the `skip` to run the test when ready - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash gigasecond.sh '2011-04-25Z' [ "$status" -eq 0 ] @@ -14,7 +9,7 @@ } @test 'second test for date only specification of time' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash gigasecond.sh '1977-06-13Z' [ "$status" -eq 0 ] @@ -22,7 +17,7 @@ } @test 'third test for date only specification of time' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash gigasecond.sh '1959-07-19Z' [ "$status" -eq 0 ] @@ -30,7 +25,7 @@ } @test 'full time specified' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash gigasecond.sh '2015-01-24 22:00:00Z' [ "$status" -eq 0 ] @@ -38,7 +33,7 @@ } @test 'full time with day roll-over' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash gigasecond.sh '2015-01-24 23:59:59Z' [ "$status" -eq 0 ] diff --git a/exercises/grains/grains_test.sh b/exercises/grains/grains_test.sh index 1f41682e..9ee5a78e 100755 --- a/exercises/grains/grains_test.sh +++ b/exercises/grains/grains_test.sh @@ -1,77 +1,77 @@ #!/usr/bin/env bash @test "1" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 1 [ "$status" -eq 0 ] [ "$output" == "1" ] } @test "2" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 2 [ "$status" -eq 0 ] [ "$output" == "2" ] } @test "3" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 3 [ "$status" -eq 0 ] [ "$output" == "4" ] } @test "4" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 4 [ "$status" -eq 0 ] [ "$output" == "8" ] } @test "16" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 16 [ "$status" -eq 0 ] [ "$output" == "32768" ] } @test "32" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 32 [ "$status" -eq 0 ] [ "$output" == "2147483648" ] } @test "64" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 64 [ "$status" -eq 0 ] [ "$output" == "9223372036854775808" ] } @test "square 0 raises an exception" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 0 [ "$status" -eq 1 ] [ "$output" == "Error: invalid input" ] } @test "negative square raises an exception" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh -1 [ "$status" -eq 1 ] [ "$output" == "Error: invalid input" ] } @test "square greater than 64 raises an exception" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh 65 [ "$status" -eq 1 ] [ "$output" == "Error: invalid input" ] } @test "returns the total number of grains on the board" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash grains.sh total [ "$status" -eq 0 ] [ "$output" == "18446744073709551615" ] diff --git a/exercises/hamming/hamming_test.sh b/exercises/hamming/hamming_test.sh index fa85ace1..50817935 100755 --- a/exercises/hamming/hamming_test.sh +++ b/exercises/hamming/hamming_test.sh @@ -1,56 +1,56 @@ #!/usr/bin/env bash @test 'empty strands' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh '' '' [ "$status" -eq 0 ] [ "$output" -eq 0 ] } @test 'single letter identical strands' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh 'A' 'A' [ "$status" -eq 0 ] [ "$output" -eq 0 ] } @test 'single letter different strands' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh 'G' 'T' [ "$status" -eq 0 ] [ "$output" -eq 1 ] } @test 'long identical strands' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh 'GGACTGAAATCTG' 'GGACTGAAATCTG' [ "$status" -eq 0 ] [ "$output" -eq 0 ] } @test 'long different strands' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh 'GGACGGATTCTG' 'AGGACGGATTCT' [ "$status" -eq 0 ] [ "$output" -eq 9 ] } @test 'disallow first strand longer' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh 'AATG' 'AAA' [ "$status" -eq 1 ] [ "$output" == 'left and right strands must be of equal length' ] } @test 'disallow second strand longer' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh 'ATA' 'AGTG' [ "$status" -eq 1 ] [ "$output" == 'left and right strands must be of equal length' ] } @test "no input" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash hamming.sh [ "$status" -eq 1 ] [ "$output" == 'Usage: hamming.sh ' ] diff --git a/exercises/isbn-verifier/isbn_verifier_test.sh b/exercises/isbn-verifier/isbn_verifier_test.sh index 3d88d662..40cfeb9b 100644 --- a/exercises/isbn-verifier/isbn_verifier_test.sh +++ b/exercises/isbn-verifier/isbn_verifier_test.sh @@ -1,119 +1,119 @@ #!/usr/bin/env bash @test 'valid isbn number' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-21508-8' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'invalid isbn check digit' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-21508-9' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'valid isbn number with a check digit of 10' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-21507-X' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'check digit is a character other than X' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-21507-A' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'invalid character in isbn' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-P1581-X' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'X is only valid as a check digit' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-2X507-9' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'valid isbn without separating dashes' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3598215088' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'isbn without separating dashes and X as check digit' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '359821507X' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'isbn without check digit and dashes' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '359821507' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'too long isbn and no dashes' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3598215078X' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'too short isbn' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '00' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'isbn without check digit' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-21507' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'check digit of X should not be used for 0' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3-598-21515-X' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'empty isbn' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'input is 9 characters' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '134456729' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'invalid characters are not ignored' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '3132P34035' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'input is too long but contains a valid isbn' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isbn_verifier.sh '98245726788' [ "$status" -eq 0 ] [ "$output" == 'false' ] diff --git a/exercises/isogram/isogram_test.sh b/exercises/isogram/isogram_test.sh index d9f6b6f9..f92989c9 100644 --- a/exercises/isogram/isogram_test.sh +++ b/exercises/isogram/isogram_test.sh @@ -3,84 +3,84 @@ # Check if the given string is an isogram @test 'empty string' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh '' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'isogram with only lower case characters' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'isogram' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'word with one duplicated character' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'eleven' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'word with one duplicated character from the end of the alphabet' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'zzyzx' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'longest reported english isogram' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'subdermatoglyphic' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'word with duplicated character in mixed case' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'Alphabet' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'hypothetical isogrammic word with hyphen' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'thumbscrew-japingly' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'isogram with duplicated hyphen' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'six-year-old' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'made-up name that is an isogram' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'Emily Jung Schwartzkopf' [ "$status" -eq 0 ] [ "$output" == 'true' ] } @test 'duplicated character in the middle' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'accentor' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'word with duplicated character in mixed case, lowercase first' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'alphAbet' [ "$status" -eq 0 ] [ "$output" == 'false' ] } @test 'same first and last characters' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash isogram.sh 'angola' [ "$status" -eq 0 ] [ "$output" == 'false' ] diff --git a/exercises/leap/leap_test.sh b/exercises/leap/leap_test.sh index bc2db4c8..29e9ecb8 100755 --- a/exercises/leap/leap_test.sh +++ b/exercises/leap/leap_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test 'year not divisible by 4: common year' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh 2015 [ "$status" -eq 0 ] @@ -9,7 +9,7 @@ } @test 'year divisible by 4, not divisible by 100: leap year' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh 1996 [ "$status" -eq 0 ] @@ -17,7 +17,7 @@ } @test 'year divisible by 100, not divisible by 400: common year' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh 2100 [ "$status" -eq 0 ] @@ -25,7 +25,7 @@ } @test 'year divisible by 400: leap year' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh 2000 [ "$status" -eq 0 ] @@ -33,7 +33,7 @@ } @test 'No input should return an error' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh [ "$status" -eq 1 ] @@ -41,7 +41,7 @@ } @test 'Too many arguments should return an error' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh 2016 4562 4566 [ "$status" -eq 1 ] @@ -49,7 +49,7 @@ } @test 'Float number input should return an error' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh 2016.54 [ "$status" -eq 1 ] @@ -57,7 +57,7 @@ } @test 'Alpha input should return an error' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash leap.sh 'abcd' [ "$status" -eq 1 ] diff --git a/exercises/luhn/luhn_test.sh b/exercises/luhn/luhn_test.sh index f66e9279..07ef8a06 100755 --- a/exercises/luhn/luhn_test.sh +++ b/exercises/luhn/luhn_test.sh @@ -1,98 +1,98 @@ #!/usr/bin/env bash @test "single digit strings can not be valid" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "1" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "a single zero is invalid" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "0" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "a simple valid SIN that remains valid if reversed" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "059" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "a simple valid SIN that becomes invalid if reversed" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "59" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "a valid Canadian SIN" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "055 444 285" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "invalid Canadian SIN" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "055 444 286" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "invalid credit card" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "8273 1232 7352 0569" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "valid strings with a non-digit included become invalid" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "055a 444 285" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "valid strings with punctuation included become invalid" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "055-444-285" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "valid strings with symbols included become invalid" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "055£ 444$ 285" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "single zero with space is invalid" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh " 0" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "more than a single zero is valid" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "0000 0" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "input digit 9 is correctly converted to output digit 9" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh "091" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "strings with non-digits is invalid" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash luhn.sh ":9" [ "$status" -eq 0 ] [ "$output" == "false" ] diff --git a/exercises/nucleotide-count/nucleotide_count_test.sh b/exercises/nucleotide-count/nucleotide_count_test.sh index 1788b6b5..7a5df13d 100755 --- a/exercises/nucleotide-count/nucleotide_count_test.sh +++ b/exercises/nucleotide-count/nucleotide_count_test.sh @@ -3,35 +3,35 @@ # count all nucleotides in a strand @test "empty strand" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash nucleotide_count.sh "" [ "$status" -eq 0 ] [ "$output" == $'A: 0\nC: 0\nG: 0\nT: 0' ] } @test "can count one nucleotide in single-character input" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash nucleotide_count.sh "G" [ "$status" -eq 0 ] [ "$output" == $'A: 0\nC: 0\nG: 1\nT: 0' ] } @test "strand with repeated nucleotide" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash nucleotide_count.sh "GGGGGGG" [ "$status" -eq 0 ] [ "$output" == $'A: 0\nC: 0\nG: 7\nT: 0' ] } @test "strand with multiple nucleotides" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash nucleotide_count.sh "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" [ "$status" -eq 0 ] [ "$output" == $'A: 20\nC: 12\nG: 17\nT: 21' ] } @test "strand with invalid nucleotides" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash nucleotide_count.sh "AGXXACT" [ "$status" -eq 1 ] [ "$output" == "Invalid nucleotide in strand" ] diff --git a/exercises/pangram/pangram_test.sh b/exercises/pangram/pangram_test.sh index 8f25b291..108751ce 100755 --- a/exercises/pangram/pangram_test.sh +++ b/exercises/pangram/pangram_test.sh @@ -3,70 +3,70 @@ # Check if the given string is a pangram @test "sentence empty" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "recognizes a perfect lower case pangram" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "abcdefghijklmnopqrstuvwxyz" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "pangram with only lower case" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "the quick brown fox jumps over the lazy dog" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "missing character 'x'" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "a quick movement of the enemy will jeopardize five gunboats" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "another missing character, e.g. 'h'" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "five boxing wizards jump quickly at it" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "pangram with underscores" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "the_quick_brown_fox_jumps_over_the_lazy_dog" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "pangram with numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "the 1 quick brown fox jumps over the 2 lazy dogs" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "missing letters replaced by numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog" [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "pangram with mixed case and punctuation" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "\"Five quacking Zephyrs jolt my wax bed.\"" [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "upper and lower case versions of the same character should not be counted separately" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash pangram.sh "the quick brown fox jumps over with lazy FX" [ "$status" -eq 0 ] [ "$output" == "false" ] diff --git a/exercises/phone-number/phone_number_test.sh b/exercises/phone-number/phone_number_test.sh index 6adb2dae..75081a3c 100755 --- a/exercises/phone-number/phone_number_test.sh +++ b/exercises/phone-number/phone_number_test.sh @@ -1,98 +1,98 @@ #!/usr/bin/env bash @test "cleans the number" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "(223) 456-7890" [ "$status" -eq 0 ] [ "$output" == "2234567890" ] } @test "cleans numbers with dots" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "223.456.7890" [ "$status" -eq 0 ] [ "$output" == "2234567890" ] } @test "cleans numbers with multiple spaces" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "223 456 7890 " [ "$status" -eq 0 ] [ "$output" == "2234567890" ] } @test "invalid when 9 digits" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "123456789" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "invalid when 11 digits does not start with a 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "22234567890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "valid when 11 digits and starting with 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "12234567890" [ "$status" -eq 0 ] [ "$output" == "2234567890" ] } @test "valid when 11 digits and starting with 1 even with punctuation" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "+1 (223) 456-7890" [ "$status" -eq 0 ] [ "$output" == "2234567890" ] } @test "invalid when more than 11 digits" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "321234567890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "invalid with letters" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "123-abc-7890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "invalid with punctuations" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "123-@:!-7890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "invalid if area code starts with 0" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "(023) 456-7890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "invalid if area code starts with 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "(123) 456-7890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "invalid if exchange code starts with 0" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "(223) 056-7890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] } @test "invalid if exchange code starts with 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash phone_number.sh "(223) 156-7890" [ "$status" -eq 1 ] [ "$output" == "Invalid number. [1]NXX-NXX-XXXX N=2-9, X=0-9" ] diff --git a/exercises/raindrops/raindrops_test.sh b/exercises/raindrops/raindrops_test.sh index 2341cc0e..7f57c078 100755 --- a/exercises/raindrops/raindrops_test.sh +++ b/exercises/raindrops/raindrops_test.sh @@ -1,126 +1,126 @@ #!/usr/bin/env bash @test "the sound for 1 is 1" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 1 [ "$status" -eq 0 ] [ "$output" == "1" ] } @test "the sound for 3 is Pling" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 3 [ "$status" -eq 0 ] [ "$output" == "Pling" ] } @test "the sound for 5 is Plang" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 5 [ "$status" -eq 0 ] [ "$output" == "Plang" ] } @test "the sound for 7 is Plong" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 7 [ "$status" -eq 0 ] [ "$output" == "Plong" ] } @test "the sound for 6 is Pling as it has a factor 3" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 6 [ "$status" -eq 0 ] [ "$output" == "Pling" ] } @test "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 8 [ "$status" -eq 0 ] [ "$output" == "8" ] } @test "the sound for 9 is Pling as it has a factor 3" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 9 [ "$status" -eq 0 ] [ "$output" == "Pling" ] } @test "the sound for 10 is Plang as it has a factor 5" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 10 [ "$status" -eq 0 ] [ "$output" == "Plang" ] } @test "the sound for 14 is Plong as it has a factor of 7" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 14 [ "$status" -eq 0 ] [ "$output" == "Plong" ] } @test "the sound for 15 is PlingPlang as it has factors 3 and 5" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 15 [ "$status" -eq 0 ] [ "$output" == "PlingPlang" ] } @test "the sound for 21 is PlingPlong as it has factors 3 and 7" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 21 [ "$status" -eq 0 ] [ "$output" == "PlingPlong" ] } @test "the sound for 25 is Plang as it has a factor 5" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 25 [ "$status" -eq 0 ] [ "$output" == "Plang" ] } @test "the sound for 27 is Pling as it has a factor 3" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 27 [ "$status" -eq 0 ] [ "$output" == "Pling" ] } @test "the sound for 35 is PlangPlong as it has factors 5 and 7" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 35 [ "$status" -eq 0 ] [ "$output" == "PlangPlong" ] } @test "the sound for 49 is Plong as it has a factor 7" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 49 [ "$status" -eq 0 ] [ "$output" == "Plong" ] } @test "the sound for 52 is 52" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 52 [ "$status" -eq 0 ] [ "$output" == "52" ] } @test "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 105 [ "$status" -eq 0 ] [ "$output" == "PlingPlangPlong" ] } @test "the sound for 3125 is Plang as it has a factor 5" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash raindrops.sh 3125 [ "$status" -eq 0 ] [ "$output" == "Plang" ] diff --git a/exercises/reverse-string/reverse_string_test.sh b/exercises/reverse-string/reverse_string_test.sh index 117cae41..22e4caf1 100755 --- a/exercises/reverse-string/reverse_string_test.sh +++ b/exercises/reverse-string/reverse_string_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "An empty string" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash reverse_string.sh "" [ "$status" -eq 0 ] @@ -9,7 +9,7 @@ } @test "A word" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash reverse_string.sh "robot" [ "$status" -eq 0 ] @@ -17,7 +17,7 @@ } @test "A capitalised word" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash reverse_string.sh "Ramen" [ "$status" -eq 0 ] @@ -25,7 +25,7 @@ } @test "A sentence with punctuation" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash reverse_string.sh "I'm hungry!" [ "$status" -eq 0 ] @@ -33,7 +33,7 @@ } @test "A palindrome" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash reverse_string.sh "racecar" [ "$status" -eq 0 ] diff --git a/exercises/rna-transcription/rna_transcription_test.sh b/exercises/rna-transcription/rna_transcription_test.sh index 7c8531a7..85a0ebe5 100755 --- a/exercises/rna-transcription/rna_transcription_test.sh +++ b/exercises/rna-transcription/rna_transcription_test.sh @@ -1,63 +1,63 @@ #!/usr/bin/env bash @test "Empty RNA sequence" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh [ "$status" -eq 0 ] [ "$output" == "" ] } @test "RNA complement of cytosine is guanine" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh C [ "$status" -eq 0 ] [ "$output" == "G" ] } @test "RNA complement of guanine is cytosine" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh G [ "$status" -eq 0 ] [ "$output" == "C" ] } @test "RNA complement of thymine is adenine" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh T [ "$status" -eq 0 ] [ "$output" == "A" ] } @test "RNA complement of adenine is uracil" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh A [ "$status" -eq 0 ] [ "$output" == "U" ] } @test "RNA complement" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh ACGTGGTCTTAA [ "$status" -eq 0 ] [ "$output" == "UGCACCAGAAUU" ] } @test "Handles invalid character" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh ACGTXCTTA [ "$status" -eq 1 ] [ "$output" == "Invalid nucleotide detected." ] } @test "Handles completely invalid string" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh XXXX [ "$status" -eq 1 ] [ "$output" == "Invalid nucleotide detected." ] } @test "Handles partially invalid string" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash rna_transcription.sh ACGTXCTTAA [ "$status" -eq 1 ] [ "$output" == "Invalid nucleotide detected." ] diff --git a/exercises/roman-numerals/roman_numerals_test.sh b/exercises/roman-numerals/roman_numerals_test.sh index cbf47c0e..d6201ce8 100755 --- a/exercises/roman-numerals/roman_numerals_test.sh +++ b/exercises/roman-numerals/roman_numerals_test.sh @@ -1,133 +1,133 @@ #!/usr/bin/env bash @test "1 is a single I" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 1 [ "$status" -eq 0 ] [ "$output" == "I" ] } @test "2 is two I's" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 2 [ "$status" -eq 0 ] [ "$output" == "II" ] } @test "3 is three I's" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 3 [ "$status" -eq 0 ] [ "$output" == "III" ] } @test "4, being 5 - 1, is IV" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 4 [ "$status" -eq 0 ] [ "$output" == "IV" ] } @test "5 is a single V" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 5 [ "$status" -eq 0 ] [ "$output" == "V" ] } @test "6, being 5 + 1, is VI" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 6 [ "$status" -eq 0 ] [ "$output" == "VI" ] } @test "9, being 10 - 1, is IX" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 9 [ "$status" -eq 0 ] [ "$output" == "IX" ] } @test "20 is two X's" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 27 [ "$status" -eq 0 ] [ "$output" == "XXVII" ] } @test "48 is not 50 - 2 but rather 40 + 8" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 48 [ "$status" -eq 0 ] [ "$output" == "XLVIII" ] } @test "49 is not 40 + 5 + 4 but rather 50 - 10 + 10 - 1" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 49 [ "$status" -eq 0 ] [ "$output" == "XLIX" ] } @test "50 is a single L" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 59 [ "$status" -eq 0 ] [ "$output" == "LIX" ] } @test "90, being 100 - 10, is XC" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 93 [ "$status" -eq 0 ] [ "$output" == "XCIII" ] } @test "100 is a single C" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 141 [ "$status" -eq 0 ] [ "$output" == "CXLI" ] } @test "60, being 50 + 10, is LX" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 163 [ "$status" -eq 0 ] [ "$output" == "CLXIII" ] } @test "400, being 500 - 100, is CD" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 402 [ "$status" -eq 0 ] [ "$output" == "CDII" ] } @test "500 is a single D" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 575 [ "$status" -eq 0 ] [ "$output" == "DLXXV" ] } @test "900, being 1000 - 100, is CM" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 911 [ "$status" -eq 0 ] [ "$output" == "CMXI" ] } @test "1000 is a single M" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 1024 [ "$status" -eq 0 ] [ "$output" == "MXXIV" ] } @test "3000 is three M's" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash roman_numerals.sh 3000 [ "$status" -eq 0 ] [ "$output" == "MMM" ] diff --git a/exercises/scrabble-score/scrabble_score_test.sh b/exercises/scrabble-score/scrabble_score_test.sh index 269f8098..51513514 100755 --- a/exercises/scrabble-score/scrabble_score_test.sh +++ b/exercises/scrabble-score/scrabble_score_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test 'lowercase letter' { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'a' [ "$status" -eq 0 ] @@ -9,7 +9,7 @@ } @test 'uppercase letter' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'A' [ "$status" -eq 0 ] @@ -17,7 +17,7 @@ } @test 'valuable letter' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'f' [ "$status" -eq 0 ] @@ -25,7 +25,7 @@ } @test 'short word' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'at' [ "$status" -eq 0 ] @@ -33,7 +33,7 @@ } @test 'short, valuable word' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'zoo' [ "$status" -eq 0 ] @@ -41,7 +41,7 @@ } @test 'medium word' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'street' [ "$status" -eq 0 ] @@ -49,7 +49,7 @@ } @test 'medium, valuable word' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'quirky' [ "$status" -eq 0 ] @@ -57,7 +57,7 @@ } @test 'long, mixed-case word' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'OxyphenButazone' [ "$status" -eq 0 ] @@ -65,7 +65,7 @@ } @test 'english-like word' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'pinata' [ "$status" -eq 0 ] @@ -73,7 +73,7 @@ } @test 'empty input' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh '' [ "$status" -eq 0 ] @@ -81,7 +81,7 @@ } @test 'entire alphabet available' { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash scrabble_score.sh 'abcdefghijklmnopqrstuvwxyz' [ "$status" -eq 0 ] diff --git a/exercises/triangle/triangle_test.sh b/exercises/triangle/triangle_test.sh index 602a1849..0f0ad119 100755 --- a/exercises/triangle/triangle_test.sh +++ b/exercises/triangle/triangle_test.sh @@ -3,28 +3,28 @@ # Test returns true if the triangle is equilateral @test "true if all sides are equal" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh equilateral 2 2 2 [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "false if any side is unequal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh equilateral 2 3 2 [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "false if no sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh equilateral 5 4 6 [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "All zero sides are illegal, so the triangle is not equilateral" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh equilateral 0 0 0 [ "$status" -eq 0 ] [ "$output" == "false" ] @@ -33,7 +33,7 @@ # Bonus: deal with floats @test "sides may be floats" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh equilateral 0.5 0.5 0.5 [ "$status" -eq 0 ] [ "$output" == "true" ] @@ -42,42 +42,42 @@ # Test returns true if the triangle is isosceles @test "true if last two sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh isosceles 3 4 4 [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "true if first two sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh isosceles 4 4 3 [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "true if first and last sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh isosceles 4 3 4 [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "equilateral triangles are also isosceles" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh isosceles 4 4 4 [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "false if no sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh isosceles 2 3 4 [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "Sides that violate triangle inequality are not isosceles, even if two are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh isosceles 1 1 3 [ "$status" -eq 0 ] [ "$output" == "false" ] @@ -86,7 +86,7 @@ # Bonus: deal with floats @test "sides may be floats" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh isosceles 0.5 0.4 0.5 [ "$status" -eq 0 ] [ "$output" == "true" ] @@ -95,28 +95,28 @@ # Test returns true if the triangle is scalene @test "true if no sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh scalene 5 4 6 [ "$status" -eq 0 ] [ "$output" == "true" ] } @test "false if all sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh scalene 4 4 4 [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "false if two sides are equal" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh scalene 4 4 3 [ "$status" -eq 0 ] [ "$output" == "false" ] } @test "Sides that violate triangle inequality are not scalene, even if they are all different" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh scalene 7 3 2 [ "$status" -eq 0 ] [ "$output" == "false" ] @@ -125,7 +125,7 @@ # Bonus: deal with floats @test "sides may be floats" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash triangle.sh scalene 0.5 0.4 0.6 [ "$status" -eq 0 ] [ "$output" == "true" ] diff --git a/exercises/two-fer/two_fer_test.sh b/exercises/two-fer/two_fer_test.sh index d0cc8bd0..92d86b7e 100755 --- a/exercises/two-fer/two_fer_test.sh +++ b/exercises/two-fer/two_fer_test.sh @@ -1,21 +1,35 @@ #!/usr/bin/env bash @test "no name given" { - #skip + # This is used to skip the test + # normally, we skip every test except for the first one + # (the first one is always commented out) + # this allows for a person to focus on solving a test at a time + # you can comment out or delete the + # `[[ $BATS_RUN_SKIPPED == true ]] || skip` to run the test + # when ready. + # + # You can also run the all the tests by setting the `$BATS_RUN_SKIPPED` + # environment variable, like this: + # + # $ BATS_RUN_SKIPPED=true bats two_fer_test.sh + # + + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash two_fer.sh [ "$status" -eq 0 ] [ "$output" == "One for you, one for me." ] } @test "a name given" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash two_fer.sh Alice [ "$status" -eq 0 ] [ "$output" == "One for Alice, one for me." ] } @test "another name given" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash two_fer.sh Bob [ "$status" -eq 0 ] [ "$output" == "One for Bob, one for me." ] diff --git a/exercises/word-count/word_count_test.sh b/exercises/word-count/word_count_test.sh index e1bd9237..9dfa37df 100644 --- a/exercises/word-count/word_count_test.sh +++ b/exercises/word-count/word_count_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash @test "count one word" { - #skip + #[[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "word" [ "$status" -eq 0 ] echo $output | grep "word: 1" @@ -9,7 +9,7 @@ } @test "count one of each word" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "one of each" [ "$status" -eq 0 ] echo $output | grep "one: 1" @@ -19,7 +19,7 @@ } @test "multiple occurrences of a word" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "one fish two fish red fish blue fish" [ "$status" -eq 0 ] echo $output | grep "one: 1" @@ -31,7 +31,7 @@ } @test "handles cramped lists" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "one,two,three" [ "$status" -eq 0 ] echo $output | grep "one: 1" @@ -41,7 +41,7 @@ } @test "handles expanded lists" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "one,\ntwo,\nthree" [ "$status" -eq 0 ] echo $output | grep "one: 1" @@ -51,7 +51,7 @@ } @test "ignore punctuation" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "car: carpet as java: javascript!!&@$%^&" [ "$status" -eq 0 ] echo $output | grep "car: 1" @@ -63,7 +63,7 @@ } @test "include numbers" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "testing, 1, 2 testing" [ "$status" -eq 0 ] echo $output | grep "testing: 2" @@ -73,7 +73,7 @@ } @test "normalize case" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "go Go GO Stop stop" [ "$status" -eq 0 ] echo $output | grep "go: 3" @@ -82,7 +82,7 @@ } @test "with apostrophes" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "First: don't laugh. Then: don't cry." [ "$status" -eq 0 ] echo $output | grep "first: 1" @@ -94,7 +94,7 @@ } @test "with quotations" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh "Joe can't tell between 'large' and large." [ "$status" -eq 0 ] echo $output | grep "joe: 1" @@ -107,7 +107,7 @@ } @test "multiple spaces not detected as a word" { - skip + [[ $BATS_RUN_SKIPPED == true ]] || skip run bash word_count.sh " multiple whitespaces" [ "$status" -eq 0 ] echo $output | grep "multiple: 1" From f7583cc826ea7d0e517c05bfffde98e269ccbf11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindstr=C3=B6m?= Date: Sun, 16 Jun 2019 12:56:31 +0700 Subject: [PATCH 2/2] Enable running all tests with unmodified file Applied this again on modified tests. --- exercises/all-your-base/README.md | 7 +- exercises/all-your-base/all_your_base_test.sh | 42 ++++---- exercises/allergies/README.md | 9 +- exercises/allergies/allergies_test.sh | 26 ++--- exercises/beer-song/README.md | 9 +- exercises/beer-song/beer_song_test.sh | 22 ++--- exercises/binary-search/README.md | 9 +- exercises/binary-search/binary_search_test.sh | 22 ++--- exercises/change/README.md | 9 +- exercises/change/change_test.sh | 22 ++--- exercises/diffie-hellman/README.md | 9 +- .../diffie-hellman/diffie_hellman_test.sh | 10 +- exercises/food-chain/README.md | 9 +- exercises/food-chain/food_chain_test.sh | 26 ++--- exercises/forth/README.md | 7 +- exercises/forth/forth_test.sh | 96 +++++++++---------- exercises/grep/README.md | 9 +- exercises/grep/grep_test.sh | 50 +++++----- exercises/house/README.md | 9 +- exercises/house/house_test.sh | 36 +++---- exercises/largest-series-product/README.md | 9 +- .../largest_series_product_test.sh | 30 +++--- exercises/matching-brackets/README.md | 9 +- .../matching_brackets_test.sh | 34 +++---- exercises/perfect-numbers/README.md | 9 +- .../perfect-numbers/perfect_numbers_test.sh | 26 ++--- exercises/pig-latin/README.md | 9 +- exercises/pig-latin/pig_latin_test.sh | 42 ++++---- exercises/prime-factors/README.md | 9 +- exercises/prime-factors/prime_factors_test.sh | 14 +-- exercises/protein-translation/README.md | 9 +- .../protein_translation_test.sh | 48 +++++----- exercises/proverb/README.md | 9 +- exercises/proverb/proverb_test.sh | 12 +-- exercises/rational-numbers/README.md | 9 +- .../rational-numbers/rational_numbers_test.sh | 78 +++++++-------- exercises/resistor-color-duo/README.md | 9 +- .../resistor_color_duo_test.sh | 10 +- exercises/rotational-cipher/README.md | 9 +- .../rotational_cipher_test.sh | 20 ++-- exercises/run-length-encoding/README.md | 9 +- .../run_length_encoding_test.sh | 26 ++--- exercises/say/README.md | 9 +- exercises/say/say_test.sh | 30 +++--- exercises/secret-handshake/README.md | 9 +- .../secret-handshake/secret_handshake_test.sh | 22 ++--- exercises/series/README.md | 9 +- exercises/series/series_test.sh | 20 ++-- exercises/sieve/README.md | 9 +- exercises/sieve/sieve_test.sh | 10 +- exercises/space-age/README.md | 9 +- exercises/space-age/space_age_test.sh | 18 ++-- exercises/twelve-days/README.md | 9 +- exercises/twelve-days/twelve_days_test.sh | 30 +++--- exercises/two-bucket/README.md | 9 +- exercises/two-bucket/two_bucket_test.sh | 16 ++-- exercises/two-fer/README.md | 10 +- exercises/two-fer/two_fer_test.sh | 14 +-- exercises/yacht/README.md | 9 +- exercises/yacht/yacht_test.sh | 56 +++++------ 60 files changed, 660 insertions(+), 515 deletions(-) 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/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/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/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/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 < 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 <