Skip to content

Commit

Permalink
Fix expected results for clock
Browse files Browse the repository at this point in the history
  • Loading branch information
SleeplessByte committed Oct 18, 2024
1 parent 7364356 commit f200f00
Show file tree
Hide file tree
Showing 2 changed files with 360 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/dev.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { fixtures } from './paths.mjs'
// corepack pnpm dlx cross-env SILENT=0 corepack pnpm node test/dev.test.mjs

assertPass(
'lasagna',
join(fixtures, 'lasagna', 'pass'),
join(fixtures, 'lasagna', 'pass')
'clock',
join(fixtures, 'clock', 'pass'),
join(fixtures, 'clock', 'pass')
)
357 changes: 357 additions & 0 deletions test/fixtures/clock/pass/expected_results.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,363 @@
"message": "",
"output": null,
"test_code": "expect(new Clock(8).toString()).toEqual('08:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > past the hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(11, 9).toString()).toEqual('11:09');"
},
{
"name": "Clock > Creating a new clock with an initial time > midnight is zero hours",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(24, 0).toString()).toEqual('00:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > hour rolls over",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(25, 0).toString()).toEqual('01:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > hour rolls over continuously",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(100, 0).toString()).toEqual('04:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > sixty minutes is next hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(1, 60).toString()).toEqual('02:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > minutes roll over",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(0, 160).toString()).toEqual('02:40');"
},
{
"name": "Clock > Creating a new clock with an initial time > minutes roll over continuously",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(0, 1723).toString()).toEqual('04:43');"
},
{
"name": "Clock > Creating a new clock with an initial time > hour and minutes roll over",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(25, 160).toString()).toEqual('03:40');"
},
{
"name": "Clock > Creating a new clock with an initial time > hour and minutes roll over continuously",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(201, 3001).toString()).toEqual('11:01');"
},
{
"name": "Clock > Creating a new clock with an initial time > hour and minutes roll over to exactly midnight",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(72, 8640).toString()).toEqual('00:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(-1, 15).toString()).toEqual('23:15');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative hour rolls over",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(-25, 0).toString()).toEqual('23:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative hour rolls over continuously",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(-91, 0).toString()).toEqual('05:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative minutes",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(1, -40).toString()).toEqual('00:20');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative minutes rolls over",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(1, -160).toString()).toEqual('22:20');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative minutes rolls over continuously",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(1, -4820).toString()).toEqual('16:40');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative sixty minutes is previous hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(2, -60).toString()).toEqual('01:00');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative hour and minutes both roll over",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(-25, -160).toString()).toEqual('20:20');"
},
{
"name": "Clock > Creating a new clock with an initial time > negative hour and minutes both roll over continuously",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(-121, -5810).toString()).toEqual('22:10');"
},
{
"name": "Clock > Adding minutes > add minutes",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(10, 0).plus(3).toString()).toEqual('10:03');"
},
{
"name": "Clock > Adding minutes > add no minutes",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(6, 41).plus(0).toString()).toEqual('06:41');"
},
{
"name": "Clock > Adding minutes > add to next hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(0, 45).plus(40).toString()).toEqual('01:25');"
},
{
"name": "Clock > Adding minutes > add more than one hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(10, 0).plus(61).toString()).toEqual('11:01');"
},
{
"name": "Clock > Adding minutes > add more than two hours with carry",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(0, 45).plus(160).toString()).toEqual('03:25');"
},
{
"name": "Clock > Adding minutes > add across midnight",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(23, 59).plus(2).toString()).toEqual('00:01');"
},
{
"name": "Clock > Adding minutes > add more than one day (1500 min = 25 hrs)",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(5, 32).plus(1500).toString()).toEqual('06:32');"
},
{
"name": "Clock > Adding minutes > add more than two days",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(1, 1).plus(3500).toString()).toEqual('11:21');"
},
{
"name": "Clock > Subtract minutes > subtract minutes",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(10, 3).minus(3).toString()).toEqual('10:00');"
},
{
"name": "Clock > Subtract minutes > subtract to previous hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(10, 3).minus(30).toString()).toEqual('09:33');"
},
{
"name": "Clock > Subtract minutes > subtract more than an hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(10, 3).minus(70).toString()).toEqual('08:53');"
},
{
"name": "Clock > Subtract minutes > subtract across midnight",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(0, 3).minus(4).toString()).toEqual('23:59');"
},
{
"name": "Clock > Subtract minutes > subtract more than two hours",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(0, 0).minus(160).toString()).toEqual('21:20');"
},
{
"name": "Clock > Subtract minutes > subtract more than two hours with borrow",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(6, 15).minus(160).toString()).toEqual('03:35');"
},
{
"name": "Clock > Subtract minutes > subtract more than one day (1500 min = 25 hrs)",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(5, 32).minus(1500).toString()).toEqual('04:32');"
},
{
"name": "Clock > Subtract minutes > subtract more than two days",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(2, 20).minus(3000).toString()).toEqual('00:20');"
},
{
"name": "Clock > Compare two clocks for equality > clocks with same time",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(15, 37).equals(new Clock(15, 37))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks a minute apart",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(15, 36).equals(new Clock(15, 37))).toBe(false);"
},
{
"name": "Clock > Compare two clocks for equality > clocks an hour apart",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(14, 37).equals(new Clock(15, 37))).toBe(false);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with hour overflow",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(10, 37).equals(new Clock(34, 37))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with hour overflow by several days",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(3, 11).equals(new Clock(99, 11))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative hour",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(22, 40).equals(new Clock(-2, 40))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative hour that wraps",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(17, 3).equals(new Clock(-31, 3))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative hour that wraps multiple times",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(13, 49).equals(new Clock(-83, 49))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with minute overflow",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(0, 1).equals(new Clock(0, 1441))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with minute overflow by several days",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(2, 2).equals(new Clock(2, 4322))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative minute",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(2, 40).equals(new Clock(3, -20))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative minute that wraps",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(4, 10).equals(new Clock(5, -1490))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative minute that wraps multiple times",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(6, 15).equals(new Clock(6, -4305))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative hours and minutes",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(7, 32).equals(new Clock(-12, -268))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > clocks with negative hours and minutes that wrap",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(18, 7).equals(new Clock(-54, -11513))).toBe(true);"
},
{
"name": "Clock > Compare two clocks for equality > full clock and zeroed clock",
"status": "pass",
"message": "",
"output": null,
"test_code": "expect(new Clock(24, 0).equals(new Clock(0, 0))).toBe(true);"
}
],
"version": 3
Expand Down

0 comments on commit f200f00

Please sign in to comment.