#include "coucheTest.h"
void CoucheTest::setUp(){
 // construction du test
    Output = Couche(10);
    Input = Couche(5,&Output);
}

void CoucheTest::tearDown(){
 // destruction du test
 //   delete Output;
 //   delete Input;
}

void CoucheTest::testInit(){
 // verifie les assignations du constructeur de la classe
    CPPUNIT_ASSERT( Input.getNumber()==5 );
    CPPUNIT_ASSERT( Output.getNumber()==10 );
    CPPUNIT_ASSERT( Input.getNextCouche() == &Output );
    CPPUNIT_ASSERT( Output.getNextCouche() == NULL );
}

void CoucheTest::testGetSynapse(){
    Input.getSynapse(1,1);
}

void CoucheTest::testGetSynapseOverflow(){
    Input.getSynapse(5,10);
}

void CoucheTest::testGetSynapseUninitialized(){
    Output.getSynapse(1,1);
}

void CoucheTest::testNextCouche(){
 // verifie l assignation du pointeur vers le suivant
    CPPUNIT_ASSERT( Output.getNextCouche()==NULL );
    Output.setNextCouche(&Input);
    CPPUNIT_ASSERT( Output.getNextCouche() == &Input );
}

void CoucheTest::testOperator(){
 // verifie l'assignation d'un poid à un neurone
    CPPUNIT_ASSERT( Input[0].getWeight()==0.0 );
    Input[0] = 3.0;
    CPPUNIT_ASSERT( Input[0].getWeight()==3.0 );
    Input[0].setWeight(4.0);
    CPPUNIT_ASSERT( Input[0].getWeight()==4.0 );
}

void CoucheTest::testOperatorThrow(){
    Input[5];
}
