package hamlet import "reflect" type Assertion struct { value bool } func (a Assertion) Value() bool { return a.value } // False reports whether v contains a zero value for its type. func False(v any) Assertion { return Assertion{reflect.ValueOf(v).IsZero()} } // True reports whether v contains a non-zero value for its type. func True(v any) Assertion { return Assertion{!reflect.ValueOf(v).IsZero()} } func New(v any) Assertion { return Assertion{!reflect.ValueOf(v).IsZero()} } func Not(a Assertion) Assertion { negation := !a.value return Assertion{negation} } func Or(a Assertion, b Assertion) Assertion { av := a.value bv := b.value return Assertion{av || bv} } func And(a Assertion, b Assertion) Assertion { av := a.value bv := b.value return Assertion{av && bv} } func If(a Assertion, b Assertion) Assertion { return Or(Not(a), b) } func Iff(a Assertion, b Assertion) Assertion { return And(If(a, b), If(b, a)) } func Xor(a Assertion, b Assertion) Assertion { return Not(Iff(a, b)) }