ulong
This commit is contained in:
parent
091c6d811e
commit
8e297d85d8
3 changed files with 31 additions and 31 deletions
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
project(multi_array)
|
project(multi_array)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -std=c++11 --pedantic -O3")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -std=c++11 -Wpedantic -O3")
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,8 @@ namespace {
|
||||||
TEST_F(IndexTest, SingleIndex_SimpleCall)
|
TEST_F(IndexTest, SingleIndex_SimpleCall)
|
||||||
{
|
{
|
||||||
auto si = sr1ptr->begin();
|
auto si = sr1ptr->begin();
|
||||||
EXPECT_EQ(si.max(), 3);
|
EXPECT_EQ(si.max(), 3u);
|
||||||
EXPECT_EQ(si.pos(), 0);
|
EXPECT_EQ(si.pos(), 0u);
|
||||||
EXPECT_EQ(si.first(), true);
|
EXPECT_EQ(si.first(), true);
|
||||||
EXPECT_EQ(si.last(), false);
|
EXPECT_EQ(si.last(), false);
|
||||||
EXPECT_EQ(si.meta(), 'e');
|
EXPECT_EQ(si.meta(), 'e');
|
||||||
|
@ -115,8 +115,8 @@ namespace {
|
||||||
TEST_F(IndexTest, MultiIndex_SimpleCall)
|
TEST_F(IndexTest, MultiIndex_SimpleCall)
|
||||||
{
|
{
|
||||||
auto mi = m3rptr->begin();
|
auto mi = m3rptr->begin();
|
||||||
EXPECT_EQ(mi.max(), 4);
|
EXPECT_EQ(mi.max(), 4u);
|
||||||
EXPECT_EQ(mi.pos(), 0);
|
EXPECT_EQ(mi.pos(), 0u);
|
||||||
EXPECT_EQ(mi.first(), true);
|
EXPECT_EQ(mi.first(), true);
|
||||||
EXPECT_EQ(mi.last(), false);
|
EXPECT_EQ(mi.last(), false);
|
||||||
EXPECT_EQ(mi.meta() == mkt('a','1','0'), true);
|
EXPECT_EQ(mi.meta() == mkt('a','1','0'), true);
|
||||||
|
@ -143,13 +143,13 @@ namespace {
|
||||||
|
|
||||||
TEST_F(IndexTest, MasterRange_Check)
|
TEST_F(IndexTest, MasterRange_Check)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(mstrptr->size(), 48);
|
EXPECT_EQ(mstrptr->size(), 48u);
|
||||||
EXPECT_EQ(mstrptr->template get<0>().size(), 3);
|
EXPECT_EQ(mstrptr->template get<0>().size(), 3u);
|
||||||
EXPECT_EQ(mstrptr->template get<1>().size(), 4);
|
EXPECT_EQ(mstrptr->template get<1>().size(), 4u);
|
||||||
EXPECT_EQ(mstrptr->template get<2>().size(), 4);
|
EXPECT_EQ(mstrptr->template get<2>().size(), 4u);
|
||||||
EXPECT_EQ(mstrptr->dim(), 3);
|
EXPECT_EQ(mstrptr->dim(), 3);
|
||||||
EXPECT_EQ(mstrptr->template get<0>().dim(), 1);
|
EXPECT_EQ(mstrptr->template get<0>().dim(), 1u);
|
||||||
EXPECT_EQ(mstrptr->template get<1>().dim(), 3);
|
EXPECT_EQ(mstrptr->template get<1>().dim(), 3u);
|
||||||
|
|
||||||
auto mi = mstrptr->begin();
|
auto mi = mstrptr->begin();
|
||||||
EXPECT_EQ(mi.meta() == mkt( 'e' , mkt('a', '1', '0') , 'x' ), true);
|
EXPECT_EQ(mi.meta() == mkt( 'e' , mkt('a', '1', '0') , 'x' ), true);
|
||||||
|
@ -176,30 +176,30 @@ namespace {
|
||||||
|
|
||||||
TEST_F(IndexTest, ContainerRange_Check)
|
TEST_F(IndexTest, ContainerRange_Check)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(cr1ptr->size(), 16);
|
EXPECT_EQ(cr1ptr->size(), 16u);
|
||||||
EXPECT_EQ(cr2ptr->size(), 12);
|
EXPECT_EQ(cr2ptr->size(), 12u);
|
||||||
|
|
||||||
auto mi = mstrptr->begin();
|
auto mi = mstrptr->begin();
|
||||||
auto ci1 = cr1ptr->begin();
|
auto ci1 = cr1ptr->begin();
|
||||||
auto ci2 = cr2ptr->begin();
|
auto ci2 = cr2ptr->begin();
|
||||||
|
|
||||||
EXPECT_EQ(ci1.max(), 16);
|
EXPECT_EQ(ci1.max(), 16u);
|
||||||
EXPECT_EQ(ci2.max(), 12);
|
EXPECT_EQ(ci2.max(), 12u);
|
||||||
|
|
||||||
ci1(mi.template getPtr<1>(), mi.template getPtr<2>());
|
ci1(mi.template getPtr<1>(), mi.template getPtr<2>());
|
||||||
ci2(mi.template getPtr<1>(), mi.template getPtr<0>());
|
ci2(mi.template getPtr<1>(), mi.template getPtr<0>());
|
||||||
|
|
||||||
EXPECT_EQ(ci1.pos(), 0);
|
EXPECT_EQ(ci1.pos(), 0u);
|
||||||
EXPECT_EQ(ci2.pos(), 0);
|
EXPECT_EQ(ci2.pos(), 0u);
|
||||||
++mi;
|
++mi;
|
||||||
EXPECT_EQ(ci1().pos(), 1);
|
EXPECT_EQ(ci1().pos(), 1u);
|
||||||
EXPECT_EQ(ci2().pos(), 0);
|
EXPECT_EQ(ci2().pos(), 0u);
|
||||||
mi.template up<1>();
|
mi.template up<1>();
|
||||||
EXPECT_EQ(ci1().pos(), 5);
|
EXPECT_EQ(ci1().pos(), 5u);
|
||||||
EXPECT_EQ(ci2().pos(), 3);
|
EXPECT_EQ(ci2().pos(), 3u);
|
||||||
mi.template up<0>();
|
mi.template up<0>();
|
||||||
EXPECT_EQ(ci1().pos(), 5);
|
EXPECT_EQ(ci1().pos(), 5u);
|
||||||
EXPECT_EQ(ci2().pos(), 4);
|
EXPECT_EQ(ci2().pos(), 4u);
|
||||||
mi = mi.max()-1;
|
mi = mi.max()-1;
|
||||||
EXPECT_EQ(ci1().pos(), ci1.max()-1);
|
EXPECT_EQ(ci1().pos(), ci1.max()-1);
|
||||||
EXPECT_EQ(ci2().pos(), ci2.max()-1);
|
EXPECT_EQ(ci2().pos(), ci2.max()-1);
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace {
|
||||||
TEST_F(MATest_1Dim, SimpleCall)
|
TEST_F(MATest_1Dim, SimpleCall)
|
||||||
{
|
{
|
||||||
MultiArray<double,MATest_1Dim::SRange> ma(srptr, vv);
|
MultiArray<double,MATest_1Dim::SRange> ma(srptr, vv);
|
||||||
EXPECT_EQ( ma.size(), 5);
|
EXPECT_EQ( ma.size(), 5u);
|
||||||
EXPECT_EQ( ma.isConst(), false);
|
EXPECT_EQ( ma.isConst(), false);
|
||||||
EXPECT_EQ( ma.isSlice(), false);
|
EXPECT_EQ( ma.isSlice(), false);
|
||||||
|
|
||||||
|
@ -121,16 +121,16 @@ namespace {
|
||||||
|
|
||||||
if(cnt == 0){
|
if(cnt == 0){
|
||||||
EXPECT_EQ(el, 0.693);
|
EXPECT_EQ(el, 0.693);
|
||||||
} else if(cnt == 1){
|
} else if(cnt == 1u){
|
||||||
EXPECT_EQ(el, 2.718);
|
EXPECT_EQ(el, 2.718);
|
||||||
} else if(cnt == 2){
|
} else if(cnt == 2u){
|
||||||
EXPECT_EQ(el, 3.141);
|
EXPECT_EQ(el, 3.141);
|
||||||
} else if(cnt == 3){
|
} else if(cnt == 3u){
|
||||||
EXPECT_EQ(el, 1.618);
|
EXPECT_EQ(el, 1.618);
|
||||||
} else if(cnt == 4){
|
} else if(cnt == 4u){
|
||||||
EXPECT_EQ(el, 9.98);
|
EXPECT_EQ(el, 9.98);
|
||||||
} else {
|
} else {
|
||||||
EXPECT_EQ(cnt, 0);
|
EXPECT_EQ(cnt, 0u);
|
||||||
}
|
}
|
||||||
++cnt;
|
++cnt;
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,8 @@ namespace {
|
||||||
TEST_F(MATest_MDim, SimpleCall)
|
TEST_F(MATest_MDim, SimpleCall)
|
||||||
{
|
{
|
||||||
MultiArray<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
|
MultiArray<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
|
||||||
EXPECT_EQ( ma.size(), 24 );
|
EXPECT_EQ( ma.size(), 24u );
|
||||||
EXPECT_EQ( ma.range()->dim(), 2 );
|
EXPECT_EQ( ma.range()->dim(), 2u );
|
||||||
|
|
||||||
auto i = ma.beginIndex();
|
auto i = ma.beginIndex();
|
||||||
EXPECT_EQ( ma[ i.at( mkt( mkt('x', 'a'), '1' ) ) ], 2.917);
|
EXPECT_EQ( ma[ i.at( mkt( mkt('x', 'a'), '1' ) ) ], 2.917);
|
||||||
|
|
Loading…
Reference in a new issue