diff --git a/lts/src/lib.rs b/lts/src/lib.rs
index af37404..ee55050 100644
--- a/lts/src/lib.rs
+++ b/lts/src/lib.rs
@@ -2,6 +2,8 @@ mod bike_ottawa;
mod parse;
mod speed_limit_only;
mod tags;
+#[cfg(test)]
+mod tests;
#[cfg(target_arch = "wasm32")]
mod wasm;
@@ -9,7 +11,7 @@ pub use bike_ottawa::bike_ottawa;
pub use speed_limit_only::speed_limit_only;
pub use tags::Tags;
-#[derive(PartialEq, PartialOrd)]
+#[derive(Debug, PartialEq, PartialOrd)]
pub enum LTS {
NotAllowed,
LTS1,
diff --git a/lts/src/osm_unit_test_tool.html b/lts/src/osm_unit_test_tool.html
new file mode 100644
index 0000000..25481c1
--- /dev/null
+++ b/lts/src/osm_unit_test_tool.html
@@ -0,0 +1,47 @@
+
+
+
+ OpenStreetMap Unit Test tool
+
+
+
+ OpenStreetMap Unit Test tool
+
+
+
+
+
+ Output:
+
+
+
+
+
diff --git a/lts/src/tests.rs b/lts/src/tests.rs
new file mode 100644
index 0000000..c2d0229
--- /dev/null
+++ b/lts/src/tests.rs
@@ -0,0 +1,24 @@
+use crate::{bike_ottawa, Tags, LTS};
+
+#[test]
+fn test_bike_ottawa() {
+ // Use osm_unit_test_tool.html (open the file in your browser) to help generate
+ for (way_id, input, expected_lts) in vec![(
+ 170171587,
+ vec!["bicycle=yes", "foot=yes", "highway=footway"],
+ LTS::LTS1,
+ )] {
+ let mut tags = Tags::new();
+ for kv in input {
+ let parts = kv.split("=").collect::>();
+ tags.insert(parts[0], parts[1]);
+ }
+ let (actual_lts, _) = bike_ottawa(tags);
+ if actual_lts != expected_lts {
+ panic!(
+ "For http://openstreetmap.org/way/{way_id}, got {:?} but expected {:?}",
+ actual_lts, expected_lts
+ );
+ }
+ }
+}