Adds tests for stack semantics

Issue: #32