exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

raindrops_test.sh (2449B)


      1 #!/usr/bin/env bash
      2 
      3 @test "the sound for 1 is 1" {
      4   run bash raindrops.sh 1
      5   [ "$status" -eq 0 ]
      6   [ "$output" == "1" ]
      7 }
      8 
      9 @test "the sound for 3 is Pling" {
     10   run bash raindrops.sh 3
     11   [ "$status" -eq 0 ]
     12   [ "$output" == "Pling" ]
     13 }
     14 
     15 @test "the sound for 5 is Plang" {
     16   run bash raindrops.sh 5
     17   [ "$status" -eq 0 ]
     18   [ "$output" == "Plang" ]
     19 }
     20 
     21 @test "the sound for 7 is Plong" {
     22   run bash raindrops.sh 7
     23   [ "$status" -eq 0 ]
     24   [ "$output" == "Plong" ]
     25 }
     26 
     27 @test "the sound for 6 is Pling as it has a factor 3" {
     28   run bash raindrops.sh 6
     29   [ "$status" -eq 0 ]
     30   [ "$output" == "Pling" ]
     31 }
     32 
     33 @test "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" {
     34   run bash raindrops.sh 8
     35   [ "$status" -eq 0 ]
     36   [ "$output" == "8" ]
     37 }
     38 
     39 @test "the sound for 9 is Pling as it has a factor 3" {
     40   run bash raindrops.sh 9
     41   [ "$status" -eq 0 ]
     42   [ "$output" == "Pling" ]
     43 }
     44 
     45 @test "the sound for 10 is Plang as it has a factor 5" {
     46   run bash raindrops.sh 10
     47   [ "$status" -eq 0 ]
     48   [ "$output" == "Plang" ]
     49 }
     50 
     51 @test "the sound for 14 is Plong as it has a factor of 7" {
     52   run bash raindrops.sh 14
     53   [ "$status" -eq 0 ]
     54   [ "$output" == "Plong" ]
     55 }
     56 
     57 @test "the sound for 15 is PlingPlang as it has factors 3 and 5" {
     58   run bash raindrops.sh 15
     59   [ "$status" -eq 0 ]
     60   [ "$output" == "PlingPlang" ]
     61 }
     62 
     63 @test "the sound for 21 is PlingPlong as it has factors 3 and 7" {
     64   run bash raindrops.sh 21
     65   [ "$status" -eq 0 ]
     66   [ "$output" == "PlingPlong" ]
     67 }
     68 
     69 @test "the sound for 25 is Plang as it has a factor 5" {
     70   run bash raindrops.sh 25
     71   [ "$status" -eq 0 ]
     72   [ "$output" == "Plang" ]
     73 }
     74 
     75 @test "the sound for 27 is Pling as it has a factor 3" {
     76   run bash raindrops.sh 27
     77   [ "$status" -eq 0 ]
     78   [ "$output" == "Pling" ]
     79 }
     80 
     81 @test "the sound for 35 is PlangPlong as it has factors 5 and 7" {
     82   run bash raindrops.sh 35
     83   [ "$status" -eq 0 ]
     84   [ "$output" == "PlangPlong" ]
     85 }
     86 
     87 @test "the sound for 49 is Plong as it has a factor 7" {
     88   run bash raindrops.sh 49
     89   [ "$status" -eq 0 ]
     90   [ "$output" == "Plong" ]
     91 }
     92 
     93 @test "the sound for 52 is 52" {
     94   run bash raindrops.sh 52
     95   [ "$status" -eq 0 ]
     96   [ "$output" == "52" ]
     97 }
     98 
     99 @test "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" {
    100   run bash raindrops.sh 105
    101   [ "$status" -eq 0 ]
    102   [ "$output" == "PlingPlangPlong" ]
    103 }
    104 
    105 @test "the sound for 3125 is Plang as it has a factor 5" {
    106   run bash raindrops.sh 3125
    107   [ "$status" -eq 0 ]
    108   [ "$output" == "Plang" ]
    109 }