@@ -92,17 +92,17 @@ load bats-extra
9292@test " random birthdates -> generate requested number of birthdates" {
9393 [[ $BATS_RUN_SKIPPED == " true" ]] || skip
9494 generate=$( shuf -n 1 -i 100-1000)
95- run bash baffling_birthdays.sh randomBirthdates $generate
95+ run bash baffling_birthdays.sh randomBirthdates " $generate "
9696 assert_success
9797 read -ra output_dates <<< " $output"
98- assert_equal ${# output_dates[@]} $generate
98+ assert_equal ${# output_dates[@]} " $generate "
9999}
100100
101101@test " random birthdates -> years are not leap years" {
102102 [[ $BATS_RUN_SKIPPED == " true" ]] || skip
103103 generate=$( shuf -n 1 -i 100-1000)
104104 seen_leap=0
105- run bash baffling_birthdays.sh randomBirthdates $generate
105+ run bash baffling_birthdays.sh randomBirthdates " $generate "
106106 assert_success
107107 read -ra output_dates <<< " $output"
108108 for date in " ${output_dates[@]} " ; do
@@ -111,14 +111,14 @@ load bats-extra
111111 (( ++ seen_leap ))
112112 fi
113113 done
114- assert_equal $seen_leap 0
114+ assert_equal ${ seen_leap} 0
115115}
116116
117117@test " random birthdates -> months are random" {
118118 [[ $BATS_RUN_SKIPPED == " true" ]] || skip
119119 declare -A seen_month
120120 generate=$( shuf -n 1 -i 100-1000)
121- run bash baffling_birthdays.sh randomBirthdates $generate
121+ run bash baffling_birthdays.sh randomBirthdates " $generate "
122122 assert_success
123123 read -ra output_dates <<< " $output"
124124 for date in " ${output_dates[@]} " ; do
@@ -133,7 +133,7 @@ load bats-extra
133133 [[ $BATS_RUN_SKIPPED == " true" ]] || skip
134134 declare -A seen_day
135135 generate=$( shuf -n 1 -i 100-1000)
136- run bash baffling_birthdays.sh randomBirthdates $generate
136+ run bash baffling_birthdays.sh randomBirthdates " $generate "
137137 assert_success
138138 read -ra output_dates <<< " $output"
139139 for date in " ${output_dates[@]} " ; do
@@ -150,29 +150,29 @@ load bats-extra
150150 # expect="0.0" # this is the exercice ref.
151151 run bash baffling_birthdays.sh estimatedProbabilityOfSharedBirthday 1
152152 assert_success
153- [[ " $output " =~ ^(0 \. ) ]]
153+ assert_equal " $output " 0
154154}
155155
156156@test " estimated probability of at least one shared birthday -> among ten people" {
157157 [[ $BATS_RUN_SKIPPED == " true" ]] || skip
158158 # expect="11.694818" # this is the exercice ref.
159159 run bash baffling_birthdays.sh estimatedProbabilityOfSharedBirthday 10
160160 assert_success
161- [[ " $output " =~ ^(10\. | 11\. | 12\. | 13\. | 14\. ) ]]
161+ [[ $output =~ ^(10\. | 11\. | 12\. | 13\. | 14\. ) ]]
162162}
163163
164164@test " estimated probability of at least one shared birthday -> among twenty-three people" {
165165 [[ $BATS_RUN_SKIPPED == " true" ]] || skip
166166 # expect="50.729723" # this is the exercice ref.
167167 run bash baffling_birthdays.sh estimatedProbabilityOfSharedBirthday 23
168168 assert_success
169- [[ " $output " =~ ^(48\. | 49\. | 50\. | 51\. | 52\. | 53\. ) ]]
169+ [[ $output =~ ^(48\. | 49\. | 50\. | 51\. | 52\. | 53\. ) ]]
170170}
171171
172172@test " estimated probability of at least one shared birthday -> among seventy people" {
173173 [[ $BATS_RUN_SKIPPED == " true" ]] || skip
174174 # expect="99.915958" # this is the exercice ref.
175175 run bash baffling_birthdays.sh estimatedProbabilityOfSharedBirthday 70
176176 assert_success
177- [[ " $output " =~ ^(98\. | 99\. | 100\. ) ]]
177+ [[ $output =~ ^(98\. | 99\. | 100\. ) ]]
178178}
0 commit comments