add assertion to main block in vector.py as an example of simple test
This commit is contained in:
@@ -32,7 +32,10 @@ class Vector(object):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
v1 = Vector(2.0, 13.0, -1.0)
|
||||
v1 = Vector(3, 4, 0)
|
||||
print(v1, " magnitude is", v1.abs())
|
||||
v2 = Vector(1.0, 2.0, 3.0)
|
||||
print("v1.dot(v2) =", v1.dot(v2))
|
||||
|
||||
assert v1.abs() == 5
|
||||
print("Tests passed!")
|
||||
Reference in New Issue
Block a user