Fix bug in NTUtils::is_a

Previous implementation matches <type-name>:1x.0 and <type-name>:1.0,
depending on the order of the arguments, e.g.
NTUtils::is_a("epics:nt/NTTable:11.0", "epics:nt/NTTable:1.0") returned
true. Fix this and add unit tests to cover this.
This commit is contained in:
Dave Hickin
2015-09-04 09:39:27 +01:00
parent 16b46448c0
commit a0a19bcfd9
2 changed files with 11 additions and 6 deletions

View File

@ -24,11 +24,13 @@ void test_is_a()
testOk1(!NTUtils::is_a("epics:nt/NTTable:1.0", "epics:nt/NTTable:2.0"));
testOk1(!NTUtils::is_a("epics:nt/NTTable:2.0", "epics:nt/NTTable:1.0"));
testOk1(!NTUtils::is_a("epics:nt/NTTable:1.3", "epics:nt/NTTable:2.3"));
testOk1(!NTUtils::is_a("epics:nt/NTTable:1.0", "epics:nt/NTTable:11.0"));
testOk1(!NTUtils::is_a("epics:nt/NTTable:11.0", "epics:nt/NTTable:1.0"));
testOk1(!NTUtils::is_a("epics:nt/NTTable:1.0", "epics:nt/NTMatrix:1.0"));
}
MAIN(testNTUtils) {
testPlan(8);
testPlan(10);
test_is_a();
return testDone();
}