Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import my_stack as st
- #Stos
- def test_new():
- s = st.new()
- if s == []:
- print("Test passed succesfully!")
- passed = True
- else:
- print("Test didnt passed!")
- passed = False
- return passed
- def test_empty():
- s = st.new()
- if st.empty(s):
- print("Test passed succesfully!")
- passed = True
- else:
- print("Test didnt passed!")
- passed = False
- return passed
- def test_pop():
- s = st.new()
- st.push(s, 5)
- st.push(s, 10)
- st.push(s, 15)
- ostatni = st.pop(s)
- if ostatni == 15:
- print("Test passed succesfully!")
- passed = True
- else:
- print("Test didnt passed!")
- passed = False
- return passed
- def test_push():
- s = st.new()
- st.push(s, 5)
- if s[0] == 5:
- print("Test passed succesfully!")
- passed = True
- else:
- print("Test didnt passed!")
- passed = False
- return passed
- def test_top():
- s = st.new()
- st.push(s, 5)
- st.push(s, 15)
- if st.top(s) == 20:
- print("Test passed succesfully!")
- passed = False
- else:
- print("Test didnt passed!")
- passed = False
- return passed
- print("Testy stos")
- test_new()
- test_empty()
- test_pop()
- test_push()
- test_top()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement