30 lib test files: package <mod> -> <mod>_test, the sanctioned Go-over-Hare departure (CLAUDE.md rule-9 carve-out; white-box testing deferred, not forbidden). decimaltest retired per .ai/rob-16-decimaltest-ruling.md: Hare ships no decimal_test.ha (engine covered transitively); coverage migrated losslessly into stoftest rows (all-9s carry, nd>19 pure-decimal) + ftostest f64_roundtrip mirroring ref/hare strconv ftos_test.ha tcsf64; k=0 micro-gap documented at site. regex_test keeps its white-box internal probes under a documented rule-7 divergence (rehome = task #9). 922_decimal_run + its 989 byte-id row removed with the fixture.
69 lines
1.6 KiB
Plaintext
69 lines
1.6 KiB
Plaintext
package crc64_test;
|
|
|
|
import crc64;
|
|
|
|
fn putstr(s: str, into: []u8, off: i32) i32 = {
|
|
let i: i32 = 0;
|
|
for (i < s.len) {
|
|
into[off + i] = s[i];
|
|
i += 1;
|
|
};
|
|
return off + s.len;
|
|
};
|
|
|
|
fn check(s: str, ecma: u64, iso: u64) void = {
|
|
let arr: [128]u8;
|
|
let n: i32 = putstr(s, arr[0:128], 0);
|
|
let buf: []u8 = arr[0:n];
|
|
if (crc64.sum64ecma(buf) != ecma) { let _: i32 = 1/0; };
|
|
if (crc64.sum64iso(buf) != iso) { let _: i32 = 1/0; };
|
|
};
|
|
|
|
@test fn vec_empty() void = {
|
|
let arr: [1]u8;
|
|
let buf: []u8 = arr[0:0];
|
|
if (crc64.sum64ecma(buf) != 0u64) { let _: i32 = 1/0; };
|
|
if (crc64.sum64iso(buf) != 0u64) { let _: i32 = 1/0; };
|
|
};
|
|
|
|
@test fn vec_oscar() void = {
|
|
check("Man can believe the impossible, but can never believe the improbable. -- Oscar Wilde",
|
|
0x17F71EF3BB851DC7u64, 0xD0E8ED57865D6AC6u64);
|
|
};
|
|
|
|
@test fn vec_hegel() void = {
|
|
check("We learn from history that we do not learn from history. -- Georg Hegel",
|
|
0xAA3C335BB49ABE9Du64, 0x5FD192CC516BBEC3u64);
|
|
};
|
|
|
|
@test fn vec_chapelain() void = {
|
|
check("The final delusion is the belief that one has lost all delusions. -- Maurice Chapelain",
|
|
0x7DFC4F7CE9552D23u64, 0xF71B429C925D99AEu64);
|
|
};
|
|
|
|
@test fn vec_unix() void = {
|
|
check("UNIX is simple and coherent",
|
|
0x9C1938E72C1D8619u64, 0x372ABFFD392FF27Du64);
|
|
};
|
|
|
|
@test fn vec_gnu() void = {
|
|
check("GNU's not UNIX",
|
|
0x2C0C97B1CB17FCBAu64, 0x9BD1FA95A419A43Du64);
|
|
};
|
|
|
|
@test fn vec_blm() void = {
|
|
check("Black lives matter",
|
|
0x159BB7B6086BF47Eu64, 0xC218CBB390CF44EBu64);
|
|
};
|
|
|
|
export fn main() i32 = {
|
|
vec_empty();
|
|
vec_oscar();
|
|
vec_hegel();
|
|
vec_chapelain();
|
|
vec_unix();
|
|
vec_gnu();
|
|
vec_blm();
|
|
return 0;
|
|
};
|