lib: expectabort rows for the restored preconditions; retire 989_libprecond_abort.c
The three must-abort runs (u32n/u64n zero, decodedsize unaligned) move into the owning lib suites as test.expectabort rows; the five normal-return controls already live in the r989_libprecond_* fixtures. wwstage parity rides the lib-wide cs==ww byte identity gate.
This commit is contained in:
@@ -16,6 +16,7 @@ import errors;
|
||||
import io;
|
||||
import memio;
|
||||
import strings;
|
||||
import test;
|
||||
|
||||
|
||||
fn streq(a: str, b: str) bool = {
|
||||
@@ -162,6 +163,15 @@ fn inval_check(enc: *base64.encoding, encoded: str) void = {
|
||||
assert(!(base64.decodedsize(164) != 123));
|
||||
};
|
||||
|
||||
// A non-multiple-of-4 input is out of domain and must abort loudly,
|
||||
// never return garbage. Pins the restored Hare precondition
|
||||
// (ref/hare/encoding/base64/base64.ha:597, assert(sz % 4 == 0)).
|
||||
|
||||
@test fn decodedsize_unaligned_aborts() void = {
|
||||
test.expectabort();
|
||||
base64.decodedsize(5i32);
|
||||
};
|
||||
|
||||
// ---- round-trip every byte value 0..255 (std + url) ----
|
||||
|
||||
@test fn roundtrip_all_bytes() void = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package random_test;
|
||||
|
||||
import random;
|
||||
import test;
|
||||
|
||||
@test fn seq() void = {
|
||||
let r: random.random = random.init(1234567u64);
|
||||
@@ -52,3 +53,19 @@ import random;
|
||||
i += 1;
|
||||
};
|
||||
};
|
||||
|
||||
// n == 0 is out of domain and must abort loudly, never return
|
||||
// garbage. Pins the restored Hare preconditions
|
||||
// (ref/hare/math/random/random.ha:26,42).
|
||||
|
||||
@test fn u32n_zero_aborts() void = {
|
||||
test.expectabort();
|
||||
let r: random.random = random.init(1u64);
|
||||
random.u32n(&r, 0u32);
|
||||
};
|
||||
|
||||
@test fn u64n_zero_aborts() void = {
|
||||
test.expectabort();
|
||||
let r: random.random = random.init(1u64);
|
||||
random.u64n(&r, 0u64);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user