pub mod analysis;
pub mod core;
pub mod magellan;
pub mod span_result;
pub use analysis::*;
pub use core::*;
pub use magellan::*;
pub use span_result::*;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_span_id_deterministic() {
let span1 = SpanResult::from_byte_span("test.rs".to_string(), 10, 20);
let span2 = SpanResult::from_byte_span("test.rs".to_string(), 10, 20);
assert_eq!(
span1.span_id, span2.span_id,
"Same span inputs should produce the same span_id"
);
}
#[test]
fn test_match_id_preserved() {
let match_id = uuid::Uuid::new_v4().to_string();
let span = SpanResult::from_byte_span("test.rs".to_string(), 10, 20)
.with_match_id(match_id.clone());
assert_eq!(
span.match_id,
Some(match_id),
"match_id should be preserved when set"
);
}
#[test]
fn test_match_id_from_resolved_span() {
let match_id = uuid::Uuid::new_v4().to_string();
let span1 = SpanResult::from_byte_span("test.rs".to_string(), 10, 20)
.with_match_id(match_id.clone());
assert_eq!(span1.match_id, Some(match_id));
assert!(!span1.span_id.is_empty());
}
#[test]
fn test_from_byte_span_generates_distinct_span_ids() {
let span1 = SpanResult::from_byte_span("file.rs".to_string(), 0, 10);
let span2 = SpanResult::from_byte_span("file.rs".to_string(), 0, 10);
let span3 = SpanResult::from_byte_span("file.rs".to_string(), 20, 30);
assert_eq!(span1.span_id, span2.span_id);
assert_ne!(span2.span_id, span3.span_id);
assert_ne!(span1.span_id, span3.span_id);
}
}