-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.py
More file actions
26 lines (23 loc) · 829 Bytes
/
Copy pathhelpers.py
File metadata and controls
26 lines (23 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## ------------------------------
# Test helper functions
# ------------------------------
def check(expected, actual, message=""):
"""Check test result and print outcome in a clear format."""
print(f"--- {message} ---")
print(f"Expected: {expected}")
print(f"Returned: {actual}")
result = "PASS" if expected == actual else "FAIL"
print(f"Result: {result}\n")
def check_list(linked_list, expected_list, message=""):
"""Check if linked list values match the expected list."""
actual = []
node = linked_list.head
while node:
actual.append(node.value)
node = node.next
check(expected_list, actual, message)
def print_title(title):
"""Print a clear section title for test cases."""
print("\n" + "="*len(title))
print(title)
print("="*len(title) + "\n")