ETest Examples
This directory contains some example test cases built using the ETest framework. You will find the following files ...
README.txt
This file.
good_stack.e
Simple fixed-size stack class to be tested.
bad_stack.e
Just like good_stack.e, except that the implementor goofed!
The class implements a FIFO rather than a LIFO. This class
will fail a portion of its test case.
really_bad_stack.e
A really bad implementation of good_stack. We forgot to
create the array that holds the stack values. The class will
abort during the test case.
test_good_stack.e
A simple test case for the fixed size stack.
test_bad_stack.e
A simple test case for the bad fixed size stack.
test_really_bad_stack.e
A simple test case for the really bad fixed size stack.
loadpath.se
The load path file for GNU SmallEiffel.
Running the Examples
Make "examples" your current directory. Modify "loadpath.se" as needed. Make sure the "eunit" program is in your path. Then type:
eunit
You should see the following output.
Preparing Test Cases
Compiling Test Cases
Running Test Case
Test Summary for main
# Passed: 6 tests
# Failed: 1 tests
# Aborted: 3 tests
# Total: 10 tests (40 assertions)
Test Results:
FAIL: [TEST_BAD_STACK.test_pop] value18 (expected: 18 but got: 20)
ABORT: [TEST_BAD_STACK.test_overflow] Precondition Failed
ABORT: [TEST_REALLY_BAD_STACK.test_push] <unknown exception>
ABORT: [TEST_REALLY_BAD_STACK.test_pop] <unknown exception>
There will be 4 tests that do not pass! The examples are purposely designed to fail. For each non-successful test, you will see the test file that failed (e.g. TEST_BAD_STACK), the particular test that failed (test_pop) and the assertion that failed (e.g. value18).
After the tests have been run, there will be a number of files beginning with "XTEST" in your directory. These are automatically generated files used to build the test case program. The test program itself will be called "XTEST_MAIN". Use the command "eunit-clean" to clean up (i.e. delete) all generated files.
