From c3d09dbce91c343571637955f10cc223e6f7c39c Mon Sep 17 00:00:00 2001 From: fr33m0nk Date: Thu, 4 Apr 2024 11:54:23 +0530 Subject: [PATCH] Adds one more test --- test/data_structures/stack/core_test.clj | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/data_structures/stack/core_test.clj b/test/data_structures/stack/core_test.clj index e3185cb..2790e36 100644 --- a/test/data_structures/stack/core_test.clj +++ b/test/data_structures/stack/core_test.clj @@ -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)