diff --git a/shacl_validation/tests/core/complex/mod.rs b/shacl_validation/tests/core/complex/mod.rs index cc5b0aaf..5efee842 100644 --- a/shacl_validation/tests/core/complex/mod.rs +++ b/shacl_validation/tests/core/complex/mod.rs @@ -1,17 +1,24 @@ use shacl_validation::shacl_processor::ShaclValidationMode; use crate::test; +use crate::TestSuite; -const PATH: &str = "/tests/data-shapes/data-shapes-test-suite/tests/core/complex/"; +const PATH: &str = "tests/data-shapes/data-shapes-test-suite/tests/core/complex/"; #[test] -fn personexample() { +fn personexample() -> Result<(), TestSuite> { let path = format!("{}/{}.ttl", PATH, "personexample"); - test(path, ShaclValidationMode::Native, false); + test(path, ShaclValidationMode::Native, false) } #[test] -fn shacl_shacl_data_shapes() {} +fn shacl_shacl_data_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "shacl-shacl-data-shapes"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn shacl_shacl() {} +fn shacl_shacl() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "shacl-shacl"); + test(path, ShaclValidationMode::Native, false) +} diff --git a/shacl_validation/tests/core/misc/mod.rs b/shacl_validation/tests/core/misc/mod.rs index 5351a356..e8847c25 100644 --- a/shacl_validation/tests/core/misc/mod.rs +++ b/shacl_validation/tests/core/misc/mod.rs @@ -1,14 +1,36 @@ +use shacl_validation::shacl_processor::ShaclValidationMode; + +use crate::test; +use crate::TestSuite; + +const PATH: &str = "tests/data-shapes/data-shapes-test-suite/tests/core/misc/"; + #[test] -fn deactivated_001() {} +fn deactivated_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "deactivated-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn deactivated_002() {} +fn deactivated_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "deactivated-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn message_001() {} +fn message_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "message-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn severity_001() {} +fn severity_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "severity-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn severity_002() {} +fn severity_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "severity-002"); + test(path, ShaclValidationMode::Native, false) +} diff --git a/shacl_validation/tests/core/node/mod.rs b/shacl_validation/tests/core/node/mod.rs index 82052906..88e221e8 100644 --- a/shacl_validation/tests/core/node/mod.rs +++ b/shacl_validation/tests/core/node/mod.rs @@ -1,116 +1,222 @@ use shacl_validation::shacl_processor::ShaclValidationMode; use crate::test; +use crate::TestSuite; -const PATH: &str = "/tests/data-shapes/data-shapes-test-suite/tests/core/node/"; +const PATH: &str = "tests/data-shapes/data-shapes-test-suite/tests/core/node/"; #[test] -fn and_001() { +fn and_001() -> Result<(), TestSuite> { let path = format!("{}/{}.ttl", PATH, "and-001"); - test(path, ShaclValidationMode::Native, false); + test(path, ShaclValidationMode::Native, false) } #[test] -fn and_002() {} +fn and_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "and-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn class_001() {} +fn class_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "class-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn class_002() {} +fn class_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "class-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn class_003() {} +fn class_003() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "class-003"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn closed_001() {} +fn closed_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "closed-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn closed_002() {} +fn closed_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "closed-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_001() {} +fn datatype_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_002() {} +fn datatype_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn disjoint_001() {} +fn disjoint_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "disjoint-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn equals_001() {} +fn equals_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "equals-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn hasValue_001() {} +fn has_value_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "hasValue-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn in_001() {} +fn in_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "in-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn languageIn_001() {} +fn language_in_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "languageIn-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxExclusive_001() {} +fn max_exclusive_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxExclusive-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxInclusive_001() {} +fn max_inclusive_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxInclusive-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxLength_001() {} +fn max_length_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxLength-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minExclusive_001() {} +fn min_exclusive_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minExclusive-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minInclusive_001() {} +fn min_inclusive_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minInclusive-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minInclusive_002() {} +fn min_inclusive_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minInclusive-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minInclusive_003() {} +fn min_inclusive_003() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minInclusive-003"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minLength_001() {} +fn min_length_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minLength-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn node_001() {} +fn node_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "node-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn nodeKind_001() {} +fn node_kind_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "nodeKind-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn not_001() {} +fn not_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "not-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn not_002() {} +fn not_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "not-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn or_001() {} +fn or_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "or-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn pattern_001() {} +fn pattern_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "pattern-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn pattern_002() {} +fn pattern_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "pattern-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn qualified_001_data() {} +fn qualified_001_data() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "qualified-001-data"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn qualified_001_shapes() {} +fn qualified_001_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "qualified-001-shapes"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn qualified_001() {} +fn qualified_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "qualified-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn xone_001() {} +fn xone_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "xone-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn xone_duplicate_data() {} +fn xone_duplicate_data() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "xone-duplicate-data"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn xone_duplicate_shapes() {} +fn xone_duplicate_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "xone-duplicate-shapes"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn xone_duplicate() {} +fn xone_duplicate() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "xone-duplicate"); + test(path, ShaclValidationMode::Native, false) +} diff --git a/shacl_validation/tests/core/path/mod.rs b/shacl_validation/tests/core/path/mod.rs index 03ba70e4..698a0db5 100644 --- a/shacl_validation/tests/core/path/mod.rs +++ b/shacl_validation/tests/core/path/mod.rs @@ -1,50 +1,108 @@ +use shacl_validation::shacl_processor::ShaclValidationMode; + +use crate::test; +use crate::TestSuite; + +const PATH: &str = "tests/data-shapes/data-shapes-test-suite/tests/core/path/"; + #[test] -fn path_alternative_001() {} +fn path_alternative_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-alternative-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_complex_001() {} +fn path_complex_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-complex-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_complex_002_data() {} +fn path_complex_002_data() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-complex-002-data"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_complex_002_shapes() {} +fn path_complex_002_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-complex-002-shapes"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_complex_002() {} +fn path_complex_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-complex-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_inverse_001() {} +fn path_inverse_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-inverse-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_oneOrMore_001() {} +fn path_one_or_more_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-oneOrMore-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_sequence_001() {} +fn path_sequence_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-sequence-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_sequence_002() {} +fn path_sequence_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-sequence-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_sequence_duplicate_001() {} +fn path_sequence_duplicate_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-sequence-duplicate-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_strange_001() {} +fn path_strange_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-strange-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_strange_002() {} +fn path_strange_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-strange-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_unused_001_data() {} +fn path_unused_001_data() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-unused-001-data"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_unused_001_shapes() {} +fn path_unused_001_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-unused-001-shapes"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_unused_001() {} +fn path_unused_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-unused-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_zeroOrMore_001() {} +fn path_zero_or_more_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-zeroOrMore-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn path_zeroOrOne_001() {} +fn path_zero_or_one_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "path-zeroOrOne-001"); + test(path, ShaclValidationMode::Native, false) +} diff --git a/shacl_validation/tests/core/property/mod.rs b/shacl_validation/tests/core/property/mod.rs index f8de4b93..a8162034 100644 --- a/shacl_validation/tests/core/property/mod.rs +++ b/shacl_validation/tests/core/property/mod.rs @@ -1,125 +1,258 @@ +use shacl_validation::shacl_processor::ShaclValidationMode; + +use crate::test; +use crate::TestSuite; + +const PATH: &str = "tests/data-shapes/data-shapes-test-suite/tests/core/property/"; + #[test] -fn and_001() {} +fn and_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "and-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn class_001() {} +fn class_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "class-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_001() {} +fn datatype_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_002() {} +fn datatype_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_003() {} +fn datatype_003() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-003"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_ill_formed_data() {} +fn datatype_ill_formed_data() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-ill-formed-data"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_ill_formed_shapes() {} +fn datatype_ill_formed_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-ill-formed-shapes"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn datatype_ill_formed() {} +fn datatype_ill_formed() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "datatype-ill-formed"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn disjoint_001() {} +fn disjoint_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "disjoint-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn equals_001() {} +fn equals_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "equals-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn hasValue_001() {} +fn has_value_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "hasValue-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn in_001() {} +fn in_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "in-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn languageIn_001() {} +fn language_in_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "languageIn-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn lessThan_001() {} +fn less_than_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "lessThan-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn lessThan_002() {} +fn less_than_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "lessThan-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn lessThanOrEquals_001() {} +fn less_than_or_equals_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "lessThanOrEquals-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxCount_001() {} +fn max_count_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxCount-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxCount_002() {} +fn max_count_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxCount-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxExclusive_001() {} +fn max_exclusive_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxExclusive-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxInclusive_001() {} +fn max_inclusive_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxInclusive-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn maxLength_001() {} +fn max_length_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "maxLength-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minCount_001() {} +fn min_count_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minCount-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minCount_002() {} +fn min_count_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minCount-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minExclusive_001() {} +fn min_exclusive_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minExclusive-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minExclusive_002() {} +fn min_exclusive_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minExclusive-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn minLength_001() {} +fn min_length_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "minLength-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn node_001() {} +fn node_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "node-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn node_002() {} +fn node_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "node-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn nodeKind_001() {} +fn node_kind_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "nodeKind-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn not_001() {} +fn not_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "not-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn or_001() {} +fn or_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "or-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn or_datatypes_001() {} +fn or_datatypes_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "or-datatypes-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn pattern_001() {} +fn pattern_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "pattern-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn pattern_002() {} +fn pattern_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "pattern-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn property_001() {} +fn property_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "property-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn qualifiedMinCountDisjoint_001() {} +fn qualified_min_count_disjoint_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "qualifiedMinCountDisjoint-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn qualifiedValueShape_001() {} +fn qualified_value_shape_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "qualifiedValueShape-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn qualifiedValueShapesDisjoint_001() {} +fn qualified_value_shapes_disjoint_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "qualifiedValueShapesDisjoint-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn uniqueLang_001() {} +fn unique_lang_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "uniqueLang-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn uniqueLang_002_data() {} +fn unique_lang_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "uniqueLang-002"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn uniqueLang_002_shapes() {} +fn unique_lang_002_data() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "uniqueLang-002-data"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn uniqueLang_002() {} +fn unique_lang_002_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "uniqueLang-002-shapes"); + test(path, ShaclValidationMode::Native, false) +} diff --git a/shacl_validation/tests/core/targets/mod.rs b/shacl_validation/tests/core/targets/mod.rs index ac33f647..831fc945 100644 --- a/shacl_validation/tests/core/targets/mod.rs +++ b/shacl_validation/tests/core/targets/mod.rs @@ -1,20 +1,48 @@ +use shacl_validation::shacl_processor::ShaclValidationMode; + +use crate::test; +use crate::TestSuite; + +const PATH: &str = "tests/data-shapes/data-shapes-test-suite/tests/core/targets/"; + #[test] -fn multipleTargets_001() {} +fn multiple_targets_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "multipleTargets-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn targetClass_001() {} +fn target_class_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "targetClass-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn targetClassImplicit_001() {} +fn target_class_implicit_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "targetClassImplicit-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn targetNode_001() {} +fn target_node_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "targetNode-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn targetObjectsOf_001() {} +fn target_objects_of_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "targetObjectsOf-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn targetSubjectsOf_001() {} +fn target_subjects_of_001() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "targetSubjectsOf-001"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn targetSubjectsOf_002() {} +fn target_subjects_of_002() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "targetSubjectsOf-002"); + test(path, ShaclValidationMode::Native, false) +} diff --git a/shacl_validation/tests/core/validation_reports/mod.rs b/shacl_validation/tests/core/validation_reports/mod.rs index 31deabb7..1183e151 100644 --- a/shacl_validation/tests/core/validation_reports/mod.rs +++ b/shacl_validation/tests/core/validation_reports/mod.rs @@ -1,8 +1,24 @@ +use shacl_validation::shacl_processor::ShaclValidationMode; + +use crate::test; +use crate::TestSuite; + +const PATH: &str = "tests/data-shapes/data-shapes-test-suite/tests/core/validation-reports/"; + #[test] -fn shared_data() {} +fn shared_data() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "shared-data"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn shared_shapes() {} +fn shared_shapes() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "shared-shapes"); + test(path, ShaclValidationMode::Native, false) +} #[test] -fn shared() {} +fn shared() -> Result<(), TestSuite> { + let path = format!("{}/{}.ttl", PATH, "shared"); + test(path, ShaclValidationMode::Native, false) +} diff --git a/shacl_validation/tests/mod.rs b/shacl_validation/tests/mod.rs index 149c2b4f..ae366c98 100644 --- a/shacl_validation/tests/mod.rs +++ b/shacl_validation/tests/mod.rs @@ -1,49 +1,47 @@ use std::collections::HashSet; use std::fs::File; use std::io::BufReader; +use std::io::Error; use std::panic; use std::path::Path; use iri_s::IriS; use oxrdf::Subject as OxSubject; use oxrdf::Term as OxTerm; +use shacl_ast::compiled::compiled_shacl_error::CompiledShaclError; +use shacl_ast::shacl_parser_error::ShaclParserError; use shacl_ast::Schema; use shacl_ast::ShaclParser; use shacl_validation::shacl_processor::ShaclProcessor; use shacl_validation::shacl_processor::ShaclValidationMode; use shacl_validation::shacl_validation_vocab; +use shacl_validation::validate_error::ValidateError; use shacl_validation::validation_report::report::ValidationReport; +use shacl_validation::validation_report::validation_report_error::ReportError; use sparql_service::RdfData; +use sparql_service::RdfDataError; use srdf::RDFFormat; use srdf::ReaderMode; use srdf::SRDFBasic; use srdf::SRDFGraph; +use srdf::SRDFGraphError; use srdf::SRDF; +use thiserror::Error; mod core; struct ShaclTest { data: RdfData, shapes: Schema, - base: Option, report: ValidationReport, - label: Option, } impl ShaclTest { - fn new( - data: RdfData, - shapes: Schema, - base: Option, - report: ValidationReport, - label: Option, - ) -> Self { + fn new(data: RdfData, shapes: Schema, report: ValidationReport) -> Self { ShaclTest { data, shapes, - base, report, - label, } } } @@ -55,46 +53,42 @@ pub struct Manifest { } impl Manifest { - fn new(path: &Path) -> Self { - let base = match Path::new(path).canonicalize().unwrap().to_str() { + fn new(path: &Path) -> Result { + let base = match Path::new(path).canonicalize()?.to_str() { Some(path) => format!("file:/{}", path), None => panic!("Path not found!!"), }; let term = RdfData::iri_s2term(&IriS::new_unchecked(&base)); - - let subject = match RdfData::term_as_subject(&term) { - Some(subject) => subject, - None => todo!(), - }; + let subject = RdfData::term_as_subject(&term).unwrap(); let graph = SRDFGraph::from_path( &Path::new(path), &RDFFormat::Turtle, Some(&base), &ReaderMode::Lax, - ) - .unwrap(); + )?; - let store = RdfData::from_graph(graph).unwrap(); - let entries = Manifest::parse_entries(&store, subject); + let store = RdfData::from_graph(graph)?; + let entries = Manifest::parse_entries(&store, subject)?; - Self { + let ans = Self { base, store, entries, - } + }; + + Ok(ans) } - fn parse_entries(store: &RdfData, subject: OxSubject) -> HashSet { + fn parse_entries(store: &RdfData, subject: OxSubject) -> Result, TestSuite> { let mut entry_terms = HashSet::new(); let entry_subject = store .objects_for_subject_predicate( &subject, &RdfData::iri_s2iri(&shacl_validation_vocab::MF_ENTRIES), - ) - .unwrap() + )? .into_iter() .next(); @@ -103,11 +97,7 @@ impl Manifest { let tmp = RdfData::term_as_subject(&subject).unwrap(); match store - .objects_for_subject_predicate( - &tmp, - &RdfData::iri_s2iri(&shacl_validation_vocab::MF_ENTRIES), - ) - .unwrap() + .objects_for_subject_predicate(&tmp, &RdfData::iri_s2iri(&srdf::RDF_FIRST))? .into_iter() .next() { @@ -116,8 +106,7 @@ impl Manifest { }; subject = match store - .objects_for_subject_predicate(&tmp, &RdfData::iri_s2iri(&srdf::RDF_REST)) - .unwrap() + .objects_for_subject_predicate(&tmp, &RdfData::iri_s2iri(&srdf::RDF_REST))? .into_iter() .next() { @@ -127,101 +116,81 @@ impl Manifest { } } - entry_terms + Ok(entry_terms) } - fn collect_tests(&self) -> Vec { - self.entries - .iter() - .map(|entry| { - let subject = RdfData::term_as_subject(entry).unwrap(); - - let label = self - .store - .objects_for_subject_predicate(&subject, &RdfData::iri_s2iri(&srdf::RDFS_LABEL)) - .unwrap() - .into_iter() - .next() - .unwrap(); - - let action = self - .store - .objects_for_subject_predicate( - &subject, - &RdfData::iri_s2iri(&shacl_validation_vocab::MF_ACTION), - ) - .unwrap() - .into_iter() - .next() - .unwrap(); - - let results = self - .store - .objects_for_subject_predicate( - &subject, - &RdfData::iri_s2iri(&shacl_validation_vocab::MF_RESULT), - ) - .unwrap() - .into_iter() - .next() - .unwrap(); - - let report = ValidationReport::parse(&self.store, results).unwrap(); + fn collect_tests(&self) -> Result, TestSuite> { + let mut entries = Vec::new(); + for entry in &self.entries { + let subject = RdfData::term_as_subject(entry).unwrap(); + + let action = self + .store + .objects_for_subject_predicate( + &subject, + &RdfData::iri_s2iri(&shacl_validation_vocab::MF_ACTION), + )? + .into_iter() + .next() + .unwrap(); - let subject = RdfData::term_as_subject(&action).unwrap(); + let results = self + .store + .objects_for_subject_predicate( + &subject, + &RdfData::iri_s2iri(&shacl_validation_vocab::MF_RESULT), + )? + .into_iter() + .next() + .unwrap(); - let data_graph_iri = self - .store - .objects_for_subject_predicate( - &subject, - &RdfData::iri_s2iri(&shacl_validation_vocab::SHT_DATA_GRAPH), - ) - .unwrap() - .into_iter() - .next() - .unwrap(); - - let shapes_graph_iri = self - .store - .objects_for_subject_predicate( - &subject, - &RdfData::iri_s2iri(&shacl_validation_vocab::SHT_SHAPES_GRAPH), - ) - .unwrap() - .into_iter() - .next() - .unwrap(); + let report = ValidationReport::parse(&self.store, results)?; - let data_graph_path = Self::format_path(data_graph_iri.to_string()); - let shapes_graph_path = Self::format_path(shapes_graph_iri.to_string()); + let subject = RdfData::term_as_subject(&action).unwrap(); - let graph = SRDFGraph::from_path( - data_graph_path, - &RDFFormat::Turtle, - Some(&self.base), - &ReaderMode::default(), - ) + let data_graph_iri = self + .store + .objects_for_subject_predicate( + &subject, + &RdfData::iri_s2iri(&shacl_validation_vocab::SHT_DATA_GRAPH), + )? + .into_iter() + .next() .unwrap(); - let data_graph = RdfData::from_graph(graph).unwrap(); - - let rdf = SRDFGraph::from_reader( - BufReader::new(File::open(shapes_graph_path).unwrap()), - &RDFFormat::Turtle, - Some(&self.base), - &ReaderMode::default(), - ) + + let shapes_graph_iri = self + .store + .objects_for_subject_predicate( + &subject, + &RdfData::iri_s2iri(&shacl_validation_vocab::SHT_SHAPES_GRAPH), + )? + .into_iter() + .next() .unwrap(); - let shapes_graph = ShaclParser::new(rdf).parse().unwrap(); - - ShaclTest::new( - data_graph, - shapes_graph, - Some(self.base.clone()), - report, - Some(label.to_string()), - ) - }) - .collect() + + let data_graph_path = Self::format_path(data_graph_iri.to_string()); + let shapes_graph_path = Self::format_path(shapes_graph_iri.to_string()); + + let graph = SRDFGraph::from_path( + data_graph_path, + &RDFFormat::Turtle, + Some(&self.base), + &ReaderMode::default(), + )?; + let data_graph = RdfData::from_graph(graph)?; + + let rdf = SRDFGraph::from_reader( + BufReader::new(File::open(shapes_graph_path)?), + &RDFFormat::Turtle, + Some(&self.base), + &ReaderMode::default(), + )?; + let shapes_graph = ShaclParser::new(rdf).parse()?; + + entries.push(ShaclTest::new(data_graph, shapes_graph, report)); + } + + Ok(entries) } fn format_path(term: String) -> String { @@ -232,13 +201,37 @@ impl Manifest { } } -fn test(path: String, mode: ShaclValidationMode, slurp: bool) { - let manifest = Manifest::new(Path::new(&path)); - let tests = manifest.collect_tests(); +fn test(path: String, mode: ShaclValidationMode, slurp: bool) -> Result<(), TestSuite> { + let manifest = Manifest::new(Path::new(&path))?; + let tests = manifest.collect_tests()?; for test in tests { let validator = ShaclProcessor::new(test.data, mode, slurp); - let report = validator.validate(&test.shapes.try_into().unwrap()); - assert_eq!(report.unwrap(), test.report) + let report = validator.validate(&test.shapes.try_into()?)?; + if report != test.report { + return Err(TestSuite::NotEquals); + } } + + Ok(()) +} + +#[derive(Error, Debug)] +pub enum TestSuite { + #[error(transparent)] + GraphCreation(#[from] SRDFGraphError), + #[error(transparent)] + ReportParsing(#[from] ReportError), + #[error(transparent)] + InputOutput(#[from] Error), + #[error(transparent)] + RdfData(#[from] RdfDataError), + #[error(transparent)] + CompilingShapes(#[from] CompiledShaclError), + #[error(transparent)] + Validation(#[from] ValidateError), + #[error(transparent)] + ParsingShape(#[from] ShaclParserError), + #[error("The actual and expected ValidationReports are not equals")] + NotEquals, }