11#! /usr/bin/env bats
22load bats-extra
33
4- # generated on 2026-06-29T16:53:24 +00:00
4+ # generated on 2026-06-30T03:00:58 +00:00
55
66# * The canonical "Compare two clocks for equality" tests
77# have not been included: for bash they will simply be
@@ -272,6 +272,118 @@ load bats-extra
272272 assert_output " 00:20"
273273}
274274
275+ @test " clocks with same time" {
276+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
277+ run bash clock.sh 15 37 = 15 37
278+ assert_success
279+ assert_output " true"
280+ }
281+
282+ @test " clocks a minute apart" {
283+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
284+ run bash clock.sh 15 36 = 15 37
285+ assert_success
286+ assert_output " false"
287+ }
288+
289+ @test " clocks an hour apart" {
290+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
291+ run bash clock.sh 14 37 = 15 37
292+ assert_success
293+ assert_output " false"
294+ }
295+
296+ @test " clocks with hour overflow" {
297+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
298+ run bash clock.sh 10 37 = 34 37
299+ assert_success
300+ assert_output " true"
301+ }
302+
303+ @test " clocks with hour overflow by several days" {
304+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
305+ run bash clock.sh 3 11 = 99 11
306+ assert_success
307+ assert_output " true"
308+ }
309+
310+ @test " clocks with negative hour" {
311+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
312+ run bash clock.sh 22 40 = -2 40
313+ assert_success
314+ assert_output " true"
315+ }
316+
317+ @test " clocks with negative hour that wraps" {
318+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
319+ run bash clock.sh 17 3 = -31 3
320+ assert_success
321+ assert_output " true"
322+ }
323+
324+ @test " clocks with negative hour that wraps multiple times" {
325+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
326+ run bash clock.sh 13 49 = -83 49
327+ assert_success
328+ assert_output " true"
329+ }
330+
331+ @test " clocks with minute overflow" {
332+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
333+ run bash clock.sh 0 1 = 0 1441
334+ assert_success
335+ assert_output " true"
336+ }
337+
338+ @test " clocks with minute overflow by several days" {
339+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
340+ run bash clock.sh 2 2 = 2 4322
341+ assert_success
342+ assert_output " true"
343+ }
344+
345+ @test " clocks with negative minute" {
346+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
347+ run bash clock.sh 2 40 = 3 -20
348+ assert_success
349+ assert_output " true"
350+ }
351+
352+ @test " clocks with negative minute that wraps" {
353+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
354+ run bash clock.sh 4 10 = 5 -1490
355+ assert_success
356+ assert_output " true"
357+ }
358+
359+ @test " clocks with negative minute that wraps multiple times" {
360+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
361+ run bash clock.sh 6 15 = 6 -4305
362+ assert_success
363+ assert_output " true"
364+ }
365+
366+ @test " clocks with negative hours and minutes" {
367+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
368+ run bash clock.sh 7 32 = -12 -268
369+ assert_success
370+ assert_output " true"
371+ }
372+
373+ @test " clocks with negative hours and minutes that wrap" {
374+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
375+ run bash clock.sh 18 7 = -54 -11513
376+ assert_success
377+ assert_output " true"
378+ }
379+
380+ @test " full clock and zeroed clock" {
381+ [[ $BATS_RUN_SKIPPED == " true" ]] || skip
382+ run bash clock.sh 24 0 = 0 0
383+ assert_success
384+ assert_output " true"
385+ }
386+
275387
276388# Error conditions: We expect non-zero exit status, and
277389# some error message to be output (your choice for wording).
@@ -316,4 +428,4 @@ load bats-extra
316428 run bash clock.sh 1 2 - 3delta
317429 assert_failure
318430 assert_output # there is _some_ output
319- }
431+ }
0 commit comments