Newer
Older
/**
* DESCRIPTION OF THE CLASS
*
* @author David Vojtek
* @date 2018
*/
kra568
committed
#define BOOST_TEST_MODULE ConnectionWeightIdentity_test
#ifdef _WINDOWS
#include <boost/test/included/unit_test.hpp>
kra568
committed
#else
#ifndef BOOST_TEST_DYN_LINK
#define BOOST_TEST_DYN_LINK
#endif
#ifndef BOOST_TEST_NO_MAIN
#define BOOST_TEST_NO_MAIN
#endif
#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp>
kra568
committed
#endif
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "../NetConnection/ConnectionFunctionIdentity.h"
/**
* Boost testing suite for testing ConnectionWeightIdentity.h
*/
BOOST_AUTO_TEST_SUITE(ConnectionWeightIdentity_test)
/**
* Test of correct construction of ConnectionFunctionIdentity
*/
BOOST_AUTO_TEST_CASE(ConnectionWeightIdentity_construction_test) {
std::vector<double> weight_array = {1, 2, 3, 4, 5};
//Test of none exception when creation new instance of ConnectionFunctionIdentity
BOOST_CHECK_NO_THROW(ConnectionFunctionIdentity *CFI = new ConnectionFunctionIdentity() );
BOOST_CHECK_NO_THROW(ConnectionFunctionIdentity *CFI = new ConnectionFunctionIdentity(2) );
}
/**
* Test of eval method
*/
BOOST_AUTO_TEST_CASE(ConnectionWeightIdentity_eval_test) {
ConnectionFunctionIdentity *CFI1 = new ConnectionFunctionIdentity();
ConnectionFunctionIdentity *CFI2 = new ConnectionFunctionIdentity(0);
ConnectionFunctionIdentity *CFI3 = new ConnectionFunctionIdentity(2);
std::vector<double> parameter_space;
parameter_space.push_back(5);
//Test of correct output of eval method
BOOST_CHECK_EQUAL(1, CFI1->eval(parameter_space));
BOOST_CHECK_EQUAL(5, CFI2->eval(parameter_space));
BOOST_CHECK_THROW(CFI3->eval(parameter_space), std::out_of_range);
}
BOOST_AUTO_TEST_SUITE_END()