Files
ww/lib/time/duration_test.ww
Hojun-Cho cec382ef8a lib: split time_test into duration/instant/arithm tests per ref/hare/time
Mirror ref/hare/time's impl layout in the test siblings: constants ->
duration_test.ww (ref/hare/time/duration.ha:9-18 owns the constants);
now/sleep rows -> instant_test.ww (instant is the subject type,
ref/hare/time/instant.ha; now/sleep bodies live in
ref/hare/time/+linux/functions.ha, a platform split ww does not have);
add/diff/compare rows -> arithm_test.ww (ref/hare/time/arithm.ha).

Pure move: every @test block is byte-identical; only the section
banner lines are deleted (the file names now carry them). The stale
file header naming the retired `ww run lib/time/timetest.ww` entry
point is dropped, not relocated (rule 8: it described a WHAT that no
longer exists).

Consumers: Makefile LIBRARY_TESTS entry replaced in place;
test/byteid roster 44->46 (+2).
2026-08-08 17:19:14 +09:00

21 lines
749 B
Plaintext

package time_test;
import time;
// Without these multipliers every caller would re-derive 1e9 in
// place. The values themselves are nailed down by Hare's
// ref/hare/time/duration.ha:9-18.
@test fn constants() void = {
assert(!((time.nanosecond: i64) != 1i64));
assert(!((time.microsecond: i64) != 1000i64));
assert(!((time.millisecond: i64) != 1000000i64));
assert(!((time.second: i64) != 1000000000i64));
// "Roundtrip" check: derived multiples land on the canonical
// nanosecond count. Catches a future re-derivation drift.
assert(!(5i64 * (time.second: i64) != 5000000000i64));
assert(!(3i64 * (time.millisecond: i64) != 3000000i64));
assert(!(7i64 * (time.microsecond: i64) != 7000i64));
};