#include "neuroneTest.h"
void NeuroneTest::setUp(){
 // construction du test
    Neur1 = new Neurone();
    Neur2 = new Neurone(100.0,Neur1);
}

void NeuroneTest::tearDown(){
 // destruction du test
    delete Neur1;
    delete Neur2;
}

void NeuroneTest::testInit(){
 // verifie les assignations du constructeur de la classe
    CPPUNIT_ASSERT( Neur1->getWeight()==0.0 );
    CPPUNIT_ASSERT( Neur2->getWeight()==100.0 );
    CPPUNIT_ASSERT( Neur1->getNextNeurone()==NULL );
    CPPUNIT_ASSERT( Neur2->getNextNeurone()==Neur1 );
}

void NeuroneTest::testNextNeurone(){
 // verifie l assignation du pointeur vers le suivant
    CPPUNIT_ASSERT( Neur1->getNextNeurone()==NULL );
    Neur1->setNextNeurone(Neur2);
    CPPUNIT_ASSERT( Neur1->getNextNeurone()==Neur2 );
}

void NeuroneTest::testSetWeight(){
 // verifie l'assignation d'un poid à un neurone
    CPPUNIT_ASSERT( Neur1->getWeight()==0.0 );
    Neur1->setWeight(1.0);
    CPPUNIT_ASSERT( Neur1->getWeight()==1.0 );
}

void NeuroneTest::testActive(){
 // verifie l'activation d'un neurone
    CPPUNIT_ASSERT( Neur2->getWeight()==100.0 );
    CPPUNIT_ASSERT( Neur2->getState()==true );
}

void NeuroneTest::testOperotorAssign(){
    Neurone bla(3.0);
    bla = 3.0;
    CPPUNIT_ASSERT(bla.getWeight()==3);
}
