v0.14.0
Functions
test_T2_iostream.cpp File Reference
#include "../../../src/FTensor.hpp"
#include "../test_for_zero.hpp"
#include "../test_ostream.hpp"

Go to the source code of this file.

Functions

void test_T2_iostream ()
 

Function Documentation

◆ test_T2_iostream()

void test_T2_iostream ( )

Definition at line 7 of file test_T2_iostream.cpp.

8 {
10  Tensor2<double, 3, 3>(3., 7., 11., 13., 17., 23., 27., 31., 37.),
11  "[[3,7,11],[13,17,23],[27,31,37]]", "operator<<(T2<3,3>)");
12  test_ostream(Tensor2<double, 1, 2>(13., 17.), "[[13,17]]",
13  "operator<<(T2<1,2>)");
14  test_ostream(Tensor2<double, 2, 1>(13., 17.), "[[13],[17]]",
15  "operator<<(T2<2,1>)");
16 
18  std::stringstream ss("[[3,7,11],[13,17,23],[27,31,37]]");
19  ss >> t2_1;
20  test_for_zero(t2_1(0, 0) - 3, "operator>>(T2)(0,0)");
21  test_for_zero(t2_1(0, 1) - 7, "operator>>(T2)(0,1)");
22  test_for_zero(t2_1(0, 2) - 11, "operator>>(T2)(0,2)");
23  test_for_zero(t2_1(1, 0) - 13, "operator>>(T2)(1,0)");
24  test_for_zero(t2_1(1, 1) - 17, "operator>>(T2)(1,1)");
25  test_for_zero(t2_1(1, 2) - 23, "operator>>(T2)(1,2)");
26  test_for_zero(t2_1(2, 0) - 27, "operator>>(T2)(2,0)");
27  test_for_zero(t2_1(2, 1) - 31, "operator>>(T2)(2,1)");
28  test_for_zero(t2_1(2, 2) - 37, "operator>>(T2)(2,2)");
29 }
test_ostream
void test_ostream(const T &t, const std::string &expected, const std::string &test_name)
Definition: test_ostream.hpp:7
FTensor::Tensor2< double, 3, 3 >
test_for_zero
void test_for_zero(const T &t, const std::string &s)
Definition: test_for_zero.hpp:7