@ -33,7 +33,6 @@ class ArrayTest: public TestSuite::Tester {
ArrayTest ( ) ;
void construct ( ) ;
void constexprConstruct ( ) ;
void equality ( ) ;
void access ( ) ;
} ;
@ -44,37 +43,31 @@ typedef Magnum::Array3D<int> Array3D;
ArrayTest : : ArrayTest ( ) {
addTests ( { & ArrayTest : : construct ,
& ArrayTest : : constexprConstruct ,
& ArrayTest : : equality ,
& ArrayTest : : access } ) ;
}
void ArrayTest : : construct ( ) {
CORRADE_COMPARE ( Array1D ( 5 ) , ( Array < 1 , int > ( 5 ) ) ) ;
CORRADE_COMPARE ( Array2D ( 5 , 3 ) , ( Array < 2 , int > ( 5 , 3 ) ) ) ;
CORRADE_COMPARE ( Array3D ( 5 , 3 , - 2 ) , ( Array < 3 , int > ( 5 , 3 , - 2 ) ) ) ;
/* Verify proper expansion */
CORRADE_COMPARE ( ( Array < 3 , int > ( 5 ) ) , ( Array < 3 , int > ( 5 , 5 , 5 ) ) ) ;
CORRADE_COMPARE ( Array2D ( 5 ) , ( Array < 2 , int > ( 5 , 5 ) ) ) ;
CORRADE_COMPARE ( Array3D ( 5 ) , ( Array < 3 , int > ( 5 , 5 , 5 ) ) ) ;
}
constexpr Array < 3 , Int > a = { 5 , 6 , 7 } ;
CORRADE_COMPARE ( a , ( Array < 3 , Int > ( 5 , 6 , 7 ) ) ) ;
constexpr Array < 3 , Int > a2 = 5 ;
CORRADE_COMPARE ( a2 , ( Array < 3 , Int > ( 5 , 5 , 5 ) ) ) ;
constexpr Array1D b = 5 ;
CORRADE_COMPARE ( b , ( Array < 1 , Int > ( 5 ) ) ) ;
constexpr Array2D c = { 5 , 3 } ;
CORRADE_COMPARE ( c , ( Array < 2 , Int > ( 5 , 3 ) ) ) ;
constexpr Array2D c2 = 5 ;
CORRADE_COMPARE ( c2 , ( Array < 2 , Int > ( 5 , 5 ) ) ) ;
constexpr Array3D d = { 5 , 3 , - 2 } ;
CORRADE_COMPARE ( d , ( Array < 3 , Int > ( 5 , 3 , - 2 ) ) ) ;
void ArrayTest : : constexprConstruct ( ) {
/* Verify that all full constructors can be called as constexpr */
constexpr Array1D a ( 5 ) ;
constexpr Array2D b ( 5 , 3 ) ;
constexpr Array2D b2 ( 5 ) ;
constexpr Array3D c ( 5 , 6 , 7 ) ;
constexpr Array3D c2 ( 5 ) ;
constexpr Array < 3 , int > d ( 5 , 6 , 7 ) ;
CORRADE_COMPARE ( a , Array1D ( 5 ) ) ;
CORRADE_COMPARE ( b , Array2D ( 5 , 3 ) ) ;
CORRADE_COMPARE ( b2 , Array2D ( 5 ) ) ;
CORRADE_COMPARE ( c , Array3D ( 5 , 6 , 7 ) ) ;
CORRADE_COMPARE ( c2 , Array3D ( 5 ) ) ;
CORRADE_COMPARE ( d , ( Array < 3 , int > ( 5 , 6 , 7 ) ) ) ;
constexpr Array3D d2 = 5 ;
CORRADE_COMPARE ( d2 , ( Array < 3 , Int > ( 5 , 5 , 5 ) ) ) ;
}
void ArrayTest : : equality ( ) {
@ -84,11 +77,18 @@ void ArrayTest::equality() {
void ArrayTest : : access ( ) {
Array1D a ( 50 ) ;
const Array1D ac ( 50 ) ;
constexpr Array1D ac ( 50 ) ;
Array2D b ( 5 , 3 ) ;
const Array2D bc ( 5 , 3 ) ;
constexpr Array2D bc ( 5 , 3 ) ;
Array3D c ( - 5 , 6 , 7 ) ;
const Array3D cc ( - 5 , 6 , 7 ) ;
constexpr Array3D cc ( - 5 , 6 , 7 ) ;
CORRADE_COMPARE ( a [ 0 ] , 50 ) ;
CORRADE_COMPARE ( ac [ 0 ] , 50 ) ;
CORRADE_COMPARE ( b [ 1 ] , 3 ) ;
CORRADE_COMPARE ( bc [ 1 ] , 3 ) ;
CORRADE_COMPARE ( c [ 2 ] , 7 ) ;
CORRADE_COMPARE ( cc [ 2 ] , 7 ) ;
CORRADE_COMPARE ( a . x ( ) , 50 ) ;
CORRADE_COMPARE ( ac . x ( ) , 50 ) ;