Revision 11:8953a767edc4

View differences:

src/test/java/tt/jointeuclid2ni/SolverTest.java
1 1
package tt.jointeuclid2ni;
2 2

  
3
import java.io.ByteArrayOutputStream;
4
import java.io.FileNotFoundException;
5
import java.io.PrintStream;
6

  
3 7
import org.junit.After;
4 8
import org.junit.Before;
5 9
import org.junit.Test;
6 10

  
7
import java.io.ByteArrayOutputStream;
8
import java.io.FileNotFoundException;
9
import java.io.PrintStream;
10

  
11 11
public class SolverTest {
12 12

  
13 13
    private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
......
29 29
        String[] args = argStr.split(" ");
30 30
        Solver.main(args);
31 31
        String s = outContent.toString();
32
        org.junit.Assert.assertTrue(outContent.toString().matches(expectedOutputRegExp));
32

  
33
        boolean matches = (outContent.toString().matches(expectedOutputRegExp));
34

  
35
        if (!matches) {
36
            org.junit.Assert.fail("Expected output: " + expectedOutputRegExp + "Actual output: " + s);
37
        }
33 38
    }
34 39

  
35 40
    @Test
......
39 44
    }
40 45

  
41 46
    @Test
47
    public void testPPOnCrossconflict() throws FileNotFoundException {
48
        testSolver("-method PP -problemfile src/test/resources/problems/cross_conflict.xml -timeout 2000 -maxtime 2500 -gridstep 50 -summary -grid 8",
49
                "^2881.00;[0-9]*;[0-9]*;\n");
50
    }
51

  
52
    @Test
42 53
    public void testODOnSymobst() throws FileNotFoundException {
43 54
        testSolver("-method OD -problemfile src/test/resources/problems/symmetric_obstacles.xml -timeout 5000 -maxtime 2500 -gridstep 100 -summary -grid 4",
44 55
                "^3200.00;[0-9]*;[0-9]*;\n");
......
56 67
                "^([0-9\\.]*;[0-9]*;[0-9]*;\n)*1121.00;[0-9]*;[0-9]*;\n");
57 68
    }
58 69

  
70
//    @Test
71
//    public void testPPOnStopAtGoalProblem() throws FileNotFoundException {
72
//        testSolver("-method PP -problemfile src/test/resources/problems/stopatgoaltest2.xml -timeout 1000 -maxtime 2500 -gridstep 30 -summary -grid 4 -showvis",
73
//                "^([0-9\\.]*;[0-9]*;[0-9]*;\n)*1121.00;[0-9]*;[0-9]*;\n");
74
//    }
75

  
59 76

  
60 77
}
src/test/resources/problems/stopatgoaltest2.xml
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<multiagentproblem>
3
<environment>
4
<obstacles>
5
<obstacle>
6
<point id="0">
7
<x>63</x>
8
<y>443</y>
9
</point>
10
<point id="1">
11
<x>63</x>
12
<y>560</y>
13
</point>
14
<point id="2">
15
<x>936</x>
16
<y>559</y>
17
</point>
18
<point id="3">
19
<x>939</x>
20
<y>436</y>
21
</point>
22
<point id="4">
23
<x>561</x>
24
<y>439</y>
25
</point>
26
<point id="5">
27
<x>561</x>
28
<y>363</y>
29
</point>
30
<point id="6">
31
<x>437</x>
32
<y>363</y>
33
</point>
34
<point id="7">
35
<x>437</x>
36
<y>437</y>
37
</point>
38
<point id="8">
39
<x>84</x>
40
<y>437</y>
41
</point>
42
<point id="9">
43
<x>89</x>
44
<y>272</y>
45
</point>
46
<point id="10">
47
<x>966</x>
48
<y>251</y>
49
</point>
50
<point id="11">
51
<x>965</x>
52
<y>743</y>
53
</point>
54
<point id="12">
55
<x>73</x>
56
<y>712</y>
57
</point>
58
<point id="13">
59
<x>7</x>
60
<y>698</y>
61
</point>
62
<point id="14">
63
<x>45</x>
64
<y>364</y>
65
</point>
66
<point id="15">
67
<x>81</x>
68
<y>366</y>
69
</point>
70
<point id="16">
71
<x>80</x>
72
<y>438</y>
73
</point>
74
</obstacle>
75
</obstacles>
76
<bounds>
77
<point>
78
<x>0</x>
79
<y>0</y>
80
</point>
81
<point>
82
<x>1000</x>
83
<y>1000</y>
84
</point>
85
</bounds>
86
</environment>
87
<agents>
88

  
89
<agent>
90
<start>
91
<point>
92
<x>875</x>
93
<y>502</y>
94
</point>
95
</start>
96
<target>
97
<point>
98
<x>126</x>
99
<y>500</y>
100
</point>
101
</target>
102
<radius>35</radius>
103
<maxspeed>1</maxspeed>
104
</agent>
105

  
106

  
107
<agent>
108
<start>
109
<point>
110
<x>358</x>
111
<y>500</y>
112
</point>
113
</start>
114
<target>
115
<point>
116
<x>525</x>
117
<y>490</y>
118
</point>
119
</target>
120
<radius>35</radius>
121
<maxspeed>1</maxspeed>
122
</agent>
123

  
124
</agents>
125
</multiagentproblem>

Also available in: Unified diff