1#![doc = include_str!("../README.md")]
2mod error;
3mod hrdf;
4mod models;
5mod parsing;
6mod storage;
7mod utils;
8
9pub use hrdf::Hrdf;
10pub use models::*;
11pub use storage::DataStorage;
12pub use utils::timetable_end_date;
13pub use utils::timetable_start_date;
14
15#[cfg(test)]
16mod tests {
17 use super::*;
18 use test_log::test;
19
20 #[test(tokio::test)]
21 async fn url_not_found() {
22 let hrdf = Hrdf::new(
23 Version::V_5_40_41_2_0_6,
24 "https://data.opentransportdata.swiss/test-should-not-exists",
25 true,
26 None,
27 )
28 .await;
29 match hrdf {
30 Ok(_) => panic!("should be an error"),
31 Err(err) => {
32 assert!(
33 err.to_string().to_lowercase().contains("404 not found"),
34 "The error should indicate '404 Not Found'"
35 );
36 }
37 }
38 }
39
40 #[test(tokio::test)]
41 #[ignore]
42 async fn parsing_2024() {
43 let _hrdf = Hrdf::new(
44 Version::V_5_40_41_2_0_6,
45 "https://data.opentransportdata.swiss/en/dataset/timetable-54-2024-hrdf/permalink",
46 true,
47 None,
48 )
49 .await
50 .unwrap();
51 }
52
53 #[test(tokio::test)]
54 #[ignore]
55 async fn parsing_2025() {
56 let _hrdf = Hrdf::new(
57 Version::V_5_40_41_2_0_7,
58 "https://data.opentransportdata.swiss/en/dataset/timetable-54-2025-hrdf/permalink",
59 true,
60 None,
61 )
62 .await
63 .unwrap();
64 }
65}