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