@@ -1289,3 +1289,255 @@ BOOST_FIXTURE_TEST_CASE(traffic_report_on_a_tagged_rail_section, DisruptedNetwor
1289
1289
std::set<std::string> res = {" disrup_rail_section" , " disrup_rail_section_reduced_service" };
1290
1290
BOOST_CHECK_EQUAL_RANGE (res, uris);
1291
1291
}
1292
+
1293
+ struct LineSectionLineReport {
1294
+ ed::builder b;
1295
+ navitia::PbCreator pb_creator;
1296
+ const boost::posix_time::ptime start_date = " 20180402T060000" _dt;
1297
+ const boost::posix_time::ptime end_date = " 20180428T060000" _dt;
1298
+ const time_period published_period = time_period(start_date, end_date);
1299
+ /*
1300
+ *
1301
+ published perdiod
1302
+ 20180402T060000 20180428T060000
1303
+ |---------------------------------------------------------------------------------------------|
1304
+ |
1305
+ |
1306
+ | application period
1307
+ | 20180405 20180409 20180412 20180416 20180419 20180423
1308
+ impact1 | |------------|
1309
+ impact2 | | |------------------|
1310
+ impact3 | | |--------------|
1311
+ impact4 | |------------------------------------------------------------------|
1312
+ impact5 | | |---------------------------------|
1313
+ impact6 | | |-------|
1314
+
1315
+
1316
+
1317
+ since - until
1318
+
1319
+ test0 |---|
1320
+ test1 |------|
1321
+ test2 |---------|
1322
+ test3 |--|
1323
+ test4 |-----------|
1324
+ test5 |---|
1325
+ test6 |-----------|
1326
+ test7 |-------|
1327
+ test8 |-------|
1328
+ test9 |---|
1329
+ test10 |-------|
1330
+ test11 |--|
1331
+
1332
+ Results
1333
+ test0:
1334
+ test1:
1335
+ test2: impact1 & impact4
1336
+ test3: impact1 & impact4
1337
+ test4: impact1 & impact3 & impact4 & impact5
1338
+ test5: impact3 & impact4 & impact5
1339
+ test6: impact2 & impact3 & impact4 & impact5
1340
+ test7: impact2 & impact4 & impact5
1341
+ test8: impact4
1342
+ test9:
1343
+ test10: impact6
1344
+ test11:
1345
+ */
1346
+ LineSectionLineReport ()
1347
+ : b(" 20180301" , [](ed::builder& b) {
1348
+ b.sa (" stop_area:1" , 0 , 0 , false , true )(" sp1_1" );
1349
+ b.sa (" stop_area:2" , 0 , 0 , false , true )(" sp1_2" );
1350
+ b.sa (" stop_area:3" , 0 , 0 , false , true )(" sp1_3" );
1351
+ b.sa (" stop_area:4" , 0 , 0 , false , true )(" sp1_4" );
1352
+ b.sa (" stop_area:5" , 0 , 0 , false , true )(" sp1_5" );
1353
+ b.sa (" stop_area:6" , 0 , 0 , false , true )(" sp1_6" );
1354
+ b.vj_with_network (" network_1" , " line_1" )
1355
+ .route (" route_1" )(" sp1_1" , " 08:10" _t)(" sp1_2" , " 08:20" _t)(" sp1_3" , " 08:30" _t)(" sp1_4" , " 08:40" _t)(
1356
+ " sp1_5" , " 08:44" _t)(" sp1_6" , " 08:48" _t);
1357
+ }) {
1358
+ // Impact1
1359
+ navitia::apply_disruption (
1360
+ b.impact (nt::RTLevel::Adapted, " line_section_1" )
1361
+ .severity (nt::disruption::Effect::NO_SERVICE)
1362
+ .publish (published_period)
1363
+ .application_periods (time_period (" 20180405T000000" _dt, " 20180409T235900" _dt))
1364
+ .on_line_section (" line_1" , " stop_area:4" , " stop_area:5" , {" route_1" }, *b.data ->pt_data )
1365
+ .get_disruption (),
1366
+ *b.data ->pt_data , *b.data ->meta );
1367
+
1368
+ // Impact2
1369
+ navitia::apply_disruption (
1370
+ b.impact (nt::RTLevel::Adapted, " line_section_2" )
1371
+ .severity (nt::disruption::Effect::NO_SERVICE)
1372
+ .publish (published_period)
1373
+ .application_periods (time_period (" 20180412T235900" _dt, " 20180416T235900" _dt))
1374
+ .on_line_section (" line_1" , " stop_area:4" , " stop_area:5" , {" route_1" }, *b.data ->pt_data )
1375
+ .get_disruption (),
1376
+ *b.data ->pt_data , *b.data ->meta );
1377
+
1378
+ // Impact3
1379
+ navitia::apply_disruption (
1380
+ b.impact (nt::RTLevel::Adapted, " line_section_3" )
1381
+ .severity (nt::disruption::Effect::NO_SERVICE)
1382
+ .publish (published_period)
1383
+ .application_periods (time_period (" 20180409T235900" _dt, " 20180412T235900" _dt))
1384
+ .on_line_section (" line_1" , " stop_area:4" , " stop_area:5" , {" route_1" }, *b.data ->pt_data )
1385
+ .get_disruption (),
1386
+ *b.data ->pt_data , *b.data ->meta );
1387
+
1388
+ // Impact4
1389
+ navitia::apply_disruption (
1390
+ b.impact (nt::RTLevel::Adapted, " line_section_4" )
1391
+ .severity (nt::disruption::Effect::NO_SERVICE)
1392
+ .publish (published_period)
1393
+ .application_periods (time_period (" 20180405T000000" _dt, " 20180419T235900" _dt))
1394
+ .on_line_section (" line_1" , " stop_area:4" , " stop_area:5" , {" route_1" }, *b.data ->pt_data )
1395
+ .get_disruption (),
1396
+ *b.data ->pt_data , *b.data ->meta );
1397
+
1398
+ // Impact5
1399
+ navitia::apply_disruption (
1400
+ b.impact (nt::RTLevel::Adapted, " line_section_5" )
1401
+ .severity (nt::disruption::Effect::NO_SERVICE)
1402
+ .publish (published_period)
1403
+ .application_periods (time_period (" 20180409T235900" _dt, " 20180416T235900" _dt))
1404
+ .on_line_section (" line_1" , " stop_area:4" , " stop_area:5" , {" route_1" }, *b.data ->pt_data )
1405
+ .get_disruption (),
1406
+ *b.data ->pt_data , *b.data ->meta );
1407
+
1408
+ // Impact6
1409
+ navitia::apply_disruption (
1410
+ b.impact (nt::RTLevel::Adapted, " line_section_6" )
1411
+ .severity (nt::disruption::Effect::NO_SERVICE)
1412
+ .publish (published_period)
1413
+ .application_periods (time_period (" 20180423T060000" _dt, " 20180428T060000" _dt))
1414
+ .msg (" ms line_section_6" , nt::disruption::ChannelType::sms)
1415
+ .on_line_section (" line_1" , " stop_area:4" , " stop_area:5" , {" route_1" }, *b.data ->pt_data )
1416
+ .get_disruption (),
1417
+ *b.data ->pt_data , *b.data ->meta );
1418
+ }
1419
+ };
1420
+
1421
+ BOOST_FIXTURE_TEST_CASE (line_report_since_until, LineSectionLineReport) {
1422
+ // Line report without since and until
1423
+
1424
+ pb_creator.init (b.data .get (), start_date, published_period);
1425
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, boost::none, boost::none);
1426
+
1427
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 6 );
1428
+
1429
+ std::set<std::string> uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1430
+ std::set<std::string> res = {" line_section_1" , " line_section_2" , " line_section_3" ,
1431
+ " line_section_4" , " line_section_5" , " line_section_6" };
1432
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1433
+
1434
+ // Line report without since
1435
+ pb_creator.init (b.data .get (), start_date, published_period);
1436
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, boost::none, " 20180429T060000" _dt);
1437
+
1438
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 6 );
1439
+
1440
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1441
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1442
+
1443
+ // Line report without until
1444
+ pb_creator.init (b.data .get (), start_date, published_period);
1445
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180401T060000" _dt, boost::none);
1446
+
1447
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 6 );
1448
+
1449
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1450
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1451
+
1452
+ // Test0
1453
+ pb_creator.init (b.data .get (), start_date, published_period);
1454
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180329T060000" _dt, " 20180401T060000" _dt);
1455
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 0 );
1456
+
1457
+ // Test1
1458
+ pb_creator.init (b.data .get (), start_date, published_period);
1459
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180402T060000" _dt, " 20180404T060000" _dt);
1460
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 0 );
1461
+
1462
+ // Test2
1463
+ pb_creator.init (b.data .get (), start_date, published_period);
1464
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180404T060000" _dt, " 20180406T060000" _dt);
1465
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 2 );
1466
+
1467
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1468
+ res = {" line_section_1" , " line_section_4" };
1469
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1470
+
1471
+ // Test3
1472
+ pb_creator.init (b.data .get (), start_date, published_period);
1473
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180406T060000" _dt, " 20180407T060000" _dt);
1474
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 2 );
1475
+
1476
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1477
+ res = {" line_section_1" , " line_section_4" };
1478
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1479
+
1480
+ // Test4
1481
+ pb_creator.init (b.data .get (), start_date, published_period);
1482
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180407T060000" _dt, " 20180410T060000" _dt);
1483
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 4 );
1484
+
1485
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1486
+ res = {" line_section_1" , " line_section_3" , " line_section_4" , " line_section_5" };
1487
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1488
+
1489
+ // Test5
1490
+ pb_creator.init (b.data .get (), start_date, published_period);
1491
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180410T060000" _dt, " 20180411T060000" _dt);
1492
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 3 );
1493
+
1494
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1495
+ res = {" line_section_3" , " line_section_4" , " line_section_5" };
1496
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1497
+
1498
+ // Test6
1499
+ pb_creator.init (b.data .get (), start_date, published_period);
1500
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180411T060000" _dt, " 20180413T060000" _dt);
1501
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 4 );
1502
+
1503
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1504
+ res = {" line_section_2" , " line_section_3" , " line_section_4" , " line_section_5" };
1505
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1506
+
1507
+ // Test7
1508
+ pb_creator.init (b.data .get (), start_date, published_period);
1509
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180413T060000" _dt, " 20180414T060000" _dt);
1510
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 3 );
1511
+
1512
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1513
+ res = {" line_section_2" , " line_section_4" , " line_section_5" };
1514
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1515
+
1516
+ // Test8
1517
+ pb_creator.init (b.data .get (), start_date, published_period);
1518
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180417T060000" _dt, " 20180418T060000" _dt);
1519
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 1 );
1520
+
1521
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1522
+ res = {" line_section_4" };
1523
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1524
+
1525
+ // Test9
1526
+ pb_creator.init (b.data .get (), start_date, published_period);
1527
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180420T060000" _dt, " 20180421T060000" _dt);
1528
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 0 );
1529
+
1530
+ // Test10
1531
+ pb_creator.init (b.data .get (), start_date, published_period);
1532
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180421T060000" _dt, " 20180424T060000" _dt);
1533
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 1 );
1534
+
1535
+ uris = navitia::test::get_impacts_uris (pb_creator.impacts );
1536
+ res = {" line_section_6" };
1537
+ BOOST_CHECK_EQUAL_RANGE (res, uris);
1538
+
1539
+ // Test11
1540
+ pb_creator.init (b.data .get (), start_date, published_period);
1541
+ disruption::line_reports (pb_creator, *b.data , 1 , 25 , 0 , " " , {}, {}, " 20180429T060000" _dt, " 20180430T060000" _dt);
1542
+ BOOST_CHECK_EQUAL (pb_creator.impacts .size (), 0 );
1543
+ }
0 commit comments