~/bend-docscommunity

lib.bend checks

raw source on the hub · import 0x4b7f9a0323ec18e3ac8e3a9514a1906d/lib.bend as Lib

Test — small Bool-check / proof-suite helper for Bend. Publish entry for this package. Depends only on Base.

Complements LAWS.bend + PROOF.bend: those are definitional equality proofs (bend PROOF.bend). This module is for Bool-valued checklists that smoke mains and HubLens-style badges can fold at runtime.

Base has no Test module (bend base Test → missing). No termination escapes.

Typical use: import ./lib.bend as T ok = T.Test.all(T.Test.eq_u32(1, 1) <> T.Test.eq_string("a", "a") <> Nil{}) ok2 = T.Test.suite(T.Case{"len", Nat.is_eq(n, 3n)} <> Nil{}) Alongside proofs: keep LAWS.bend / PROOF.bend for algebraic identities; use Test.* for executable Bool gates in main / CI badges.

1 import
import Base

Types

type Test.Case source · line 56 · raw

Data

Definitions

def Test.pass source · line 20 · raw

Bool

def Test.fail source · line 23 · raw

Bool

def Test.check source · line 27 · raw

@b:Bool -> Bool

Identity on a Bool — documents a check at the call site.

def Test.eq_bool source · line 32 · raw

@a:Bool -> @b:Bool -> Bool

def Test.eq_u32 source · line 35 · raw

@+a:U32 -> @+b:U32 -> Bool

def Test.eq_nat source · line 38 · raw

@a:Nat -> @b:Nat -> Bool

def Test.eq_string source · line 41 · raw

@a:String -> @b:String -> Bool

def Test.all source · line 47 · raw

@xs:List<&2, Bool> -> Bool

Conjunction of Bool checks. Empty list succeeds (vacuous True).

def Test.and_list source · line 50 · raw

@xs:List<&2, Bool> -> Bool

def Test.case source · line 59 · raw

@name:String -> @ok:Bool -> Test.Case

def Test.case_ok source · line 62 · raw

@c:Test.Case -> Bool

def Test.suite source · line 69 · raw

@cases:List<&2, Test.Case> -> Bool

Fold named cases to a single Bool (ignores names; names are for readers / smoke printing). Empty suite succeeds.