Added more tests
This commit is contained in:
parent
6c0ab72f8f
commit
e032733a92
@ -41,5 +41,6 @@ func (f *Function) Evaluate(expr *expression.Expression) (eval.Value, error) {
|
|||||||
Register: tmp,
|
Register: tmp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f.FreeRegister(tmp)
|
||||||
return value, err
|
return value, err
|
||||||
}
|
}
|
||||||
|
@ -4,31 +4,53 @@ struct Point {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
p := new(Point)
|
a := new(Point)
|
||||||
assert p.x == 0
|
assert a.x == 0
|
||||||
assert p.y == 0
|
assert a.y == 0
|
||||||
assert p.x == p.y
|
assert a.x == a.y
|
||||||
|
|
||||||
p.x = 1
|
a.x = 1
|
||||||
p.y = 2
|
a.y = 2
|
||||||
assert p.x == 1
|
assert a.x == 1
|
||||||
assert p.y == 2
|
assert a.y == 2
|
||||||
assert p.x != p.y
|
assert a.x != a.y
|
||||||
|
|
||||||
p.x = p.y
|
a.x = a.y
|
||||||
assert p.x == 2
|
assert a.x == 2
|
||||||
assert p.y == 2
|
assert a.y == 2
|
||||||
assert p.x == p.y
|
assert a.x == a.y
|
||||||
|
|
||||||
p.x = p.y + 1
|
a.x = a.y + 1
|
||||||
assert p.x == 3
|
assert a.x == 3
|
||||||
assert p.y == 2
|
assert a.y == 2
|
||||||
assert p.x != p.y
|
assert a.x != a.y
|
||||||
|
|
||||||
p.y = p.x
|
a.y += 1
|
||||||
assert p.x == 3
|
assert a.x == 3
|
||||||
assert p.y == 3
|
assert a.y == 3
|
||||||
assert p.x == p.y
|
assert a.x == a.y
|
||||||
|
|
||||||
delete(p)
|
b := new(Point)
|
||||||
|
assert b.x == 0
|
||||||
|
assert b.y == 0
|
||||||
|
|
||||||
|
b.x = -3
|
||||||
|
b.y = -3
|
||||||
|
assert b.x == -3
|
||||||
|
assert b.y == -3
|
||||||
|
|
||||||
|
c := new(Point)
|
||||||
|
assert c.x == 0
|
||||||
|
assert c.y == 0
|
||||||
|
|
||||||
|
c.x = a.x + b.x
|
||||||
|
c.y = a.y + b.y
|
||||||
|
assert c.x == a.x + b.x
|
||||||
|
assert c.y == a.y + b.y
|
||||||
|
assert c.x == 0
|
||||||
|
assert c.y == 0
|
||||||
|
|
||||||
|
delete(a)
|
||||||
|
delete(b)
|
||||||
|
delete(c)
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user