Added more tests
This commit is contained in:
parent
a27b8efb36
commit
6698cd95ad
2 changed files with 45 additions and 22 deletions
|
@ -4,31 +4,53 @@ struct Point {
|
|||
}
|
||||
|
||||
main() {
|
||||
p := new(Point)
|
||||
assert p.x == 0
|
||||
assert p.y == 0
|
||||
assert p.x == p.y
|
||||
a := new(Point)
|
||||
assert a.x == 0
|
||||
assert a.y == 0
|
||||
assert a.x == a.y
|
||||
|
||||
p.x = 1
|
||||
p.y = 2
|
||||
assert p.x == 1
|
||||
assert p.y == 2
|
||||
assert p.x != p.y
|
||||
a.x = 1
|
||||
a.y = 2
|
||||
assert a.x == 1
|
||||
assert a.y == 2
|
||||
assert a.x != a.y
|
||||
|
||||
p.x = p.y
|
||||
assert p.x == 2
|
||||
assert p.y == 2
|
||||
assert p.x == p.y
|
||||
a.x = a.y
|
||||
assert a.x == 2
|
||||
assert a.y == 2
|
||||
assert a.x == a.y
|
||||
|
||||
p.x = p.y + 1
|
||||
assert p.x == 3
|
||||
assert p.y == 2
|
||||
assert p.x != p.y
|
||||
a.x = a.y + 1
|
||||
assert a.x == 3
|
||||
assert a.y == 2
|
||||
assert a.x != a.y
|
||||
|
||||
p.y = p.x
|
||||
assert p.x == 3
|
||||
assert p.y == 3
|
||||
assert p.x == p.y
|
||||
a.y += 1
|
||||
assert a.x == 3
|
||||
assert a.y == 3
|
||||
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…
Add table
Add a link
Reference in a new issue