mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Accept via "a < (b + c): a < c; 0 <= b".
This commit is contained in:
1 parent
6396b47849
commit
1bfd5804bf
3 files changed
+30
-6
No files matched your search
+18
-1
@@ -217,7 +217,24 @@ var reasons = [...]struct {
|
||||
s string
|
||||
r reason
|
||||
}{
|
||||
{`"a < b: a < c <= b"`, func(q *checker, n *a.Assert) error {
|
||||
{`"a < (b + c): a < c; 0 <= b"`, func(q *checker, n *a.Assert) error {
|
||||
op, a, bc := parseBinaryOp(n.Condition())
|
||||
if op != t.KeyXBinaryLessThan {
|
||||
return errFailed
|
||||
}
|
||||
op, b, c := parseBinaryOp(bc)
|
||||
if op != t.KeyXBinaryPlus {
|
||||
return errFailed
|
||||
}
|
||||
if !q.proveBinaryOp(t.KeyXBinaryLessThan, a, c) {
|
||||
return fmt.Errorf("cannot prove \"%s < %s\"", a.String(q.idMap), c.String(q.idMap))
|
||||
}
|
||||
if !q.proveBinaryOp(t.KeyXBinaryLessEq, zeroExpr, b) {
|
||||
return fmt.Errorf("cannot prove \"%s <= %s\"", zeroExpr.String(q.idMap), b.String(q.idMap))
|
||||
}
|
||||
return nil
|
||||
}},
|
||||
{`"a < b: a < c; c <= b"`, func(q *checker, n *a.Assert) error {
|
||||
c := argValue(q.idMap, n.Args(), "c")
|
||||
if c == nil {
|
||||
return errFailed
|
||||
|
||||
Reference in new issue
Block a user