Skip to content

Commit af86247

Browse files
committed
Add scooter tests
1 parent 635fda4 commit af86247

File tree

3 files changed

+356
-797
lines changed

3 files changed

+356
-797
lines changed

Diff for: test/performance/helsinki/generate_test_cases.py

+68-28
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import csv
22

3-
fieldnames = ["testCaseId", "description", "departure", "fromLat", "fromLon", "toLat", "toLon", "origin", "destination", "modes", "category"]
3+
fieldnames = ["testCaseId", "description", "departure", "fromLat",
4+
"fromLon", "toLat", "toLon", "origin", "destination", "modes", "category"]
45

5-
locations= [
6+
locations = [
67

78
# Helsinki
89
{
@@ -22,8 +23,8 @@
2223
"name": "Itäkeskus"
2324
},
2425
{
25-
"coordinates": "60.148237,24.985142",
26-
"name": "Suomenlinna"
26+
"coordinates": "60.148237,24.985142",
27+
"name": "Suomenlinna"
2728
},
2829
# Espoo
2930
{
@@ -43,50 +44,87 @@
4344
"name": "Kauklahti"
4445
},
4546
{
46-
"coordinates": "60.29030, 24.56324",
47-
"name": "Nuuksio"
47+
"coordinates": "60.29030, 24.56324",
48+
"name": "Nuuksio"
4849
},
4950
{
50-
"coordinates": "60.17892, 24.65813",
51-
"name": "Latokaski"
51+
"coordinates": "60.17892, 24.65813",
52+
"name": "Latokaski"
5253
},
5354

5455
# Vantaa
5556
{
5657
"coordinates": "60.29246, 25.03861",
5758
"name": "Tikkurila"
5859
},
59-
#Airpot
60+
# Airpot
6061
{
61-
"coordinates": "60.317508, 24.969089",
62-
"name": "Airport"
62+
"coordinates": "60.317508, 24.969089",
63+
"name": "Airport"
6364
},
64-
#Kirkkonummi
65+
# Kirkkonummi
6566
{
66-
"coordinates": "60.12640, 24.43613",
67-
"name": "Kirkkonummi"
67+
"coordinates": "60.12640, 24.43613",
68+
"name": "Kirkkonummi"
6869
}
6970
]
7071

71-
departure_times = ["06:00","13:00","22:00"]
72-
73-
74-
failing_cases = [27, 66, 105, 144, 159, 183, 222, 300, 339, 420, 459, 498, 537, 576, 589, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 616, 629, 642, 655, 668, 681, 694, 707, 720]
75-
76-
72+
scooter_locations = [
73+
{
74+
"coordinates": "60.169665, 24.934652",
75+
"name": "Kamppi"
76+
},
77+
{
78+
"coordinates": "60.179022, 24.924151",
79+
"name": "Töölöntori"
80+
},
81+
{
82+
"coordinates": "60.18234, 24.82531",
83+
"name": "Otaniemi"
84+
},
85+
{
86+
"coordinates": "60.198349, 24.875654",
87+
"name": "Munkkiniemi"
88+
},
89+
{
90+
"coordinates": "60.199712, 24.939437",
91+
"name": "Pasila"
92+
},
93+
{
94+
"coordinates": "60.155454, 24.945134",
95+
"name": "Eira"
96+
},
97+
{
98+
"coordinates": "60.184945,24.982309",
99+
"name": "Kalasatama"
100+
},
101+
{
102+
"coordinates": "60.15654,24.86665",
103+
"name": "Lauttasaari"
104+
},
105+
{
106+
"coordinates": "60.18534,25.00162",
107+
"name": "Kulosaari"
108+
},
109+
]
110+
departure_times = ["06:00", "13:00", "22:00"]
77111

78112

113+
failing_cases = [27, 66, 105, 144, 159, 183, 222,
114+
300, 339, 420, 459, 498, 537, 566, 568, 570]
79115

80116

81117
rows = []
82118

119+
83120
def parse_coords(input):
84121
split = input.split(",")
85122
return {
86123
"lat": split[0],
87124
"lon": split[1]
88125
}
89126

127+
90128
counter = 0
91129
for start in locations:
92130
for end in locations:
@@ -97,7 +135,8 @@ def parse_coords(input):
97135
for departure in departure_times:
98136
counter = counter + 1
99137
if counter in failing_cases:
100-
print("FAILED: ", start["name"], " ", end["name"], " ", departure)
138+
print("FAILED: ", start["name"],
139+
" ", end["name"], " ", departure)
101140
else:
102141
rows.append({
103142
"testCaseId": counter,
@@ -113,32 +152,33 @@ def parse_coords(input):
113152
"category": "transit"
114153
})
115154
# Generate scooter test
116-
for start in locations:
117-
for end in locations:
155+
for start in scooter_locations:
156+
for end in scooter_locations:
118157
if end["coordinates"] != start["coordinates"]:
119158
start_coords = parse_coords(start["coordinates"])
120159
end_coords = parse_coords(end["coordinates"])
121160
departure = departure_times[0] # Use just the first time
122161
counter += 1
123162
if counter in failing_cases:
124-
print("FAILED:", start["name"], "→", end["name"], "@", departure, "(scooter-transit)")
163+
print("FAILED:", start["name"], "→",
164+
end["name"], "@", departure, "(scooter)")
125165
else:
126166
rows.append({
127167
"testCaseId": counter,
128-
"description": f'{start["name"]} to {end["name"]} (scooter-transit)',
168+
"description": f'{start["name"]} to {end["name"]} (scooter)',
129169
"departure": departure,
130170
"fromLat": start_coords["lat"],
131171
"fromLon": start_coords["lon"],
132172
"toLat": end_coords["lat"],
133173
"toLon": end_coords["lon"],
134174
"origin": start["name"],
135175
"destination": end["name"],
136-
"modes": "TRANSIT|WALK|SCOOTER_RENT",
137-
"category": "scooter-transit"
176+
"modes": "SCOOTER_RENT|WALK",
177+
"category": "scooter"
138178
})
139179

140180
print(counter)
141181
with open('travelSearch.csv', 'w', encoding='UTF8', newline='') as f:
142182
writer = csv.DictWriter(f, fieldnames=fieldnames)
143183
writer.writeheader()
144-
writer.writerows(rows)
184+
writer.writerows(rows)

0 commit comments

Comments
 (0)