Unit tests for engine.py