Unit test for engine.py functions