Skip to content

Commit

Permalink
Cover more test
Browse files Browse the repository at this point in the history
  • Loading branch information
sapk committed Oct 5, 2015
1 parent a4d1614 commit 723b518
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 69 deletions.
21 changes: 18 additions & 3 deletions test/SimulateurTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public void testCalculTauxErreurBinaire() throws Exception {
/**
* Test of main method, of class Simulateur.
*/

@Test
public void testMain() {
System.out.println("Test main");
Expand All @@ -58,38 +57,54 @@ public void testMain() {
}


/**
* Test of analyze of args of class Simulateur.
*/
@Test
public void testAnalyseArgumentsEmpty() throws ArgumentsException, Exception {
System.out.println("Test AnalyseArgumentsEmpty");
String[] args = {};
new Simulateur(args);
}

/**
* Test of analyze of args of class Simulateur.
*/
@Test(expected = ArgumentsException.class)
public void testAnalyseArgumentsnbEchInvalide() throws ArgumentsException, Exception {
System.out.println("Test AnalyseArgumentsEmpty");
String[] args = ("-nbEch").split(" ");
new Simulateur(args);
}

/**
* Test of analyze of args of class Simulateur.
*/
@Test(expected = ArgumentsException.class)
public void testAnalyseArgumentsAmplInvalide() throws ArgumentsException, Exception {
System.out.println("Test AnalyseArgumentsAmplInvalide");
String[] args = ("-ampl 3 1").split(" ");
new Simulateur(args);
}

/**
* Test of analyze of args of class Simulateur.
*/
@Test(expected = ArgumentsException.class)
public void testAnalyseArgumentsFormInvalide() throws ArgumentsException, Exception {
System.out.println("Test AnalyseArgumentsFormInvalide");
String[] args = ("-form NRTE").split(" ");
new Simulateur(args);
}


/**
* Test of analyze of args of class Simulateur.
*/
@Test(expected = ArgumentsException.class)
public void testAnalyseArgumentsForm2Invalide() throws ArgumentsException, Exception {
System.out.println("Test AnalyseArgumentsForm2Invalide");
String[] args = ("-form ").split(" ");
new Simulateur(args);
}
//TODO Check all other params

}
136 changes: 70 additions & 66 deletions test/transmetteurs/TransmetteurLogiqueParfaitTest.java
Original file line number Diff line number Diff line change
@@ -1,66 +1,70 @@
package transmetteurs;

import information.Information;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
*
* @author Antoine GIRARD
* @author Cédric HERZOG
*/
public class TransmetteurLogiqueParfaitTest {

public TransmetteurLogiqueParfaitTest() {
}

@BeforeClass
public static void setUpClass() {
}

@AfterClass
public static void tearDownClass() {
}

@Before
public void setUp() {
}

@After
public void tearDown() {
}

/**
* Test of recevoir method, of class TransmetteurLogiqueParfait.
*
* @throws java.lang.Exception
*/
@Test
public void testRecevoir() throws Exception {
System.out.println("Test recevoir");
Boolean bits[] = {true, false, true};
Information<Boolean> information = new Information<>(bits);
TransmetteurLogiqueParfait instance = new TransmetteurLogiqueParfait();
instance.recevoir(information);

assertEquals(instance.informationRecue, information);
//Comme recevoir lance emettre cette donction est aussi testé ici.
assertEquals(instance.informationEmise, information);
}

/**
* Test of emettre method, of class TransmetteurLogiqueParfait.
*/
@Test
public void testEmettre() throws Exception {
System.out.println("emettre");
TransmetteurLogiqueParfait instance = new TransmetteurLogiqueParfait();
instance.emettre();
assertEquals(instance.informationEmise, null);
}

}
package transmetteurs;

import destinations.DestinationFinale;
import information.Information;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
*
* @author Antoine GIRARD
* @author Cédric HERZOG
*/
public class TransmetteurLogiqueParfaitTest {

public TransmetteurLogiqueParfaitTest() {
}

@BeforeClass
public static void setUpClass() {
}

@AfterClass
public static void tearDownClass() {
}

@Before
public void setUp() {
}

@After
public void tearDown() {
}

/**
* Test of recevoir method, of class TransmetteurLogiqueParfait.
*
* @throws java.lang.Exception
*/
@Test
public void testRecevoir() throws Exception {
System.out.println("Test recevoir");
Boolean bits[] = {true, false, true};
Information<Boolean> information = new Information<>(bits);
TransmetteurLogiqueParfait instance = new TransmetteurLogiqueParfait();
DestinationFinale dest = new DestinationFinale();
instance.connecter(dest);
instance.recevoir(information);

assertEquals(instance.getInformationRecue(), information);
//Comme recevoir lance emettre cette donction est aussi testé ici.
assertEquals(instance.getInformationEmise(), information);
assertEquals(dest.getInformationRecue(), information);
}

/**
* Test of emettre method, of class TransmetteurLogiqueParfait.
*/
@Test
public void testEmettre() throws Exception {
System.out.println("emettre");
TransmetteurLogiqueParfait instance = new TransmetteurLogiqueParfait();
instance.emettre();
assertEquals(instance.informationEmise, null);
}

}

0 comments on commit 723b518

Please sign in to comment.