Przeglądaj źródła

Begin implementing pathfinder test

Baglio Tabifata 4 lat temu
rodzic
commit
497984538a

+ 1 - 1
src/main/java/info/hkzlab/dupal/analyzer/board/boardio/DuPALAnalyzer.java

@@ -1,6 +1,6 @@
 package info.hkzlab.dupal.analyzer.board.boardio;
 
-import org.slf5j.Logger;
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import info.hkzlab.dupal.analyzer.devices.*;

+ 1 - 2
src/test/java/info/hkzlab/dupal/analyzer/FormattersTest.java

@@ -5,13 +5,12 @@ import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 
 import info.hkzlab.dupal.analyzer.devices.PAL16L8Specs;
-import info.hkzlab.dupal.analyzer.exceptions.DuPALBoardException;
 import info.hkzlab.dupal.analyzer.palanalisys.formatter.EspressoFormatter;
 
 public class FormattersTest 
 {
     @Test
-    public void espressoFormatterShouldBuildCorrect16L8Header() throws DuPALBoardException {
+    public void espressoFormatterShouldBuildCorrect16L8Header() {
         PAL16L8Specs pSpecs = new PAL16L8Specs();
         int ioAsOutMask = 0x03;
         String header = EspressoFormatter.formatEspressoTableHeader(pSpecs, ioAsOutMask);

+ 20 - 5
src/test/java/info/hkzlab/dupal/analyzer/PathFinderTest.java

@@ -4,14 +4,29 @@ import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
 
-import info.hkzlab.dupal.analyzer.exceptions.DuPALBoardException;
+import info.hkzlab.dupal.analyzer.exceptions.DuPALAnalyzerException;
+import info.hkzlab.dupal.analyzer.palanalisys.graph.OutLink;
+import info.hkzlab.dupal.analyzer.palanalisys.graph.OutState;
+import info.hkzlab.dupal.analyzer.palanalisys.graph.OutStatePins;
 
-public class PathFinderTest 
-{
+public class PathFinderTest {
     @Test
-    public void PathFinderShouldProvideShortestPathToDestination() throws DuPALBoardException {
-        // TODO: Implement this
+    public void PathFinderShouldProvideShortestPathToDestination() throws DuPALAnalyzerException {
+        OutState os_a = new OutState(new OutStatePins(0x00, 0x00), 3);
+        OutState os_b = new OutState(new OutStatePins(0x01, 0x00), 3);
+        OutState os_c = new OutState(new OutStatePins(0x02, 0x00), 3);
+        OutState os_d = new OutState(new OutStatePins(0x03, 0x00), 3);
+        OutState os_e = new OutState(new OutStatePins(0x04, 0x00), 3);
 
+        os_a.addOutLink(new OutLink(os_a, os_a, 0x10));
+        os_a.addOutLink(new OutLink(os_a, os_b, 0x20));
+        os_a.addOutLink(new OutLink(os_a, os_c, 0x30));
+
+        os_b.addOutLink(new OutLink(os_b, os_a, 0x10));
+        os_b.addOutLink(new OutLink(os_b, os_b, 0x20));
+        os_b.addOutLink(new OutLink(os_b, os_c, 0x30));
+
+        
         assertEquals("PathFinder should find the shortest path to an incomplete State", true, true);
     }
 }