#!/bin/sh
set -e

trace()
{
    echo "$ $*"
    "$@"
}

echo "This test is expected to fail."

trace cd "$AUTOPKGTEST_TMP"

cat <<-EOF > test.cpp
	#define CATCH_CONFIG_MAIN
	#include <catch2/catch.hpp>

	unsigned int Factorial(unsigned int number)
	{
	        return number <= 1 ? number : Factorial(number - 1) * number;
	}

	TEST_CASE("Factorials are computed", "[factorial]")
	{
	        REQUIRE( Factorial(1) == 1 );
	        REQUIRE( Factorial(2) == 2 );
	        REQUIRE( Factorial(3) == 6 );
	        REQUIRE( Factorial(10) == 42 );

	}
EOF

trace c++ -o test test.cpp
trace ./test || exit 0
exit 1
