Line data Source code
1 : /*
2 : * File: TestFBProblem.cpp
3 : * Author: Pantelis Sopasakis
4 : *
5 : * Created on Apr 17, 2016, 12:25:58 PM
6 : *
7 : * ForBES is free software: you can redistribute it and/or modify
8 : * it under the terms of the GNU Lesser General Public License as published by
9 : * the Free Software Foundation, either version 3 of the License, or
10 : * (at your option) any later version.
11 : *
12 : * ForBES is distributed in the hope that it will be useful,
13 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : * GNU Lesser General Public License for more details.
16 : *
17 : * You should have received a copy of the GNU Lesser General Public License
18 : * along with ForBES. If not, see <http://www.gnu.org/licenses/>.
19 : */
20 :
21 : #include "TestFBProblem.h"
22 : #include "Function.h"
23 : #include "Quadratic.h"
24 : #include "Norm1.h"
25 : #include "MatrixOperator.h"
26 : #include "FBProblem.h"
27 : #include "ForBES.h"
28 :
29 :
30 1 : CPPUNIT_TEST_SUITE_REGISTRATION(TestFBProblem);
31 :
32 1 : TestFBProblem::TestFBProblem() {
33 1 : }
34 :
35 2 : TestFBProblem::~TestFBProblem() {
36 2 : }
37 :
38 1 : void TestFBProblem::setUp() {
39 1 : }
40 :
41 1 : void TestFBProblem::tearDown() {
42 1 : }
43 :
44 1 : void TestFBProblem::testConstruct() {
45 1 : const size_t n = 10;
46 1 : Function * f = new Quadratic();
47 1 : Function * g = new Norm1();
48 1 : Matrix A = MatrixFactory::MakeRandomMatrix(n, n, 0.0, 1.0);
49 1 : LinearOperator * L = new MatrixOperator(A);
50 :
51 1 : FBProblem * prob = new FBProblem(*f, *L, *g);
52 :
53 1 : _ASSERT(L == prob->L1());
54 1 : _ASSERT(NULL == prob->L2());
55 1 : _ASSERT(NULL == prob->d2());
56 1 : _ASSERT(NULL == prob->d1());
57 1 : _ASSERT(NULL == prob->lin());
58 1 : _ASSERT(f == prob->f1());
59 1 : _ASSERT(NULL == prob->f2());
60 1 : _ASSERT(g == prob->g());
61 :
62 1 : delete prob;
63 1 : delete L;
64 1 : delete f;
65 1 : delete g;
66 4 : }
67 :
68 :
|