Skip to content

Commit

Permalink
Add test for the new parsing functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskrause committed Jan 10, 2024
1 parent ffb4f57 commit cd63bf7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions graphannis/src/annis/db/aql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,3 +646,23 @@ fn extract_location<'a>(
};
from_to
}

#[cfg(test)]
mod tests {
use std::{fs::File, path::PathBuf};

use super::*;

#[test]
fn query_on_annotation_graph() {
let cargo_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let input_file = File::open(&cargo_dir.join("tests/SaltSampleCorpus.graphml")).unwrap();
let (graph, _config_str): (AnnotationGraph, _) =
graphannis_core::graph::serialization::graphml::import(input_file, false, |_status| {})
.unwrap();

let query = parse("tok @* annis:doc=\"doc4\"", false).unwrap();
let it = execute_query_on_graph(&graph, &query, true, None).unwrap();
assert_eq!(11, it.count());
}
}

0 comments on commit cd63bf7

Please sign in to comment.