-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTests.java
105 lines (99 loc) · 3.39 KB
/
Tests.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import static org.junit.Assert.*;
import org.junit.*;
import java.util.List;
public class Tests {
// @Test public void class_test_verify_trip_complete() {
// // Setup
// MBTA new_mbta = new MBTA();
// Log log = new Log();
//
// Station oakgrove = Station.make("Oak Grove");
// Station maldencenter = Station.make("Malden Center");
// Station wellington = Station.make("Wellington");
// Station assembly = Station.make("Assembly");
// Passenger p = Passenger.make("Terve");
// Train orange = Train.make("orange");
//
// new_mbta.addLine("orange", List.of("Oak Grove", "Malden Center", "Wellington", "Assembly"));
// new_mbta.addJourney("Terve", List.of("Oak Grove", "Wellington", "Malden Center"));
//
// // Verification
// Log events = new Log(List.of(
// new BoardEvent(p, orange, oakgrove),
// new MoveEvent(orange, oakgrove, maldencenter),
// new MoveEvent(orange, maldencenter, wellington),
// new DeboardEvent(p, orange, wellington),
// new MoveEvent(orange, wellington, assembly),
// new MoveEvent(orange, assembly, wellington),
// new BoardEvent(p, orange, wellington),
// new MoveEvent(orange, wellington, maldencenter),
// new DeboardEvent(p, orange, maldencenter)
// ));
//
// Verify.verify(new_mbta, events);
// }
//
// @Test public void test2() {
// // Setup
// MBTA new_mbta = new MBTA();
// Log log = new Log();
//
// Station s1 = Station.make("s1");
// Station s2 = Station.make("s2");
// Station s3 = Station.make("s3");
// Station s4 = Station.make("s4");
// Passenger p1 = Passenger.make("p1");
// Passenger p2 = Passenger.make("p2");
// Train t1 = Train.make("t1");
//
// new_mbta.addLine("t1", List.of("s1", "s2", "s3", "s4"));
// new_mbta.addJourney("p1", List.of("s2", "s3"));
// new_mbta.addJourney("p2", List.of("s1", "s3", "s2"));
//
// Log events = new Log(List.of(
// new BoardEvent(p2, t1, s1),
// new MoveEvent(t1, s1, s2),
// new BoardEvent(p1, t1, s2),
// new MoveEvent(t1, s2, s3),
// new DeboardEvent(p2, t1, s3),
// new DeboardEvent(p1, t1, s3),
// new MoveEvent(t1, s3, s4),
// new MoveEvent(t1, s4, s3),
// new BoardEvent(p2, t1, s3)
// ));
//
// try {
// Verify.verify(new_mbta, events);
// throw new RuntimeException();
// } catch (Exception e) {}
// }
@Test public void test3() {
MBTA mbta = new MBTA();
Train a = Train.make("a");
Train d = Train.make("d");
Station A = Station.make("A");
Station B = Station.make("B");
Station C = Station.make("C");
Station J = Station.make("J");
Station K = Station.make("K");
Station L = Station.make("L");
Passenger Alice = Passenger.make("Alice");
Passenger Bob = Passenger.make("Bob");
mbta.addLine("a", List.of("A", "B", "C"));
mbta.addLine("d", List.of("J", "K", "L"));
mbta.addJourney("Alice", List.of("A", "B"));
mbta.addJourney("Bob", List.of("J", "L"));
Log events = new Log(List.of(
new BoardEvent(Alice, a, A),
new MoveEvent(a, A, B),
new DeboardEvent(Alice, a, B),
new MoveEvent(a, B, C),
new MoveEvent(d, J, K),
new MoveEvent(d, K, L)
));
try {
Verify.verify(mbta, events);
throw new RuntimeException();
} catch (Exception e) {}
}
}