#![allow(clippy::unwrap_used)]
use std::process::Command;
fn rustdl() -> Command {
Command::new(env!("CARGO_BIN_EXE_rustdl"))
}
fn disjoint_tiny() -> &'static str {
concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/fixtures/json/disjoint_tiny.ofn"
)
}
fn prophier_tiny() -> &'static str {
concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/fixtures/json/prophier_tiny.ofn"
)
}
fn individuals_tiny() -> &'static str {
concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/fixtures/json/individuals_tiny.ofn"
)
}
fn propvalues_tiny() -> &'static str {
concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/fixtures/json/propvalues_tiny.ofn"
)
}
#[test]
fn disjoint_text_output() {
let out = rustdl()
.args(["disjoint", disjoint_tiny()])
.output()
.unwrap();
assert!(out.status.success());
let stdout = String::from_utf8(out.stdout).unwrap();
assert_eq!(
stdout,
"# disjoint classes\n\
http://ex/#A\thttp://ex/#B\n\
http://ex/#B\thttp://ex/#C\n\
# disjoint object properties\n\
# disjoint data properties\n"
);
assert!(
out.stderr.is_empty(),
"expected no incomplete warning, got {:?}",
String::from_utf8_lossy(&out.stderr)
);
}
#[test]
fn property_hierarchy_text_output() {
let out = rustdl()
.args(["property-hierarchy", prophier_tiny()])
.output()
.unwrap();
assert!(out.status.success());
let stdout = String::from_utf8(out.stdout).unwrap();
assert_eq!(
stdout,
"# object property hierarchy\n\
http://ex/#r\thttp://ex/#s\n\
# data property hierarchy\n\
http://ex/#d1\thttp://ex/#d2\n"
);
assert!(out.stderr.is_empty());
}
#[test]
fn individuals_text_output() {
let out = rustdl()
.args(["individuals", individuals_tiny()])
.output()
.unwrap();
assert!(out.status.success());
let stdout = String::from_utf8(out.stdout).unwrap();
assert_eq!(
stdout,
"# same individuals\n\
# different individuals\n\
http://ex/#a\thttp://ex/#b\n"
);
let stderr = String::from_utf8(out.stderr).unwrap();
assert_eq!(
stderr,
"warning: individuals incomplete (budget/fragment) — sound under-approximation\n"
);
}
#[test]
fn property_values_text_output() {
let out = rustdl()
.args(["property-values", propvalues_tiny()])
.output()
.unwrap();
assert!(out.status.success());
let stdout = String::from_utf8(out.stdout).unwrap();
assert_eq!(
stdout,
"# object property values\n\
http://ex/#a\thttp://ex/#r\thttp://ex/#b\n\
http://ex/#b\thttp://ex/#r\thttp://ex/#a\n\
# data property values\n\
http://ex/#a\thttp://ex/#dp\t5\thttp://www.w3.org/2001/XMLSchema#integer\t\n"
);
assert!(
out.stderr.is_empty(),
"expected no incomplete warning, got {:?}",
String::from_utf8_lossy(&out.stderr)
);
}