Line data Source code
1 : /*
2 : * File: TestFunctionOntologyRegistry.cpp
3 : * Author: chung
4 : *
5 : * Created on Nov 2, 2015, 12:21:37 AM
6 : */
7 :
8 : #include "TestFunctionOntologyRegistry.h"
9 : #include "FunctionOntologyRegistry.h"
10 :
11 :
12 1 : CPPUNIT_TEST_SUITE_REGISTRATION(TestFunctionOntologyRegistry);
13 :
14 7 : TestFunctionOntologyRegistry::TestFunctionOntologyRegistry() {
15 7 : }
16 :
17 14 : TestFunctionOntologyRegistry::~TestFunctionOntologyRegistry() {
18 14 : }
19 :
20 7 : void TestFunctionOntologyRegistry::setUp() {
21 7 : }
22 :
23 7 : void TestFunctionOntologyRegistry::tearDown() {
24 7 : }
25 :
26 1 : void TestFunctionOntologyRegistry::testDistance() {
27 1 : FunctionOntologicalClass distance = FunctionOntologyRegistry::distance();
28 1 : _ASSERT(distance.defines_f());
29 1 : _ASSERT_NOT(distance.defines_conjugate());
30 1 : _ASSERT_EQ(string("Distance"), distance.getName());
31 :
32 1 : }
33 :
34 1 : void TestFunctionOntologyRegistry::testFunction() {
35 1 : FunctionOntologicalClass function = FunctionOntologyRegistry::function();
36 1 : _ASSERT_NOT(function.defines_f());
37 1 : _ASSERT_NOT(function.defines_grad());
38 1 : _ASSERT_NOT(function.defines_prox());
39 1 : _ASSERT_NOT(function.defines_conjugate());
40 1 : _ASSERT_EQ(string("Function"), function.getName());
41 1 : }
42 :
43 1 : void TestFunctionOntologyRegistry::testIndicator() {
44 1 : FunctionOntologicalClass indicator = FunctionOntologyRegistry::indicator();
45 1 : _ASSERT(indicator.defines_f());
46 1 : _ASSERT(indicator.defines_prox());
47 1 : _ASSERT_NOT(indicator.defines_conjugate());
48 1 : _ASSERT_NOT(indicator.defines_conjugate_grad());
49 1 : _ASSERT_NOT(indicator.defines_grad());
50 1 : _ASSERT_EQ(string("Indicator"), indicator.getName());
51 1 : }
52 :
53 1 : void TestFunctionOntologyRegistry::testLoss() {
54 1 : FunctionOntologicalClass loss = FunctionOntologyRegistry::loss();
55 1 : _ASSERT(loss.defines_f());
56 1 : _ASSERT_NOT(loss.defines_conjugate());
57 1 : _ASSERT_EQ(string("LossFunction"), loss.getName());
58 1 : }
59 :
60 1 : void TestFunctionOntologyRegistry::testNameSpace() {
61 1 : string result = FunctionOntologyRegistry::nameSpace();
62 1 : _ASSERT_EQ(string("fb"), result);
63 1 : }
64 :
65 1 : void TestFunctionOntologyRegistry::testNorm() {
66 1 : FunctionOntologicalClass norm = FunctionOntologyRegistry::norm();
67 1 : _ASSERT(norm.defines_f());
68 1 : _ASSERT(norm.defines_conjugate());
69 1 : _ASSERT(norm.defines_prox());
70 1 : _ASSERT_EQ(string("Norm"), norm.getName());
71 1 : }
72 :
73 1 : void TestFunctionOntologyRegistry::testQuadratic() {
74 1 : FunctionOntologicalClass quadratic = FunctionOntologyRegistry::quadratic();
75 1 : _ASSERT(quadratic.defines_f());
76 1 : _ASSERT(quadratic.defines_grad());
77 1 : _ASSERT(quadratic.defines_conjugate());
78 1 : _ASSERT(quadratic.defines_conjugate_grad());
79 1 : _ASSERT_EQ(string("Quadratic"), quadratic.getName());
80 4 : }
81 :
|