Working implementation with tests

This commit is contained in:
Alejandro Saucedo 2021-03-07 08:00:19 +00:00
parent cf7d46cd23
commit f02b9d6915
21 changed files with 297 additions and 216 deletions

View file

@ -5,9 +5,9 @@
TEST(TestDestroy, TestDestroyTensorSingle)
{
std::shared_ptr<kp::Tensor> tensorA = nullptr;
std::shared_ptr<kp::TensorT<float>> tensorA = nullptr;
std::string shader(R"(
std::string shader(R"(
#version 450
layout (local_size_x = 1) in;
layout(set = 0, binding = 0) buffer a { float pa[]; };
@ -39,13 +39,13 @@ TEST(TestDestroy, TestDestroyTensorSingle)
}
EXPECT_FALSE(tensorA->isInit());
}
EXPECT_EQ(tensorA->data(), std::vector<float>({ 1, 1, 1 }));
EXPECT_EQ(tensorA->vector(), std::vector<float>({ 1, 1, 1 }));
}
TEST(TestDestroy, TestDestroyTensorVector)
{
std::shared_ptr<kp::Tensor> tensorA = nullptr;
std::shared_ptr<kp::Tensor> tensorB = nullptr;
std::shared_ptr<kp::TensorT<float>> tensorA = nullptr;
std::shared_ptr<kp::TensorT<float>> tensorB = nullptr;
std::string shader(R"(
#version 450
@ -84,13 +84,13 @@ TEST(TestDestroy, TestDestroyTensorVector)
EXPECT_FALSE(tensorB->isInit());
}
}
EXPECT_EQ(tensorA->data(), std::vector<float>({ 2, 2, 2 }));
EXPECT_EQ(tensorB->data(), std::vector<float>({ 3, 3, 3 }));
EXPECT_EQ(tensorA->vector(), std::vector<float>({ 2, 2, 2 }));
EXPECT_EQ(tensorB->vector(), std::vector<float>({ 3, 3, 3 }));
}
TEST(TestDestroy, TestDestroySequenceSingle)
{
std::shared_ptr<kp::Tensor> tensorA = nullptr;
std::shared_ptr<kp::TensorT<float>> tensorA = nullptr;
std::string shader(R"(
#version 450
@ -123,5 +123,5 @@ TEST(TestDestroy, TestDestroySequenceSingle)
EXPECT_FALSE(sq->isInit());
}
}
EXPECT_EQ(tensorA->data(), std::vector<float>({ 1, 1, 1 }));
EXPECT_EQ(tensorA->vector(), std::vector<float>({ 1, 1, 1 }));
}