feat: finished kata building_blocks, thinkful_quarks and thinkful_vectors. test: finished test cases for katas
This commit is contained in:
1 parent
8f3cd117ef
commit
35f4b12c34
6 files changed
+84
No files matched your search
@@ -0,0 +1,17 @@
|
||||
from src.codewars.kata_building_blocks import Block
|
||||
|
||||
|
||||
def test_block():
|
||||
b1 = Block([2, 2, 2])
|
||||
b2 = Block([41, 87, 67])
|
||||
|
||||
assert b1.get_width() == 2
|
||||
assert b1.get_length() == 2
|
||||
assert b1.get_height() == 2
|
||||
assert b1.get_volume() == 8
|
||||
assert b1.get_surface_area() == 24
|
||||
assert b2.get_width() == 41
|
||||
assert b2.get_length() == 87
|
||||
assert b2.get_height() == 67
|
||||
assert b2.get_volume() == 238989
|
||||
assert b2.get_surface_area() == 24286
|
||||
@@ -0,0 +1,15 @@
|
||||
from src.codewars.kata_thinkful_quarks import Quark
|
||||
|
||||
|
||||
def test_quark():
|
||||
q1 = Quark("red", "up")
|
||||
q2 = Quark("blue", "strange")
|
||||
|
||||
assert q1.color == "red"
|
||||
assert q2.flavor == "strange"
|
||||
assert q2.baryon_number == 1 / 3
|
||||
|
||||
q1.interact(q2)
|
||||
|
||||
assert q1.color == "blue"
|
||||
assert q2.color == "red"
|
||||
@@ -0,0 +1,13 @@
|
||||
from src.codewars.kata_thinkful_vectors import Vector
|
||||
|
||||
|
||||
def test_vector():
|
||||
v1 = Vector(3, 4)
|
||||
v2 = Vector(1, 2)
|
||||
|
||||
assert v1.x == 3
|
||||
assert v2.y == 2
|
||||
assert hasattr(v1, "add")
|
||||
assert isinstance(v1.add(v2), Vector)
|
||||
assert (v1.add(v2)).x == 4
|
||||
assert (v1.add(v2)).y == 6
|
||||
Reference in new issue
Block a user