tests refactored according to new modificatios

This commit is contained in:
2014-10-02 20:54:52 +02:00
parent 169bd911fc
commit 0a901c7e4b
2 changed files with 8 additions and 10 deletions

View File

@@ -1,10 +1,9 @@
#include "../src/Network"
#include "../src/Problem"
#include "../src/NeuronNetwork/Network"
#include <iostream>
class X: public S::Problem
class X: public Shin::NeuronNetwork::Problem
{
protected:
std::vector<bool> representation() const
@@ -15,7 +14,7 @@ class X: public S::Problem
int main()
{
S::FeedForwardNetwork n(2,4,2);
Shin::NeuronNetwork::FeedForwardNetwork n(2,4,2);
if(n[1]->size() != 4)
{
std::cout << "ACtual size:" << n[0]->size();
@@ -23,7 +22,7 @@ int main()
}
n[2]->operator[](0)->setPotential(25);
std::cout << "Potential: " << n[2]->operator[](0)->getPotential() << "\n";
S::Solution s =n.solve(X());
Shin::NeuronNetwork::Solution s =n.solve(X());
if(s.size()!=2)
{
std::cout << "1";

View File

@@ -1,8 +1,7 @@
#include "../src/Network"
#include "../src/Problem"
#include "../src/NeuronNetwork/Network"
#include <iostream>
class X: public S::Problem
class X: public Shin::NeuronNetwork::Problem
{
public: X(bool x,bool y):x(x),y(y) {}
protected: std::vector<bool> representation() const { return std::vector<bool>({x,y}); }
@@ -15,7 +14,7 @@ int main()
{
srand(time(NULL));
int lm=5;
S::FeedForwardNetwork net(2,lm,1);
Shin::NeuronNetwork::FeedForwardNetwork net(2,lm,1);
bool x=1;
int prev_err=0;
int err=0;
@@ -52,7 +51,7 @@ int main()
{
bool x= rand()%2;
bool y=rand()%2;
S::Solution s =net.solve(X(x,y));
Shin::NeuronNetwork::Solution s =net.solve(X(x,y));
if(s[0]!= (x xor y))
err++;
}