/* StackTestProcedures.c Author: W. M. Farmer Revised: January 27, 2007 Description: Test procedures for the interface of StackPlus module. */ #include #include "StackPlus.h" /* Test functions */ void print_state() { stack_print(); printf("Height = %d.\n", stack_height()); if (stack_height() != 0) printf("Top = %d.\n", stack_top()); else printf("Top is undefined.\n"); if (stack_is_empty()) printf("Empty = true.\n"); else printf("Empty = false.\n"); printf("\n"); } void test_stack_push(int x) { stack_push(x); printf("Push %d.\n",x); print_state(); } void test_stack_pop() { stack_pop(); printf("Pop.\n"); print_state(); } void test_stack_set_top(int x) { stack_set_top(x); printf("Set top to %d.\n",x); print_state(); } void test_stack_reset() { stack_reset(); printf("Reset.\n"); print_state(); }