Newer
Older
/**
* DESCRIPTION OF THE CLASS
*
* @author David Vojtek
* @date 2018
*/
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
#include "../Neuron/NeuronLogistic.h"
/**
* Boost testing suite for testing NeuronLogistic.h
* doesn't test inherited methods
*/
BOOST_AUTO_TEST_SUITE(neuronLogistic_test)
/**
* Test of creating new instance of NeuronLogistic
*/
BOOST_AUTO_TEST_CASE(neuronLogistic_construction__test) {
NeuronLogistic neuron(1.745, 784.4547);
//Test of correct value of first activation function parameter
BOOST_CHECK_EQUAL(neuron.activation_function_get_parameter(0), 1.745);
//Test of correct value of second activation function parameter
BOOST_CHECK_EQUAL(neuron.activation_function_get_parameter(1), 784.4547);
}
/**
* Test of activate method
*/
BOOST_AUTO_TEST_CASE(neuronLogistic_activate__test) {
NeuronLogistic neuron(3.0, 2.0);
neuron.activate();
//Test of correct state after activate neuron
BOOST_CHECK_CLOSE(0.0016937944, neuron.get_state(), 0.00001);
/**
* Test of derivative methods
*/
BOOST_AUTO_TEST_CASE(neuronLogistic_derivative_test) {
//Test of correct output of activation_function_get_derivative method
BOOST_CHECK_CLOSE(0.0042850850699, neuron.activation_function_eval_derivative(), 0.00001);
//Tests of correct outputs of activation_function_get_partial_derivative method
BOOST_CHECK_CLOSE(-0.0068569236644, neuron.activation_function_eval_partial_derivative(0), 0.00001);
BOOST_CHECK_CLOSE(-0.0042850850699, neuron.activation_function_eval_partial_derivative(1), 0.00001);
BOOST_CHECK_EQUAL(0.0, neuron.activation_function_eval_partial_derivative(10000));