MyraMath


Source: tests/expression/Index.cpp

1 
2 // ========================================================================= //
3 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
4 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
5 // ========================================================================= //
6 
14 
15 // Reporting.
16 #include <tests/myratest.h>
17 
18 using namespace myra;
19 
20 ADD_TEST("Index","[expression]")
21  {
22  REQUIRE( make_Index(1,2,3)[0] == 1 );
23  REQUIRE( make_Index(1,2,3)[1] == 2 );
24  REQUIRE( make_Index(1,2,3)[2] == 3 );
25  REQUIRE( make_Index(1,2,3) != make_Index(4,5,6) );
26  REQUIRE( make_Index(1,2,3).first<2>() == make_Index(1,2) );
27  REQUIRE( make_Index(1,2,3).last<2>() == make_Index(2,3) );
28  int data[3];
29  data[0] = 4;
30  data[1] = 5;
31  data[2] = 6;
32  REQUIRE( Index<3>(data) == make_Index(4,5,6) );
33  }
34 
Implementation detail of Expression templates.
Definition: syntax.dox:1
Essentially a std::array<int,N>, provided for backwards compatibility.
Definition: Index.h:23


Results: [PASS]


Go back to Summary of /test programs.