int TEST_catcierge_fsm_haar_matcher(int argc, char **argv)
{
	char *e = NULL;
	int ret = 0;
	catcierge_test_HEADLINE("TEST_catcierge_fsm_haar_matcher");

	catcierge_haar_matcher_usage();

	CATCIERGE_RUN_TEST((e = run_success_tests()),
		"Run success tests. Without obstruct",
		"Success match without obstruct", &ret);

	CATCIERGE_RUN_TEST((e = run_failure_tests(PREY_METHOD_NORMAL)),
		"Run failure tests. Normal prey matching",
		"Failure tests with Normal prey matching", &ret);

	CATCIERGE_RUN_TEST((e = run_failure_tests(PREY_METHOD_ADAPTIVE)),
		"Run failure tests. Adaptive prey matching",
		"Failure tests with Adaptive prey matching", &ret);

	CATCIERGE_RUN_TEST((e = run_save_steps_test()),
		"Run save steps tests. Adaptive prey matching",
		"Save steps tests", &ret);

	if (ret)
	{
		catcierge_test_FAILURE("One or more tests failed");
	}

	return ret;
}
int TEST_catcierge_fsm_template_matcher(int argc, char **argv)
{
	int ret = 0;
	char *e = NULL;
	int obstruct;

	catcierge_test_HEADLINE("TEST_catcierge_fsm_template_matcher");

	catcierge_template_matcher_usage();

	// Test without anything obstructing the frame after
	// the successful match.
	CATCIERGE_RUN_TEST((e = run_success_tests(0)),
		"Run success tests. Without obstruct",
		"Success match without obstruct", &ret);

	// Same as above, but add an extra frame obstructing at the end.
	CATCIERGE_RUN_TEST((e = run_success_tests(1)),
		"Run success tests. With obstruct",
		"Success match with obstruct", &ret);

	// Obstruct 1 means we obstruct, and then remove the obstruction.
	// Obstruct 2 keeps obstructing.
	for (obstruct = 0; obstruct <= 2; obstruct++)
	{
		size_t i;
		catcierge_lockout_method_t locks[] = {
			OBSTRUCT_OR_TIMER_3,
			OBSTRUCT_THEN_TIMER_2,
			TIMER_ONLY_1
		};

		for (i = 0; i < sizeof(locks) / sizeof(locks[0]); i++)
		{
			CATCIERGE_RUN_TEST((e = run_failure_tests(obstruct, locks[i])),
				"Run failure tests.",
				"Failure tests passed", &ret);
		}
	}

	// This fails on the Raspberry pi, the camera fails to init for some reason...
	#ifndef RPI
	run_camera_test();
	#endif

	if (ret)
	{
		catcierge_test_FAILURE("One of the tests failed!\n");
	}

	return ret;
}