|
5 | 5 | "time" |
6 | 6 |
|
7 | 7 | "github.com/rijdendetreinen/gotrain/models" |
| 8 | + "github.com/stretchr/testify/assert" |
8 | 9 | ) |
9 | 10 |
|
10 | 11 | // testParseDeparture_Dvs3 is a helper function to parse a DVS3 message and check for errors |
@@ -84,9 +85,38 @@ func TestParseNormalDeparture_Dvs3(t *testing.T) { |
84 | 85 | t.Errorf("Expected departure time %v does not match %v", expectedDepartureTime, departure.DepartureTime) |
85 | 86 | } |
86 | 87 |
|
| 88 | + assert.Equal(t, 189, departure.Delay, "Wrong Delay: expected %d, but got %d", 189, departure.Delay) |
| 89 | + |
87 | 90 | if departure.Delay != 189 { |
88 | 91 | t.Errorf("Wrong Delay: expected %d, but got %d", 189, departure.Delay) |
89 | 92 | } |
| 93 | + |
| 94 | + // Verify that the destination is parsed correctly |
| 95 | + assert.Len(t, departure.DestinationActual, 1, "Wrong number of actual destinations") |
| 96 | + // assert.Len(t, departure.DestinationPlanned, 1, "Wrong number of planned destinations") |
| 97 | + |
| 98 | + if len(departure.DestinationActual) > 0 { |
| 99 | + // Verify that the destination station is parsed correctly |
| 100 | + assert.Equal(t, "MTR", departure.DestinationActual[0].Code, "Wrong DestinationActual Code") |
| 101 | + assert.Equal(t, "Randwyck", departure.DestinationActual[0].NameShort, "Wrong DestinationActual NameShort") |
| 102 | + assert.Equal(t, "Randwyck", departure.DestinationActual[0].NameMedium, "Wrong DestinationActual NameMedium") |
| 103 | + assert.Equal(t, "Maastricht Randwyck", departure.DestinationActual[0].NameLong, "Wrong DestinationActual NameLong") |
| 104 | + } |
| 105 | + |
| 106 | + // if len(departure.DestinationPlanned) > 0 { |
| 107 | + // // Verify that the destination station is parsed correctly |
| 108 | + // assert.Equal(t, "MTR", departure.DestinationPlanned[0].Code, "Wrong DestinationPlanned Code") |
| 109 | + // assert.Equal(t, "Randwyck", departure.DestinationPlanned[0].NameShort, "Wrong DestinationPlanned NameShort") |
| 110 | + // assert.Equal(t, "Randwyck", departure.DestinationPlanned[0].NameMedium, "Wrong DestinationPlanned NameMedium") |
| 111 | + // assert.Equal(t, "Maastricht Randwyck", departure.DestinationPlanned[0].NameLong, "Wrong DestinationPlanned NameLong") |
| 112 | + // } |
| 113 | + |
| 114 | + // Verify departure platform |
| 115 | + assert.Equal(t, "4b", departure.PlatformActual, "Wrong actual departure platform") |
| 116 | + assert.False(t, departure.PlatformChanged(), "Platform should not be changed") |
| 117 | + |
| 118 | + // Verify number of wings (1) |
| 119 | + assert.Len(t, departure.TrainWings, 1, "Wrong number of wings") |
90 | 120 | } |
91 | 121 |
|
92 | 122 | func TestHandleWrongNamespace_Dvs3(t *testing.T) { |
|
0 commit comments