From 6a5c8be824070657c95c895a0d6b06c441dd4b3f Mon Sep 17 00:00:00 2001
From: Martin Beseda <martinbeseda@seznam.cz>
Date: Wed, 11 Jul 2018 16:52:05 +0200
Subject: [PATCH] FIX: Fixed run_tests.sh

---
 run_tests.sh                    | 42 ++-------------------------------
 src/Neuron/Neuron.cpp           |  2 ++
 src/tests/NeuronLinear_test.cpp |  2 +-
 src/tests/neuron_test.cpp       |  2 +-
 4 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index 85a76fe2..1456826e 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -1,43 +1,5 @@
 #!/bin/bash
 
-. compilers.env
-
-export FSFLAG='-cpp -I'
-
-echo "#------------------#----------------------------------------------------------------------------------"
-echo "# FUnit testing... #"
-echo "#------------------#"
-FUNIT_SCRIPTS=connection_m
-cd src;
-for F in ${FUNIT_SCRIPTS}; do
-
-    TEST_STATUS=0;
-    funit ${F} || TEST_STATUS=1;
-
-    if [[ TEST_STATUS -gt 0 ]]; then
-        echo "ERROR: Unit test failed!"
-        exit -1;
-    fi
-done
-
-echo "#---------------------#-------------------------------------------------------------------------------"
-echo "# Memcheck testing... #"
-echo "#---------------------#"
-MEM_TEST_SCRIPTS=connection_m_mem_leak_test.out net_m_mem_leak_test.out
-
-cd ../build;
-
-for F in ${MEM_TEST_SCRIPTS}; do
-    echo "Running ${F}..."
-    TEST1_MEM_STATUS=`valgrind --leak-check=yes build/${F} 2>&1 | grep 'LEAK SUMMARY' | wc -l`
-
-    if [[ TEST1_MEM_STATUS -gt 0 ]]; then
-        echo "ERROR: Memory leaks detected in ${F}!"
-        exit -1
-    fi
-    echo "${F} OK"
+for f in build/bin/*_test; do
+    ${f}
 done
-
-echo "#---------------------------#"
-echo "# No memory leaks detected. #"
-echo "#---------------------------#"
diff --git a/src/Neuron/Neuron.cpp b/src/Neuron/Neuron.cpp
index 5f3bad2d..dc2aeea0 100644
--- a/src/Neuron/Neuron.cpp
+++ b/src/Neuron/Neuron.cpp
@@ -1,6 +1,8 @@
 
 #include "Neuron.h"
 
+//TODO write INIT method to allocate edges_in and edges_out, so
+// it doesn't have to be written in every inherited class
 Neuron::~Neuron() {
     if(this->activation_function_parameters){
         delete [] this->activation_function_parameters;
diff --git a/src/tests/NeuronLinear_test.cpp b/src/tests/NeuronLinear_test.cpp
index af9274c1..0fae8477 100644
--- a/src/tests/NeuronLinear_test.cpp
+++ b/src/tests/NeuronLinear_test.cpp
@@ -18,7 +18,7 @@ BOOST_AUTO_TEST_SUITE(neuronLinear_test)
         NeuronLinear neuron(1.745, 784.4547);
 
         BOOST_CHECK_EQUAL(neuron.activation_function_get_parameter(0), 1.745);
-        BOOST_CHECK_EQUAL(neuron.activation_function_get_parameter(0), 784.4547);
+        BOOST_CHECK_EQUAL(neuron.activation_function_get_parameter(1), 784.4547);
 
 
     };
diff --git a/src/tests/neuron_test.cpp b/src/tests/neuron_test.cpp
index 1453d57d..a28776a0 100644
--- a/src/tests/neuron_test.cpp
+++ b/src/tests/neuron_test.cpp
@@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(neuron_saturation_test) {
 /**
  * Test of potencial methods
  */
-BOOST_AUTO_TEST_CASE(neuron_potencial_test) {
+BOOST_AUTO_TEST_CASE(neuron_potential_test) {
         NeuronLinear neuron(0, 0);
 
         BOOST_CHECK_EQUAL(neuron.get_potential(), 0);
-- 
GitLab