unit tests for gstack.c