fix compile errors and seg fault from last commit -> unit tests work again
This commit is contained in:
parent
f7549a230b
commit
ca55bd0702
3 changed files with 13 additions and 13 deletions
|
@ -68,7 +68,7 @@ namespace MultiArrayHelper
|
||||||
class DExtT
|
class DExtT
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
DExt mDExt;
|
DExt mDExt = nullptr;
|
||||||
public:
|
public:
|
||||||
DExtT() = default;
|
DExtT() = default;
|
||||||
DExtT(const DExtT& in) = default;
|
DExtT(const DExtT& in) = default;
|
||||||
|
@ -81,9 +81,9 @@ namespace MultiArrayHelper
|
||||||
inline const DExt& get() const { return mDExt; }
|
inline const DExt& get() const { return mDExt; }
|
||||||
|
|
||||||
inline DExtT operator+(const DExtT& in) const
|
inline DExtT operator+(const DExtT& in) const
|
||||||
{ return DExtT( (*mDExt) + (*in.mDExt) ) ; }
|
{ if (not mDExt) return in; else return DExtT( (*mDExt) + (*in.mDExt) ) ; }
|
||||||
inline DExtT operator*(size_t in) const
|
inline DExtT operator*(size_t in) const
|
||||||
{ return DExtT( (*mDExt) * in ) ; }
|
{ if (not mDExt) return *this; else return DExtT( (*mDExt) * in ) ; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace {
|
||||||
|
|
||||||
using namespace MAT;
|
using namespace MAT;
|
||||||
|
|
||||||
typedef Expressions1 EC1;
|
//typedef Expressions1 EC1;
|
||||||
|
|
||||||
template <class Factory, typename T>
|
template <class Factory, typename T>
|
||||||
void swapFactory(std::shared_ptr<RangeFactoryBase>& fptr, std::initializer_list<T> ilist)
|
void swapFactory(std::shared_ptr<RangeFactoryBase>& fptr, std::initializer_list<T> ilist)
|
||||||
|
@ -126,15 +126,15 @@ namespace {
|
||||||
|
|
||||||
TEST_F(AnonymousTest, DCast1)
|
TEST_F(AnonymousTest, DCast1)
|
||||||
{
|
{
|
||||||
DynamicRangeFactory<EC1> arf1(sr1ptr,m3rptr);
|
DynamicRangeFactory arf1(sr1ptr,m3rptr);
|
||||||
auto ar1a = std::dynamic_pointer_cast<DynamicRange<EC1>>( arf1.create() );
|
auto ar1a = std::dynamic_pointer_cast<DynamicRange>( arf1.create() );
|
||||||
|
|
||||||
arf1.append(sr2ptr);
|
arf1.append(sr2ptr);
|
||||||
|
|
||||||
auto ar1b = std::dynamic_pointer_cast<DynamicRange<EC1>>( arf1.create() );
|
auto ar1b = std::dynamic_pointer_cast<DynamicRange>( arf1.create() );
|
||||||
|
|
||||||
DynamicRangeFactory<EC1> arf2(sr1ptr,m3rptr,sr2ptr);
|
DynamicRangeFactory arf2(sr1ptr,m3rptr,sr2ptr);
|
||||||
auto ar2 = std::dynamic_pointer_cast<DynamicRange<EC1>>( arf2.create() );
|
auto ar2 = std::dynamic_pointer_cast<DynamicRange>( arf2.create() );
|
||||||
|
|
||||||
EXPECT_EQ(ar1b.get(), ar2.get());
|
EXPECT_EQ(ar1b.get(), ar2.get());
|
||||||
EXPECT_EQ(ar1a->size(), sr1ptr->size() * m3rptr->size());
|
EXPECT_EQ(ar1a->size(), sr1ptr->size() * m3rptr->size());
|
||||||
|
@ -150,9 +150,9 @@ namespace {
|
||||||
|
|
||||||
TEST_F(AnonymousTest, DCast2)
|
TEST_F(AnonymousTest, DCast2)
|
||||||
{
|
{
|
||||||
DynamicRangeFactory<EC1> arf2(sr1ptr,m3rptr,sr2ptr);
|
DynamicRangeFactory arf2(sr1ptr,m3rptr,sr2ptr);
|
||||||
auto ar = std::dynamic_pointer_cast<DynamicRange<EC1>>( arf2.create() );
|
auto ar = std::dynamic_pointer_cast<DynamicRange>( arf2.create() );
|
||||||
auto mr = ar->template scast<SRange,DynamicRange<EC1>>(1,2);
|
auto mr = ar->template scast<SRange,DynamicRange>(1,2);
|
||||||
|
|
||||||
EXPECT_EQ(mr->template getPtr<0>()->size(), sr1ptr->size());
|
EXPECT_EQ(mr->template getPtr<0>()->size(), sr1ptr->size());
|
||||||
EXPECT_EQ(mr->template getPtr<1>()->size(), m3rptr->size() * sr2ptr->size());
|
EXPECT_EQ(mr->template getPtr<1>()->size(), m3rptr->size() * sr2ptr->size());
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace {
|
||||||
class DynIndexTest : public ::testing::Test
|
class DynIndexTest : public ::testing::Test
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef DynamicRangeFactory<Expressions1> DRF;
|
typedef DynamicRangeFactory DRF;
|
||||||
typedef DRF::oType DR;
|
typedef DRF::oType DR;
|
||||||
|
|
||||||
typedef SingleRangeFactory<char,SpaceType::ANY> SRF;
|
typedef SingleRangeFactory<char,SpaceType::ANY> SRF;
|
||||||
|
|
Loading…
Reference in a new issue