unit tests work again
This commit is contained in:
parent
c9cdb1a430
commit
dc436af07d
3 changed files with 47 additions and 14 deletions
|
@ -777,7 +777,7 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
mVal = OperationCall<sizeof...(MAOps)-1>::
|
mVal = OperationCall<sizeof...(MAOps)-1>::
|
||||||
template callOperation(mOp, mArgs);
|
template callOperation(mOp, mArgs);
|
||||||
std::cout << mVal << std::endl;
|
//std::cout << mVal << std::endl;
|
||||||
return mVal;
|
return mVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,12 +788,37 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class ContractOperation, class Range, class... MAOps>
|
template <typename T, class ContractOperation, class Range, class... MAOps>
|
||||||
MultiArrayContraction<T,ContractOperation,Range,MAOps...>::
|
MultiArrayContraction<T,ContractOperation,Range,MAOps...>::
|
||||||
MultiArrayContraction(const ContractOperation& op,
|
MultiArrayContraction(const ContractOperation& cop,
|
||||||
const typename Range::IndexType& runIndex,
|
const typename Range::IndexType& runIndex,
|
||||||
const MAOps&... args) :
|
const MAOps&... mao) :
|
||||||
mOp(op),
|
mOp(cop),
|
||||||
mArgs(std::make_tuple(args...)) {}
|
mArgs(std::make_tuple(mao...)),
|
||||||
|
mBeginIndex(runIndex), mEndIndex(runIndex),
|
||||||
|
mRunIndex(runIndex)
|
||||||
|
{
|
||||||
|
mBeginIndex.setPos(0);
|
||||||
|
mEndIndex.setPos(mRunIndex.max());
|
||||||
|
linkIndicesTo(&mRunIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, class ContractOperation, class Range, class... MAOps>
|
||||||
|
MultiArrayContraction<T,ContractOperation,Range,MAOps...>::
|
||||||
|
MultiArrayContraction(const ContractOperation& cop,
|
||||||
|
const typename Range::IndexType& runIndex,
|
||||||
|
size_t begin,
|
||||||
|
size_t end,
|
||||||
|
const MAOps&... mao) :
|
||||||
|
mOp(cop),
|
||||||
|
mArgs(std::make_tuple(mao...)),
|
||||||
|
mBeginIndex(runIndex), mEndIndex(runIndex),
|
||||||
|
mRunIndex(runIndex)
|
||||||
|
{
|
||||||
|
mBeginIndex.setPos(begin);
|
||||||
|
mEndIndex.setPos(end);
|
||||||
|
linkIndicesTo(&mRunIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// !!!!!
|
// !!!!!
|
||||||
|
|
||||||
template <typename T, class ContractOperation, class Range, class... MAOps>
|
template <typename T, class ContractOperation, class Range, class... MAOps>
|
||||||
|
@ -815,8 +840,8 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T, class ContractOperation2, class Range, class... MAOps>
|
template <typename T, class ContractOperation, class Range, class... MAOps>
|
||||||
template <class Range2, class ContractOperation, class... MAOps2>
|
template <class Range2, class ContractOperation2, class... MAOps2>
|
||||||
MultiArrayContraction<T,ContractOperation2,Range2,
|
MultiArrayContraction<T,ContractOperation2,Range2,
|
||||||
MultiArrayContraction<T,ContractOperation,Range,MAOps...>,MAOps2...>
|
MultiArrayContraction<T,ContractOperation,Range,MAOps...>,MAOps2...>
|
||||||
MultiArrayContraction<T,ContractOperation,Range,MAOps...>::
|
MultiArrayContraction<T,ContractOperation,Range,MAOps...>::
|
||||||
|
@ -890,7 +915,7 @@ namespace MultiArrayTools
|
||||||
//MAO::mOp(std::get<0>(MAO::mArgs).get() );
|
//MAO::mOp(std::get<0>(MAO::mArgs).get() );
|
||||||
}
|
}
|
||||||
mOp.endOp();
|
mOp.endOp();
|
||||||
std::cout << MAO::mOp() << std::endl;
|
//std::cout << mOp() << std::endl;
|
||||||
return mOp();
|
return mOp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,9 +305,17 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
typedef MultiArrayOperationBase<T> MAOB;
|
typedef MultiArrayOperationBase<T> MAOB;
|
||||||
typedef std::tuple<MAOps...> OBT;
|
typedef std::tuple<MAOps...> OBT;
|
||||||
|
|
||||||
MultiArrayContraction(ContractOperation& op, const MAOps&... secs);
|
MultiArrayContraction(const ContractOperation& cop,
|
||||||
MultiArrayContraction(const ContractOperation& op, const MAOps&... secs);
|
const typename Range::IndexType& runIndex,
|
||||||
|
const MAOps&... args);
|
||||||
|
|
||||||
|
MultiArrayContraction(const ContractOperation& cop,
|
||||||
|
const typename Range::IndexType& runIndex,
|
||||||
|
size_t begin,
|
||||||
|
size_t end,
|
||||||
|
const MAOps&... mao);
|
||||||
|
|
||||||
|
|
||||||
template <class Operation2, class... MAOps2>
|
template <class Operation2, class... MAOps2>
|
||||||
MultiArrayOperation<T,Operation2,MultiArrayContraction<T,ContractOperation,Range,MAOps...>,MAOps2...>
|
MultiArrayOperation<T,Operation2,MultiArrayContraction<T,ContractOperation,Range,MAOps...>,MAOps2...>
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace {
|
||||||
MultiArray2dAny max;
|
MultiArray2dAny max;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
TEST_F(OneDimTest, CorrectExtensions)
|
TEST_F(OneDimTest, CorrectExtensions)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(ma.size(), 5);
|
EXPECT_EQ(ma.size(), 5);
|
||||||
|
@ -510,7 +510,7 @@ namespace {
|
||||||
EXPECT_EQ(sl[j(j1 = 2, j2 = 0)], 14);
|
EXPECT_EQ(sl[j(j1 = 2, j2 = 0)], 14);
|
||||||
EXPECT_EQ(sl[j(j1 = 2, j2 = 1)], 34);
|
EXPECT_EQ(sl[j(j1 = 2, j2 = 1)], 34);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
TEST_F(ContractionTest, ContractionWorks)
|
TEST_F(ContractionTest, ContractionWorks)
|
||||||
{
|
{
|
||||||
MultiArray2dAny ma2(ra);
|
MultiArray2dAny ma2(ra);
|
||||||
|
@ -542,7 +542,7 @@ namespace {
|
||||||
auto i1 = i.template getIndex<0>();
|
auto i1 = i.template getIndex<0>();
|
||||||
auto i2 = i.template getIndex<1>();
|
auto i2 = i.template getIndex<1>();
|
||||||
|
|
||||||
EXPECT_EQ(ma2[i(i1 = 0, i2 = 0)], -275);
|
EXPECT_EQ(ma2[i(i1 = 0, i2 = 0)], -165);
|
||||||
EXPECT_EQ(ma2[i(i1 = 0, i2 = 1)], 324);
|
EXPECT_EQ(ma2[i(i1 = 0, i2 = 1)], 324);
|
||||||
|
|
||||||
EXPECT_EQ(ma2[i(i1 = 1, i2 = 0)], 130);
|
EXPECT_EQ(ma2[i(i1 = 1, i2 = 0)], 130);
|
||||||
|
|
Loading…
Reference in a new issue