EvaluateRank0TestHelpers.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
9 
10 namespace TestHelpers::TensorExpressions {
11 
12 /// \ingroup TestingFrameworkGroup
13 /// \brief Test that evaluating a right hand side tensor expression containing a
14 /// single rank 0 tensor correctly assigns the data to the evaluated left hand
15 /// side tensor
16 ///
17 /// \param data the data being stored in the Tensors
18 template <typename DataType>
19 void test_evaluate_rank_0(const DataType& data) noexcept {
20  const Tensor<DataType> R{{{data}}};
21 
22  // Use explicit type (vs auto) so the compiler checks the return type of
23  // `evaluate`
24  const Tensor<DataType> L = ::TensorExpressions::evaluate(R());
25 
26  CHECK(L.get() == data);
27 }
28 
29 } // namespace TestHelpers::TensorExpressions
TensorExpression.hpp
TensorExpressions::evaluate
auto evaluate(const T &rhs_te)
Evaluate a RHS tensor expression to a tensor with the LHS index order set in the template parameters.
Definition: Evaluate.hpp:93
Tensor.hpp
TestHelpers::TensorExpressions::test_evaluate_rank_0
void test_evaluate_rank_0(const DataType &data) noexcept
Test that evaluating a right hand side tensor expression containing a single rank 0 tensor correctly ...
Definition: EvaluateRank0TestHelpers.hpp:19
Evaluate.hpp