From 8d59c170efbf766b5cfddca79906eab73f8b34bd Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 3 May 2016 19:16:53 +0100 Subject: [PATCH] Added test_pop_excess --- test/test_stack.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test_stack.cpp b/test/test_stack.cpp index a0fe32e4..886279e9 100644 --- a/test/test_stack.cpp +++ b/test/test_stack.cpp @@ -179,6 +179,24 @@ namespace CHECK_EQUAL(1U, stack.size()); } + //************************************************************************* + TEST(test_pop_excess) + { + etl::stack stack; + + for (size_t i = 0; i < stack.max_size(); ++i) + { + stack.push(1); + } + + for (size_t i = 0; i < stack.max_size(); ++i) + { + stack.pop(); + } + + CHECK_THROW(stack.pop(), etl::stack_empty); + } + //************************************************************************* TEST(test_top) {