From a3ac073975b8697b624df965ce7f5b8a89300641 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Sun, 22 Jul 2018 23:05:25 +0200 Subject: [PATCH] extent operation unit test to be sure --- src/tests/op_unit_test.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/op_unit_test.cc b/src/tests/op_unit_test.cc index a360b14..ea69ee3 100644 --- a/src/tests/op_unit_test.cc +++ b/src/tests/op_unit_test.cc @@ -317,6 +317,7 @@ namespace { { MultiArray ma(sr, sr, sr, sr, sr, sr, sr, sr, data); MultiArray res1( sr, sr ); + MultiArray res2( sr, sr ); auto alpha = MAT::getIndex(); auto beta = MAT::getIndex(); @@ -331,6 +332,8 @@ namespace { std::clock_t end = std::clock(); std::cout << "MultiArray time: " << static_cast( end - begin ) / CLOCKS_PER_SEC << std::endl; + + res2(delta, deltap) = ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(alpha).c(beta).c(gamma); std::vector vres(4*4); @@ -371,6 +374,26 @@ namespace { EXPECT_EQ( xround(res1.at(mkts(3,2))), xround(vres[14]) ); EXPECT_EQ( xround(res1.at(mkts(3,3))), xround(vres[15]) ); + EXPECT_EQ( xround(res2.at(mkts(0,0))), xround(vres[0]) ); + EXPECT_EQ( xround(res2.at(mkts(0,1))), xround(vres[1]) ); + EXPECT_EQ( xround(res2.at(mkts(0,2))), xround(vres[2]) ); + EXPECT_EQ( xround(res2.at(mkts(0,3))), xround(vres[3]) ); + + EXPECT_EQ( xround(res2.at(mkts(1,0))), xround(vres[4]) ); + EXPECT_EQ( xround(res2.at(mkts(1,1))), xround(vres[5]) ); + EXPECT_EQ( xround(res2.at(mkts(1,2))), xround(vres[6]) ); + EXPECT_EQ( xround(res2.at(mkts(1,3))), xround(vres[7]) ); + + EXPECT_EQ( xround(res2.at(mkts(2,0))), xround(vres[8]) ); + EXPECT_EQ( xround(res2.at(mkts(2,1))), xround(vres[9]) ); + EXPECT_EQ( xround(res2.at(mkts(2,2))), xround(vres[10]) ); + EXPECT_EQ( xround(res2.at(mkts(2,3))), xround(vres[11]) ); + + EXPECT_EQ( xround(res2.at(mkts(3,0))), xround(vres[12]) ); + EXPECT_EQ( xround(res2.at(mkts(3,1))), xround(vres[13]) ); + EXPECT_EQ( xround(res2.at(mkts(3,2))), xround(vres[14]) ); + EXPECT_EQ( xround(res2.at(mkts(3,3))), xround(vres[15]) ); + std::cout << "std::vector - for loop time: " << static_cast( end2 - begin2 ) / CLOCKS_PER_SEC << std::endl; std::cout << "ratio: " << static_cast( end - begin ) / static_cast( end2 - begin2 ) << std::endl;