Added exception and stack functions to the test module

Useful for testing.