Ticket #4410: test_ticket4410.cpp

File test_ticket4410.cpp, 799 bytes (added by Marco Guazzone <marco.guazzone@…>, 12 years ago)

Test case: test copy-construction/-assignement of a sparse (symmetric) matrix. The test fails to compile if the patch is not applied.

Line 
1#include <boost/numeric/ublas/io.hpp>
2#include <boost/numeric/ublas/symmetric.hpp>
3#include <complex>
4
5namespace ublas = boost::numeric::ublas;
6
7int main()
8{
9 typedef double in_value_type;
10 typedef std::complex<double> out_value_type;
11
12 const std::size_t n = 4;
13
14 // Input Matrix
15 ublas::symmetric_matrix<in_value_type,ublas::lower> IN(n,n);
16
17 // Test copy-constructor: fails to compile without patch 4410
18 ublas::symmetric_matrix<out_value_type,ublas::lower> OUT1(IN);
19
20 // Test copy-assignement: fails to compile without patch 4410
21 ublas::symmetric_matrix<out_value_type,ublas::lower> OUT2;
22 OUT2 = IN;
23
24 std::cout << "Input Matrix: " << IN << std::endl;
25 std::cout << "Copy-Constructed Output Matrix: " << OUT1 << std::endl;
26 std::cout << "Copy-Assigned Output Matrix: " << OUT2 << std::endl;
27}