Added base tests for end to end manager functionality

This commit is contained in:
Alejandro Saucedo 2020-08-26 18:53:50 +01:00
parent 1748694b3a
commit 39b051160a
7 changed files with 199 additions and 181 deletions

View file

@ -1,25 +1,10 @@
#include <catch2/catch.hpp>
#include "Tensor.hpp"
#include "kompute/Tensor.hpp"
int Factorial( int number ) {
return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
// return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass
}
TEST_CASE( "Factorial of 0 is 1 (fail)", "[single-file]" ) {
REQUIRE( Factorial(0) == 1 );
}
TEST_CASE( "Factorials of 1 and higher are computed (pass)", "[single-file]" ) {
REQUIRE( Factorial(1) == 1 );
REQUIRE( Factorial(2) == 2 );
REQUIRE( Factorial(3) == 6 );
REQUIRE( Factorial(10) == 3628800 );
}
TEST_CASE("Exploring if manager test compiles") {
kp::Tensor tensor({0,1,2});
REQUIRE( tensor.size() == 3 );
TEST_CASE("Tensor should have same vector as initialised") {
std::vector<uint32_t> vec{0,1,2};
kp::Tensor tensor(vec);
REQUIRE( tensor.data() == vec );
}