add a test case for the stage detect code