ReadMe, Explication stratégies et tests

This commit is contained in:
Rochas
2025-12-20 12:47:18 +01:00
parent 4e0090e027
commit 6948c79dcb
6 changed files with 160 additions and 73 deletions

View File

@@ -10,8 +10,6 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
import impl.Afficheur;
import impl.Canal;
import impl.CapteurImpl;
@@ -24,6 +22,18 @@ public class TestAlgoDiffusionEpoq {
public static List<Integer>[] rEpoq;
private static void display(List<Integer>[] res){
for(int i = 0; i< NB_CANAUX; i++){
System.out.println("canal " + i + ":");
for(int j = 0; j< res[i].size(); j++){
System.out.print(res[i].get(j));
if(j<res[i].size()-1) System.out.print(", ");
}
System.out.println(" ");
}
}
@BeforeAll
public static void testAtom() throws InterruptedException{
@@ -47,10 +57,6 @@ public class TestAlgoDiffusionEpoq {
DiffusionEpoque algo = new DiffusionEpoque(c);
c.setAlgoDiffusion(algo);
//algo.configure();
ScheduledExecutorService clock = scheduler.getScheculer();
ScheduledFuture<?> future = clock.scheduleAtFixedRate(() -> c.tick(), 0, 500, TimeUnit.MILLISECONDS);
@@ -62,31 +68,26 @@ public class TestAlgoDiffusionEpoq {
Thread.sleep(3100); //3000ms max + 100ms de marge
clock.shutdown();
//Thread.sleep(1500);
for(int i = 0; i<NB_CANAUX; i++){
r[i] = a[i].vals;
}
rEpoq = r;
display(rEpoq);
}
@Test
void testAtomOracle(){
void testGoodOrder(){
boolean r = true;
for(int i = 0; i< NB_CANAUX && r; i++){
int valTest = 0;
System.out.println("canal " + i + ":");
int test = 0;
for(int j = 0; j< rEpoq[i].size() && r; j++){
System.out.print(rEpoq[i].get(j));
if(j<rEpoq[i].size()-1) System.out.print(", ");
r = r && rEpoq[i].get(j)>valTest;
valTest=rEpoq[i].get(j);
r = r && rEpoq[i].get(j)>test;
test=rEpoq[i].get(j);
}
System.out.println(" ");
}
assertTrue(r);
}