085 calm Match deck: no header hourglass, centred bare empty state, the release card as a deck card (Cancel, Skip, Release), fixed card height. 086 motion: vanish() fade everywhere with a lint test, view transitions, a lub-dub heartbeat for working objects, confetti that lands and fades. 087 time readout under the pivot of every analog clock. 088 prune dialog grouped by prefix with tri-state boxes, search, stepper and sticky footer. 089 one-row task toolbar with Filter and Actions menus and a filter chip. 090 card border by state colour with a soft glow and owner avatars. 091 draggable limit lines with staged changes and one Save, a Limits menu with the matrix, View toggles, the GPU cause in its tooltip. 093 request chips Open, Expired, Stale, Failed, All and a signed Delete. 094 closed cards leave the deck within 5 s; open in Claude stamps. 095 compact agent message box with Post/Call, attach, mic and Send in the field. 096 Reject on an expired card drops it silently as Drop (expired). 097 Show filter in Match's right-click menu. 098 docked speech bubbles carry the speaker's avatar and a skip button. 099 Match card headlines cut to 120 characters with the full title in the tooltip; the code box keeps the whole command. tests/test_hub_path_links.py: a unicode fixture without German. Full make test green through the queue (2605 tests, ruff, shellcheck, markdownlint). Gate missed on the operator's word: break 7 %, the E2E specs (13 new, 15 updated) run next. 🎯 Fix: 92 % 💥 Break: 7 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 86 🚦 Gate: ⛔ break 7 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.7 KiB
Python
66 lines
2.7 KiB
Python
"""Exercise requirement 087: the readout of every analog clock, m:ss on a clock that runs out and HH:MM:SS on a wall clock."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import unittest
|
|
|
|
from hub_support import HUB
|
|
|
|
DIAL = HUB / "templates" / "dial.js"
|
|
MORNING = 1_795_770_307_250
|
|
PROBE = """
|
|
const D = require(process.argv[1]);
|
|
const morning = Number(process.argv[2]);
|
|
const until = 1_000_000;
|
|
const count = D.counting(until, 60);
|
|
const seconds = D.counting(until, 1);
|
|
const at = (left) => (until - left) * 1000;
|
|
console.log(JSON.stringify({
|
|
countdown: [0, 0.2, 59, 60, 65, 599.4, 600, 3599, -3].map(D.countdown),
|
|
wall: [D.wall(morning), D.wall(morning - (9 * 3600 + 5 * 60 + 7.25) * 1000), D.wall(morning + (14 * 3600 + 54 * 60 + 52.749) * 1000)],
|
|
counting: [count(at(125.5)), count(at(0)), count(at(-30)), seconds(at(9.5))],
|
|
ticking: [0, 1000, 2000, 3000].map((later) => count(at(125) + later).text),
|
|
walled: D.walled()(morning),
|
|
angle: [D.angle(15, 60), D.angle(0.5, 60), D.angle(60, 60)],
|
|
eased: [D.eased(0), D.eased(0.5), D.eased(1)],
|
|
readout: D.READOUT,
|
|
}));
|
|
"""
|
|
|
|
|
|
@unittest.skipUnless(shutil.which("node"), "no node")
|
|
class TestClockReadout(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
done = subprocess.run(["node", "-e", PROBE, str(DIAL), str(MORNING)], capture_output=True, text=True, timeout=60, check=True, env={**os.environ, "TZ": "UTC"})
|
|
cls.data = json.loads(done.stdout)
|
|
|
|
def test_a_clock_that_runs_out_reads_the_seconds_left_as_m_ss_rounded_up_and_never_below_zero(self):
|
|
self.assertEqual(self.data["countdown"], ["0:00", "0:01", "0:59", "1:00", "1:05", "10:00", "10:00", "59:59", "0:00"])
|
|
|
|
def test_a_wall_clock_reads_the_local_time_of_day_as_hh_mm_ss(self):
|
|
self.assertEqual(self.data["wall"], ["09:05:07", "00:00:00", "23:59:59"])
|
|
self.assertEqual(self.data["walled"], {"at": 7.25, "value": 7, "text": "09:05:07"})
|
|
|
|
def test_a_running_countdown_turns_the_hand_by_the_exact_time_left_and_its_readout_drops_one_second_each_second(self):
|
|
self.assertEqual(self.data["counting"], [
|
|
{"at": 125.5 / 60, "value": 3, "text": "2:06"},
|
|
{"at": 0, "value": 0, "text": "0:00"},
|
|
{"at": 0, "value": 0, "text": "0:00"},
|
|
{"at": 9.5, "value": 10, "text": "0:10"},
|
|
])
|
|
self.assertEqual(self.data["ticking"], ["2:05", "2:04", "2:03", "2:02"])
|
|
|
|
def test_the_hand_angle_follows_the_value_and_a_sweep_eases_into_its_place(self):
|
|
self.assertEqual(self.data["angle"], [90, 3, 360])
|
|
self.assertEqual(self.data["eased"], [0, 0.875, 1])
|
|
self.assertGreater(self.data["readout"], 4)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|