Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.84 KB | None | 0 0
  1. def test_circular():
  2.     print("Test is_circular: ", end="")
  3.     node = Node()
  4.     node.next = node
  5.     res = is_circular(node)
  6.     if res:
  7.         print("OK", end="\n")
  8.     else:
  9.         print("FAIL -> Node -> ma vracet True, vracite False", end="\n")
  10.     print("Test is_circular 2: ", end="")
  11.     node2 = Node()
  12.     node.next = node2
  13.     node3 = Node()
  14.     node2.next = node3
  15.     node3.next = node
  16.     res = is_circular(node)
  17.     if res:
  18.         print("OK", end="\n")
  19.     else:
  20.         print("FAIL -> Node -> Node2 -> Node3 -> ma vracet True, vracite False", end="\n")
  21.     print("Test is_circular 3: ", end="")
  22.     node3.next = None
  23.     res = is_circular(node)
  24.     if res:
  25.         print("FAIL -> Node -> Node2 -> Node3 ma vracet False, vracite True", end="\n")
  26.     else:
  27.         print("OK", end="\n")
  28.  
  29.  
  30. def test_get_length():
  31.     print("Test get_length: ", end="")
  32.     node = Node()
  33.     node.next = None
  34.     res = get_length(node)
  35.     if res == 1:
  36.         print("OK", end="\n")
  37.     else:
  38.         print("FAIL -> Node ma vracet 1, vy vracite %d" % res, end="\n")
  39.     print("Test get_length 2: ", end="")
  40.     node2 = Node()
  41.     node3 = Node()
  42.     node4 = Node()
  43.     node.next = node2
  44.     node2.next = node3
  45.     node3.next = node4
  46.     node4.next = node
  47.     res = get_length(node)
  48.     if res == 4:
  49.         print("OK", end="\n")
  50.     else:
  51.         print("FAIL -> Node, Node2, Node3, Node4 -> ma vracet 4, vy vracite %d" % res, end="\n")
  52.     print("Test get_length 3: ", end="")
  53.     node4.next = None
  54.     res = get_length(node)
  55.     if res == 4:
  56.         print("OK", end="\n")
  57.     else:
  58.         print("FAIL -> Node1, Node2, Node3, Node4 ma vracet 4, vy vracite %d" % res, end="\n")
  59.  
  60.  
  61. def test_calculate_opposites():
  62.     pass
  63.  
  64.  
  65. if __name__ == '__main__':
  66.     test_circular()
  67.     test_get_length()
  68.     test_calculate_opposites()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement