From 11327428003d94262e86c500295deedb080add7e Mon Sep 17 00:00:00 2001 From: Brian Petkovsek <16124109+BrianPetkovsek@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:39:51 -0400 Subject: [PATCH 1/2] Update tests Signed-off-by: Brian Petkovsek <16124109+BrianPetkovsek@users.noreply.github.com> --- test/TestTensor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/TestTensor.cpp b/test/TestTensor.cpp index 9c81313b..d06fb3e9 100644 --- a/test/TestTensor.cpp +++ b/test/TestTensor.cpp @@ -4,6 +4,7 @@ #include "kompute/Kompute.hpp" #include "kompute/logger/Logger.hpp" +#include "kompute/TypeContainer.hpp" TEST(TestTensor, ConstructorData) { @@ -22,24 +23,24 @@ TEST(TestTensor, DataTypes) { std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensor(vec); - EXPECT_EQ(tensor->dataType(), typeid(float)); + EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); } { std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensorT(vec); - EXPECT_EQ(tensor->dataType(), typeid(int32_t)); + EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); } { std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensorT(vec); - EXPECT_EQ(tensor->dataType(), typeid(uint32_t)); + EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); } { std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensorT(vec); - EXPECT_EQ(tensor->dataType(), typeid(double)); + EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); } } From 2c3a4ef648c900ec19769be4cb86fbbae0f0bf79 Mon Sep 17 00:00:00 2001 From: Brian Petkovsek <16124109+BrianPetkovsek@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:49:46 -0400 Subject: [PATCH 2/2] Update tests Signed-off-by: Brian Petkovsek <16124109+BrianPetkovsek@users.noreply.github.com> --- test/TestTensor.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/TestTensor.cpp b/test/TestTensor.cpp index d06fb3e9..8c2d5d6d 100644 --- a/test/TestTensor.cpp +++ b/test/TestTensor.cpp @@ -24,23 +24,47 @@ TEST(TestTensor, DataTypes) std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensor(vec); EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); + + std::shared_ptr typeContainer = + std::make_shared>(); + EXPECT_EQ(tensor->dataType(), typeContainer); + + EXPECT_EQ((*tensor->dataType()).name(), typeid(float).name()); } { std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensorT(vec); EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); + + std::shared_ptr typeContainer = + std::make_shared>(); + EXPECT_EQ(tensor->dataType(), typeContainer); + + EXPECT_EQ((*tensor->dataType()).name(), typeid(int32_t).name()); } { std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensorT(vec); EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); + + std::shared_ptr typeContainer = + std::make_shared>(); + EXPECT_EQ(tensor->dataType(), typeContainer); + + EXPECT_EQ((*tensor->dataType()).name(), typeid(uint32_t).name()); } { std::vector vec{ 0, 1, 2 }; std::shared_ptr> tensor = mgr.tensorT(vec); EXPECT_TRUE(TypeContainer().compare(*tensor->dataType())); + + std::shared_ptr typeContainer = + std::make_shared>(); + EXPECT_EQ(tensor->dataType(), typeContainer); + + EXPECT_EQ((*tensor->dataType()).name(), typeid(double).name()); } }