From a598de6ea379b5751d3f62e12323ac7eb05b8b4c Mon Sep 17 00:00:00 2001 From: sunwen Date: Mon, 27 Nov 2023 13:52:57 +0800 Subject: [PATCH] Add log unittest. --- test/Function1D_Cuda_Test.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/Function1D_Cuda_Test.cpp b/test/Function1D_Cuda_Test.cpp index 78239cd..57818b5 100644 --- a/test/Function1D_Cuda_Test.cpp +++ b/test/Function1D_Cuda_Test.cpp @@ -270,3 +270,27 @@ TEST_F(Function1D_Cuda_Test, repmat) EXPECT_EQ(result1[i], result2[i]); } } + +TEST_F(Function1D_Cuda_Test, log) +{ + Aurora::Matrix hostMatrix = Aurora::Matrix::fromRawData(new float[8]{1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8}, 2,4); + Aurora::CudaMatrix deviceMatrix = hostMatrix.toDeviceMatrix(); + + auto result1 = Aurora::log(hostMatrix); + auto result2 = Aurora::log(deviceMatrix).toHostMatrix(); + EXPECT_EQ(result2.getDataSize(), result1.getDataSize()); + EXPECT_EQ(result2.getValueType(), result1.getValueType()); + for(size_t i=0; i