diff --git a/src/block.h b/src/block.h index ee6f7a7..3348aa3 100644 --- a/src/block.h +++ b/src/block.h @@ -33,11 +33,8 @@ namespace MultiArrayHelper class BlockBase { public: - BlockBase() = default; + DEFAULT_MEMBERS(BlockBase); BlockBase(size_t size); - - BlockBase(BlockBase&& res) = default; - BlockBase& operator=(BlockBase&& res) = default; virtual BlockType type() const = 0; virtual size_t stepSize() const = 0; @@ -74,13 +71,10 @@ namespace MultiArrayHelper { public: - MutableBlockBase() = default; + DEFAULT_MEMBERS(MutableBlockBase); MutableBlockBase(size_t size); MutableBlockBase& operator=(const BlockBase& in); - - MutableBlockBase(MutableBlockBase&& res) = default; - MutableBlockBase& operator=(MutableBlockBase&& res) = default; virtual T& operator[](size_t pos) = 0; @@ -90,7 +84,7 @@ namespace MultiArrayHelper class Block : public BlockBase { public: - Block() = default; + DEFAULT_MEMBERS(Block); Block(const std::vector& data, size_t begPos, size_t size); virtual BlockType type() const override; @@ -107,7 +101,7 @@ namespace MultiArrayHelper class MBlock : public MutableBlockBase { public: - MBlock() = default; + DEFAULT_MEMBERS(MBlock); MBlock(std::vector& data, size_t begPos, size_t size); virtual BlockType type() const override; @@ -125,7 +119,8 @@ namespace MultiArrayHelper class BlockValue : public BlockBase { public: - BlockValue() = default; + DEFAULT_MEMBERS(BlockValue); + BlockValue(const std::vector& data, size_t pos, size_t size); @@ -143,7 +138,8 @@ namespace MultiArrayHelper class MBlockValue : public MutableBlockBase { public: - MBlockValue() = default; + DEFAULT_MEMBERS(MBlockValue); + MBlockValue(std::vector& data, size_t pos, size_t size); @@ -163,7 +159,8 @@ namespace MultiArrayHelper { public: - SplitBlock() = default; + DEFAULT_MEMBERS(SplitBlock); + SplitBlock(const std::vector& data, size_t begPos, size_t stepSize, size_t size); @@ -183,7 +180,8 @@ namespace MultiArrayHelper { public: - MSplitBlock() = default; + DEFAULT_MEMBERS(MSplitBlock); + MSplitBlock(std::vector& data, size_t begPos, size_t stepSize, size_t size); @@ -204,11 +202,9 @@ namespace MultiArrayHelper class BlockResult : public MutableBlockBase { public: - BlockResult() = default; + DEFAULT_MEMBERS(BlockResult); + BlockResult(size_t size); - - BlockResult(BlockResult&& res) = default; - BlockResult& operator=(BlockResult&& res) = default; virtual BlockType type() const override; virtual const T& operator[](size_t pos) const override; diff --git a/src/op_unit_test.cc b/src/op_unit_test.cc index 804347c..a838c25 100644 --- a/src/op_unit_test.cc +++ b/src/op_unit_test.cc @@ -132,7 +132,7 @@ namespace { EXPECT_EQ( fabs( res.at(mkt('3','B')) - (0.373 * 4.790) ) < 0.0001, true ); } - /* + TEST_F(OpTest_MDim, ExecOp2) { MultiArray res(mr1ptr,sr4ptr); @@ -143,7 +143,7 @@ namespace { auto i1 = std::dynamic_pointer_cast( mr1ptr->index() ); auto i2 = std::dynamic_pointer_cast( sr4ptr->index() ); - res(i1,i2) = ma1(i1) + ma2(i2) - ma3(i2); + res(i1,i2) = ( ma1(i1) + ma2(i2) ) - ma3(i2); EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'A')) - (0.353 + 8.870 - 1.470) ) < 0.0001, true ); EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'B')) - (0.353 + 4.790 - 2.210) ) < 0.0001, true ); @@ -160,7 +160,7 @@ namespace { EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'A')) - (2.911 + 8.870 - 1.470) ) < 0.0001, true ); EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'B')) - (2.911 + 4.790 - 2.210) ) < 0.0001, true ); } - + TEST_F(OpTest_MDim, ExecOp3) { MultiArray res(mr1ptr,sr4ptr); @@ -191,7 +191,7 @@ namespace { EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'A')) - (2.911 + 0.373 + 1.470) ) < 0.0001, true ); EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'B')) - (2.911 + 0.373 + 2.210) ) < 0.0001, true ); } - */ + } // anonymous namspace int main(int argc, char** argv)