Updated test files to work with gtest
This commit is contained in:
parent
e666c3f1d6
commit
0b35b5e9d6
11 changed files with 122 additions and 120 deletions
|
|
@ -35,8 +35,6 @@ if(KOMPUTE_OPT_BUILD_DOCS)
|
|||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_BUILD_TESTS)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
find_package(Catch2 REQUIRED)
|
||||
enable_testing()
|
||||
find_package(GTest CONFIG REQUIRED)
|
||||
|
||||
file(GLOB test_kompute_CPP
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
||||
|
|
@ -13,7 +14,11 @@ target_include_directories(
|
|||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/compiled_shaders_include>
|
||||
)
|
||||
|
||||
target_link_libraries(test_kompute PRIVATE Catch2::Catch2)
|
||||
target_link_libraries(test_kompute PRIVATE
|
||||
GTest::gtest
|
||||
GTest::gtest_main
|
||||
GTest::gmock
|
||||
GTest::gmock_main)
|
||||
target_link_libraries(test_kompute PRIVATE kompute)
|
||||
|
||||
add_test(NAME test_kompute COMMAND test_kompute)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST_CASE("test_logistic_regression") {
|
||||
TEST(LogisticRegressionAlgorithm, TestMainLogisticRegression) {
|
||||
|
||||
uint32_t ITERATIONS = 100;
|
||||
|
||||
|
|
@ -71,9 +71,9 @@ TEST_CASE("test_logistic_regression") {
|
|||
// * wi < 0.01
|
||||
// * wj > 1.0
|
||||
// * b < 0
|
||||
REQUIRE(wIn->data()[0] < 0.01);
|
||||
REQUIRE(wIn->data()[1] > 1.0);
|
||||
REQUIRE(bIn->data()[0] < 0.0);
|
||||
EXPECT_LT(wIn->data()[0], 0.01);
|
||||
EXPECT_GT(wIn->data()[1], 1.0);
|
||||
EXPECT_LT(bIn->data()[0], 0.0);
|
||||
|
||||
//SPDLOG_DEBUG("Result wIn: {}, bIn: {}",
|
||||
// wIn->data(), bIn->data());
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
#define CATCH_CONFIG_RUNNER
|
||||
|
||||
// clang-format: SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import
|
||||
#if DEBUG
|
||||
#ifndef SPDLOG_ACTIVE_LEVEL
|
||||
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#include <spdlog/spdlog.h>
|
||||
//// clang-format: ranges.h must come after spdlog.h
|
||||
//#include <fmt/ranges.h>
|
||||
|
||||
#include "catch2/catch.hpp"
|
||||
|
||||
int main( int argc, char* argv[] ) {
|
||||
|
||||
int result = Catch::Session().run( argc, argv );
|
||||
|
||||
// global clean-up...
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//#define CATCH_CONFIG_RUNNER
|
||||
//
|
||||
//// clang-format: SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import
|
||||
//#if DEBUG
|
||||
//#ifndef SPDLOG_ACTIVE_LEVEL
|
||||
//#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
|
||||
//#endif
|
||||
//#endif
|
||||
//
|
||||
////#include <spdlog/spdlog.h>
|
||||
////// clang-format: ranges.h must come after spdlog.h
|
||||
////#include <fmt/ranges.h>
|
||||
//
|
||||
//#include "catch2/catch.hpp"
|
||||
//
|
||||
//int main( int argc, char* argv[] ) {
|
||||
//
|
||||
// int result = Catch::Session().run( argc, argv );
|
||||
//
|
||||
// // global clean-up...
|
||||
//
|
||||
// return result;
|
||||
//}
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST_CASE("End to end OpMult Flow should execute correctly from manager")
|
||||
TEST(TestManager, EndToEndOpMultFlow)
|
||||
{
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -20,10 +20,10 @@ TEST_CASE("End to end OpMult Flow should execute correctly from manager")
|
|||
|
||||
mgr.evalOp<kp::OpMult<>>({ tensorLHS, tensorRHS, tensorOutput });
|
||||
|
||||
REQUIRE(tensorOutput->data() == std::vector<float>{0, 4, 12});
|
||||
EXPECT_EQ(tensorOutput->data(), std::vector<float>({0, 4, 12}));
|
||||
}
|
||||
|
||||
TEST_CASE("End to end OpMult Flow should execute correctly from sequence") {
|
||||
TEST(TestManager, OpMultSequenceFlow) {
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorLHS{ new kp::Tensor(
|
||||
{ 0, 1, 2 }) };
|
||||
|
|
@ -51,10 +51,10 @@ TEST_CASE("End to end OpMult Flow should execute correctly from sequence") {
|
|||
}
|
||||
sqWeakPtr.reset();
|
||||
|
||||
REQUIRE(tensorOutput->data() == std::vector<float>{0, 4, 12});
|
||||
EXPECT_EQ(tensorOutput->data(), std::vector<float>({0, 4, 12}));
|
||||
}
|
||||
|
||||
TEST_CASE("Test manager get create functionality for sequences") {
|
||||
TEST(TestManager, TestMultipleSequences) {
|
||||
kp::Manager mgr;
|
||||
|
||||
std::weak_ptr<kp::Sequence> sqWeakPtrOne =
|
||||
|
|
@ -69,13 +69,13 @@ TEST_CASE("Test manager get create functionality for sequences") {
|
|||
std::weak_ptr<kp::Sequence> sqWeakPtrTwoRef =
|
||||
mgr.getOrCreateManagedSequence("sqTwo");
|
||||
|
||||
REQUIRE(sqWeakPtrOne.lock() == sqWeakPtrOneRef.lock());
|
||||
REQUIRE(sqWeakPtrTwo.lock() != sqWeakPtrOneRef.lock());
|
||||
REQUIRE(sqWeakPtrTwo.lock() == sqWeakPtrTwoRef.lock());
|
||||
REQUIRE(sqWeakPtrOneRef.lock() != sqWeakPtrTwoRef.lock());
|
||||
EXPECT_EQ(sqWeakPtrOne.lock(), sqWeakPtrOneRef.lock());
|
||||
EXPECT_NE(sqWeakPtrTwo.lock(), sqWeakPtrOneRef.lock());
|
||||
EXPECT_EQ(sqWeakPtrTwo.lock(), sqWeakPtrTwoRef.lock());
|
||||
EXPECT_NE(sqWeakPtrOneRef.lock(), sqWeakPtrTwoRef.lock());
|
||||
}
|
||||
|
||||
TEST_CASE("End to end OpMult Flow with OpCreateTensor called with multiple tensors") {
|
||||
TEST(TestManager, TestMultipleTensorsAtOnce) {
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorLHS{ new kp::Tensor(
|
||||
{ 0, 1, 2 }) };
|
||||
|
|
@ -94,9 +94,9 @@ TEST_CASE("End to end OpMult Flow with OpCreateTensor called with multiple tenso
|
|||
|
||||
sq->record<kp::OpCreateTensor>({ tensorLHS, tensorRHS, tensorOutput });
|
||||
|
||||
REQUIRE(tensorLHS->isInit());
|
||||
REQUIRE(tensorRHS->isInit());
|
||||
REQUIRE(tensorOutput->isInit());
|
||||
EXPECT_TRUE(tensorLHS->isInit());
|
||||
EXPECT_TRUE(tensorRHS->isInit());
|
||||
EXPECT_TRUE(tensorOutput->isInit());
|
||||
|
||||
sq->record<kp::OpMult<>>({ tensorLHS, tensorRHS, tensorOutput });
|
||||
|
||||
|
|
@ -105,5 +105,5 @@ TEST_CASE("End to end OpMult Flow with OpCreateTensor called with multiple tenso
|
|||
}
|
||||
sqWeakPtr.reset();
|
||||
|
||||
REQUIRE(tensorOutput->data() == std::vector<float>{0, 4, 12});
|
||||
EXPECT_EQ(tensorOutput->data(), std::vector<float>({0, 4, 12}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST_CASE("test_multiple_algo_exec_single_cmd_buf_record") {
|
||||
TEST(TestMultipleAlgoExecutions, SingleSequenceRecord) {
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -43,10 +43,10 @@ TEST_CASE("test_multiple_algo_exec_single_cmd_buf_record") {
|
|||
}
|
||||
sqWeakPtr.reset();
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{3, 3, 3});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({3, 3, 3}));
|
||||
}
|
||||
|
||||
TEST_CASE("test_multiple_algo_exec_multiple_record") {
|
||||
TEST(TestMultipleAlgoExecutions, MultipleCmdBufRecords) {
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -98,11 +98,11 @@ TEST_CASE("test_multiple_algo_exec_multiple_record") {
|
|||
}
|
||||
sqWeakPtr.reset();
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{3, 3, 3});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({3, 3, 3}));
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("test_multiple_algo_exec_multiple_sequence") {
|
||||
TEST(TestMultipleAlgoExecutions, MultipleSequences) {
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -160,10 +160,10 @@ TEST_CASE("test_multiple_algo_exec_multiple_sequence") {
|
|||
sq->eval();
|
||||
}
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{3, 3, 3});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({3, 3, 3}));
|
||||
}
|
||||
|
||||
TEST_CASE("test_multiple_algo_exec_single_sequence_single_record") {
|
||||
TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval) {
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -205,6 +205,6 @@ TEST_CASE("test_multiple_algo_exec_single_sequence_single_record") {
|
|||
sq->eval();
|
||||
}
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{3, 3, 3});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({3, 3, 3}));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST_CASE("test_opcreatetensor_create_single_tensor") {
|
||||
TEST(TestOpCreateTensor, CreateSingleTensorSingleOp) {
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -13,15 +13,15 @@ TEST_CASE("test_opcreatetensor_create_single_tensor") {
|
|||
|
||||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorA});
|
||||
|
||||
REQUIRE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
|
||||
REQUIRE(tensorA->data() == testVecA);
|
||||
EXPECT_EQ(tensorA->data(), testVecA);
|
||||
|
||||
tensorA->freeMemoryDestroyGPUResources();
|
||||
REQUIRE(!tensorA->isInit());
|
||||
EXPECT_FALSE(tensorA->isInit());
|
||||
}
|
||||
|
||||
TEST_CASE("test_opcreatetensor_create_multiple_tensors_single_op") {
|
||||
TEST(TestOpCreateTensor, CreateMultipleTensorSingleOp) {
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -33,14 +33,14 @@ TEST_CASE("test_opcreatetensor_create_multiple_tensors_single_op") {
|
|||
|
||||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorA, tensorB});
|
||||
|
||||
REQUIRE(tensorA->isInit());
|
||||
REQUIRE(tensorB->isInit());
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
||||
REQUIRE(tensorA->data() == testVecA);
|
||||
REQUIRE(tensorB->data() == testVecB);
|
||||
EXPECT_EQ(tensorA->data(), testVecA);
|
||||
EXPECT_EQ(tensorB->data(), testVecB);
|
||||
}
|
||||
|
||||
TEST_CASE("test_opcreatetensor_create_multiple_tensors_multiple_op") {
|
||||
TEST(TestOpCreateTensor, CreateMultipleTensorMultipleOp) {
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
|
|
@ -53,14 +53,14 @@ TEST_CASE("test_opcreatetensor_create_multiple_tensors_multiple_op") {
|
|||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorA});
|
||||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorB});
|
||||
|
||||
REQUIRE(tensorA->isInit());
|
||||
REQUIRE(tensorB->isInit());
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
||||
REQUIRE(tensorA->data() == testVecA);
|
||||
REQUIRE(tensorB->data() == testVecB);
|
||||
EXPECT_EQ(tensorA->data(), testVecA);
|
||||
EXPECT_EQ(tensorB->data(), testVecB);
|
||||
}
|
||||
|
||||
TEST_CASE("test_opcreatetensor_manage_tensor_memory_when_destroyed") {
|
||||
TEST(TestOpCreateTensor, ManageTensorMemoryWhenOpCreateTensorDestroyed) {
|
||||
|
||||
std::vector<float> testVecA{ 9, 8, 7 };
|
||||
std::vector<float> testVecB{ 6, 5, 4 };
|
||||
|
|
@ -73,18 +73,18 @@ TEST_CASE("test_opcreatetensor_manage_tensor_memory_when_destroyed") {
|
|||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorA});
|
||||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorB});
|
||||
|
||||
REQUIRE(tensorA->isInit());
|
||||
REQUIRE(tensorB->isInit());
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
||||
REQUIRE(tensorA->data() == testVecA);
|
||||
REQUIRE(tensorB->data() == testVecB);
|
||||
EXPECT_EQ(tensorA->data(), testVecA);
|
||||
EXPECT_EQ(tensorB->data(), testVecB);
|
||||
}
|
||||
|
||||
REQUIRE(!tensorA->isInit());
|
||||
REQUIRE(!tensorB->isInit());
|
||||
EXPECT_FALSE(tensorA->isInit());
|
||||
EXPECT_FALSE(tensorB->isInit());
|
||||
}
|
||||
|
||||
TEST_CASE("test_opcreatetensor_no_error_if_tensor_freed_before") {
|
||||
TEST(TestOpCreateTensor, NoErrorIfTensorFreedBefore) {
|
||||
|
||||
std::vector<float> testVecA{ 9, 8, 7 };
|
||||
std::vector<float> testVecB{ 6, 5, 4 };
|
||||
|
|
@ -97,15 +97,15 @@ TEST_CASE("test_opcreatetensor_no_error_if_tensor_freed_before") {
|
|||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorA});
|
||||
mgr.evalOpDefault<kp::OpCreateTensor>({tensorB});
|
||||
|
||||
REQUIRE(tensorA->isInit());
|
||||
REQUIRE(tensorB->isInit());
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
||||
REQUIRE(tensorA->data() == testVecA);
|
||||
REQUIRE(tensorB->data() == testVecB);
|
||||
EXPECT_EQ(tensorA->data(), testVecA);
|
||||
EXPECT_EQ(tensorB->data(), testVecB);
|
||||
|
||||
tensorA->freeMemoryDestroyGPUResources();
|
||||
tensorB->freeMemoryDestroyGPUResources();
|
||||
REQUIRE(!tensorA->isInit());
|
||||
REQUIRE(!tensorB->isInit());
|
||||
EXPECT_FALSE(tensorA->isInit());
|
||||
EXPECT_FALSE(tensorB->isInit());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
#include "kompute_test/shaders/shadertest_op_custom_shader.hpp"
|
||||
|
||||
TEST_CASE("test_op_shader_raw_data_from_constructor") {
|
||||
TEST(TestOpAlgoBase, ShaderRawDataFromConstructor) {
|
||||
kp::Manager mgr;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA{ new kp::Tensor({ 3, 4, 5 })};
|
||||
|
|
@ -29,11 +29,11 @@ TEST_CASE("test_op_shader_raw_data_from_constructor") {
|
|||
true, // Whether to copy output from device
|
||||
std::vector<char>(shader.begin(), shader.end()));
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{0, 1, 2});
|
||||
REQUIRE(tensorB->data() == std::vector<float>{3, 4, 5});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({0, 1, 2}));
|
||||
EXPECT_EQ(tensorB->data(), std::vector<float>({3, 4, 5}));
|
||||
}
|
||||
|
||||
TEST_CASE("test_op_shader_compiled_data_from_constructor") {
|
||||
TEST(TestOpAlgoBase, ShaderCompiledDataFromConstructor) {
|
||||
kp::Manager mgr;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA{ new kp::Tensor({ 3, 4, 5 })};
|
||||
|
|
@ -48,11 +48,11 @@ TEST_CASE("test_op_shader_compiled_data_from_constructor") {
|
|||
kp::shader_data::test_shaders_glsl_test_op_custom_shader_comp_spv +
|
||||
kp::shader_data::test_shaders_glsl_test_op_custom_shader_comp_spv_len));
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{0, 1, 2});
|
||||
REQUIRE(tensorB->data() == std::vector<float>{3, 4, 5});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({0, 1, 2}));
|
||||
EXPECT_EQ(tensorB->data(), std::vector<float>({3, 4, 5}));
|
||||
}
|
||||
|
||||
TEST_CASE("test_op_shader_raw_from_file") {
|
||||
TEST(TestOpAlgoBase, ShaderRawDataFromFile) {
|
||||
kp::Manager mgr;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA{ new kp::Tensor({ 3, 4, 5 })};
|
||||
|
|
@ -64,11 +64,11 @@ TEST_CASE("test_op_shader_raw_from_file") {
|
|||
true, // Whether to copy output from device
|
||||
"test/shaders/glsl/test_op_custom_shader.comp");
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{0, 1, 2});
|
||||
REQUIRE(tensorB->data() == std::vector<float>{3, 4, 5});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({0, 1, 2}));
|
||||
EXPECT_EQ(tensorB->data(), std::vector<float>({3, 4, 5}));
|
||||
}
|
||||
|
||||
TEST_CASE("test_op_shader_compiled_from_file") {
|
||||
TEST(TestOpAlgoBase, ShaderCompiledDataFromFile) {
|
||||
kp::Manager mgr;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA{ new kp::Tensor({ 3, 4, 5 })};
|
||||
|
|
@ -80,6 +80,6 @@ TEST_CASE("test_op_shader_compiled_from_file") {
|
|||
true, // Whether to copy output from device
|
||||
"test/shaders/glsl/test_op_custom_shader.comp.spv");
|
||||
|
||||
REQUIRE(tensorA->data() == std::vector<float>{0, 1, 2});
|
||||
REQUIRE(tensorB->data() == std::vector<float>{3, 4, 5});
|
||||
EXPECT_EQ(tensorA->data(), std::vector<float>({0, 1, 2}));
|
||||
EXPECT_EQ(tensorB->data(), std::vector<float>({3, 4, 5}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST_CASE("Sequence begin end recording should work as expected") {
|
||||
TEST(TestSequence, CmdBufSequenceBeginEnd) {
|
||||
kp::Manager mgr;
|
||||
|
||||
std::weak_ptr<kp::Sequence> sqWeakPtr =
|
||||
mgr.getOrCreateManagedSequence("newSequence");
|
||||
|
||||
if (std::shared_ptr<kp::Sequence> sq = sqWeakPtr.lock()) {
|
||||
REQUIRE(sq->eval());
|
||||
REQUIRE(!sq->isRecording());
|
||||
REQUIRE(sq->begin());
|
||||
REQUIRE(sq->isRecording());
|
||||
REQUIRE(!sq->begin());
|
||||
REQUIRE(sq->isRecording());
|
||||
REQUIRE(sq->end());
|
||||
REQUIRE(!sq->isRecording());
|
||||
REQUIRE(!sq->end());
|
||||
REQUIRE(!sq->isRecording());
|
||||
REQUIRE(sq->eval());
|
||||
EXPECT_TRUE(sq->eval());
|
||||
EXPECT_TRUE(!sq->isRecording());
|
||||
EXPECT_TRUE(sq->begin());
|
||||
EXPECT_TRUE(sq->isRecording());
|
||||
EXPECT_TRUE(!sq->begin());
|
||||
EXPECT_TRUE(sq->isRecording());
|
||||
EXPECT_TRUE(sq->end());
|
||||
EXPECT_TRUE(!sq->isRecording());
|
||||
EXPECT_TRUE(!sq->end());
|
||||
EXPECT_TRUE(!sq->isRecording());
|
||||
EXPECT_TRUE(sq->eval());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
|
||||
#include <catch2/catch.hpp>
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST_CASE("test_tensor_constructor_data") {
|
||||
TEST(TestTensor, ConstructorData) {
|
||||
std::vector<float> vec{0,1,2};
|
||||
kp::Tensor tensor(vec);
|
||||
REQUIRE( tensor.size() == vec.size() );
|
||||
REQUIRE( tensor.data() == vec );
|
||||
EXPECT_EQ( tensor.size(), vec.size() );
|
||||
EXPECT_EQ( tensor.data(), vec );
|
||||
}
|
||||
|
||||
TEST_CASE("test_tensor_copy_from_other_tensor_host_data") {
|
||||
TEST(TestTensor, CopyFromHostData) {
|
||||
std::vector<float> vecA{0,1,2};
|
||||
std::vector<float> vecB{0,0,0};
|
||||
|
||||
|
|
@ -41,6 +41,6 @@ TEST_CASE("test_tensor_copy_from_other_tensor_host_data") {
|
|||
tensorB->mapDataFromHostMemory();
|
||||
}
|
||||
|
||||
REQUIRE(tensorA->data() == tensorB->data());
|
||||
EXPECT_EQ(tensorA->data(), tensorB->data());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
"name": "example",
|
||||
"version-string": "0.0.1",
|
||||
"dependencies": [
|
||||
"fmt",
|
||||
"spdlog",
|
||||
"vulkan",
|
||||
"catch2"
|
||||
"gtest"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue