diff --git a/src/sbml/packages/distrib/validator/test/TestDistribConsistencyValidator.cpp b/src/sbml/packages/distrib/validator/test/TestDistribConsistencyValidator.cpp index 1a5ac6f17..9318dc428 100644 --- a/src/sbml/packages/distrib/validator/test/TestDistribConsistencyValidator.cpp +++ b/src/sbml/packages/distrib/validator/test/TestDistribConsistencyValidator.cpp @@ -44,6 +44,7 @@ #include #include +#include #ifdef LIBSBML_USE_VLD #include @@ -85,6 +86,21 @@ runIdTest (const TestFile& file) TestValidator tester(validator); + validator.init(); + + return tester.test(file); +} +/** + * @return true if the Validator behaved as expected when validating + * TestFile, false otherwise. + */ +bool +runUnitTest (const TestFile& file) +{ + UnitConsistencyValidator validator; + TestValidator tester(validator); + + validator.init(); return tester.test(file); @@ -164,9 +180,14 @@ main (int argc, char* argv[]) failed += runTests( "Testing General XML Consistency Constraints (20000 - 29999)", testThisDataDir, 0, 0, runMainTest, library); - testThisDataDir = testDataDir + "/" + "identifier-constraints"; - failed += runTests( "Testing Id Consistency Constraints (10300 - 10399)", - testThisDataDir, 0, 0, runIdTest, library); + // commented out as we don't actually have any of these tests + //testThisDataDir = testDataDir + "/" + "identifier-constraints"; + //failed += runTests( "Testing Id Consistency Constraints (10300 - 10399)", + // testThisDataDir, 0, 0, runIdTest, library); + + testThisDataDir = testDataDir + "/" + "unit-constraints"; + failed += runTests("Testing Unit Consistency Constraints (10500 - 10599)", + testThisDataDir, 0, 0, runUnitTest, library); return failed; } diff --git a/src/sbml/packages/distrib/validator/test/TestFile.cpp b/src/sbml/packages/distrib/validator/test/TestFile.cpp index ae92c67cc..bae51daf3 100644 --- a/src/sbml/packages/distrib/validator/test/TestFile.cpp +++ b/src/sbml/packages/distrib/validator/test/TestFile.cpp @@ -94,8 +94,13 @@ TestFile::getFullname () const unsigned int TestFile::getConstraintId () const -{ - return atol( mFilename.substr(0, 7).c_str() ); +{ + unsigned int constraint = atol( mFilename.substr(0, 7).c_str() ); + if (constraint > 1510500 && constraint < 1510599) + { + constraint = constraint - 1500000; + } + return constraint; } diff --git a/src/sbml/packages/distrib/validator/test/test-data/unit-constraints/1510523-fail-01-01.xml b/src/sbml/packages/distrib/validator/test/test-data/unit-constraints/1510523-fail-01-01.xml new file mode 100644 index 000000000..253d90f02 --- /dev/null +++ b/src/sbml/packages/distrib/validator/test/test-data/unit-constraints/1510523-fail-01-01.xml @@ -0,0 +1,102 @@ + + + + +

Created with https://github.com/matthiaskoenig/sbmlutils. + + DOI

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + uniform + 0 + 1 + + + + + +
diff --git a/src/sbml/packages/distrib/validator/test/test-data/unit-constraints/spt_random.xml b/src/sbml/packages/distrib/validator/test/test-data/unit-constraints/1510523-pass-00-01.xml similarity index 100% rename from src/sbml/packages/distrib/validator/test/test-data/unit-constraints/spt_random.xml rename to src/sbml/packages/distrib/validator/test/test-data/unit-constraints/1510523-pass-00-01.xml