Skip to content

Commit

Permalink
Adds one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
fr33m0nk committed Apr 4, 2024
1 parent 41c593c commit c3d09db
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/data_structures/stack/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@
(s/push-in-stack "another-other-value")
(s/full-stack?))))))

(deftest push-in-stack-test
(testing "pushes element in a not full stack"
(is (= [3 ["a-value" "other-value" "another-other-value"]]
(-> (s/->Stack 3)
(s/push-in-stack "a-value")
(s/push-in-stack "other-value")
(s/push-in-stack "another-other-value")))))

(testing "throws error when trying to push element in a full stack"
(is (thrown? AssertionError
(-> (s/->Stack 3)
(s/push-in-stack "a-value")
(s/push-in-stack "other-value")
(s/push-in-stack "another-other-value")
(s/push-in-stack "yet-another-other-value"))))))

(deftest peek-at-stack-test
(testing "returns peeking at an empty stack"
(is (nil? (-> (s/->Stack 3)
Expand Down

0 comments on commit c3d09db

Please sign in to comment.