You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something new and hinky is happening in the validator ... here's a test to show you what I mean:
The test fails because the units defined inside the parsed model aren't being found when checking the variables inside the manually-created component, giving the message:
Description: Variable 't' has a units reference 'millisecond' that does not correspond with a standard units and is not a units defined in the variable's model.
There are a couple of things here:
the error message needs to also report the name of its parent component so we can find it more easily
if we're going to stick with "units" as a singular noun, how about this for the message:
"Variable 't' in component 'whatever' has units of 'millisecond' which are neither standard nor defined within its model." (just to avoid the awkward "a units" sentences!)
but the main thing is ...
the error shouldn't be happening as the units are defined in the model ... or am I missing something dumb?
TEST(Validator, unfoundUnitsInParsedModel)
{
auto parser = libcellml::Parser::create();
auto validator = libcellml::Validator::create();
std::string in = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<model xmlns=\"http:https://www.cellml.org/cellml/2.0#\" name=\"error_in_units\">"
" <units name=\"millisecond\">"
" <unit prefix=\"milli\" units=\"second\"/>"
" </units>"
" <component name=\"IonChannel\">"
" <variable name=\"t\" units=\"millisecond\"/>"
" </component>"
"</model>";
auto model = parser->parseModel(in);
validator->validateModel(model);
EXPECT_EQ(size_t(0), validator->errorCount()); // <<< this is fine!
// Add a component to represent the voltage dependency of the n-gate
auto nGate = libcellml::Component::create("nGate");
model->addComponent(nGate);
auto t2 = libcellml::Variable::create("t2");
t2->setUnits("millisecond");
nGate->addVariable(t2);
validator->validateModel(model);
EXPECT_EQ(size_t(0), validator->errorCount()); // <<< test fails!
}
The text was updated successfully, but these errors were encountered:
Something new and hinky is happening in the validator ... here's a test to show you what I mean:
The test fails because the units defined inside the parsed model aren't being found when checking the variables inside the manually-created component, giving the message:
Description: Variable 't' has a units reference 'millisecond' that does not correspond with a standard units and is not a units defined in the variable's model.
There are a couple of things here:
"Variable 't' in component 'whatever' has units of 'millisecond' which are neither standard nor defined within its model." (just to avoid the awkward "a units" sentences!)
but the main thing is ...
The text was updated successfully, but these errors were encountered: