From eb5a43ed439e589c91026aec3144669ad8ecac48 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 12 Jan 2017 20:45:11 -0500 Subject: [PATCH] in prog --- pdbApp/pvalink.h | 1 + testApp/testpdb.cpp | 3 ++- testApp/testpvalink.cpp | 17 ++++++++++++++++- testApp/testpvalink.db | 10 ++++++++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/pdbApp/pvalink.h b/pdbApp/pvalink.h index ee7d0eb..b52a001 100644 --- a/pdbApp/pvalink.h +++ b/pdbApp/pvalink.h @@ -222,6 +222,7 @@ struct pvaLink : public jlink if(this->name.empty()) throw std::logic_error("open() w/o target PV name"); this->name = name; + //TODO: how to distinguish "record.FLD" from pva "channel.subfield"? size_t dot = this->name.find_first_of('.'); if(dot!=this->name.npos) { field = this->name.substr(dot+1); diff --git a/testApp/testpdb.cpp b/testApp/testpdb.cpp index 911b6ea..6b6f48e 100644 --- a/testApp/testpdb.cpp +++ b/testApp/testpdb.cpp @@ -431,7 +431,7 @@ void p2pTestIoc_registerRecordDeviceDriver(struct dbBase *); MAIN(testpdb) { - testPlan(137); + testPlan(138); try{ TestIOC IOC; @@ -457,6 +457,7 @@ MAIN(testpdb) throw; } prov->destroy(); + testOk1(prov.unique()); prov.reset(); testDiag("check to see that all dbChannel are closed before IOC shuts down"); diff --git a/testApp/testpvalink.cpp b/testApp/testpvalink.cpp index 3558cd7..68b7bd1 100644 --- a/testApp/testpvalink.cpp +++ b/testApp/testpvalink.cpp @@ -9,6 +9,8 @@ namespace { void testGet() { + testDiag("==== testGet ===="); + testdbGetFieldEqual("target:li.VAL", DBF_LONG, 42); testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 0); testdbGetFieldEqual("src:li1.INP", DBF_STRING, "{\"pva\":\"target:li\"}"); @@ -19,7 +21,6 @@ void testGet() testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 42); - //TODO: how to distinguish "record.FLD" from pva "channel.subfield"? testdbPutFieldOk("src:li1.INP", DBF_STRING, "{\"pva\":\"target:ai\"}"); testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 42); @@ -33,6 +34,19 @@ void testGet() testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 4); } +void testPut() +{ + testDiag("==== testPut ===="); + testdbGetFieldEqual("target:li2.VAL", DBF_LONG, 43); + testdbGetFieldEqual("src:li2.VAL", DBF_LONG, 0); + testdbGetFieldEqual("src:li2.INP", DBF_STRING, "{\"pva\":\"target:l2\"}"); + + testdbPutFieldOk("src:li2.VAL", DBF_LONG, 14); + + testdbGetFieldEqual("target:li2.VAL", DBF_LONG, 14); + testdbGetFieldEqual("src:li2.VAL", DBF_LONG, 14); +} + } // namespace extern "C" @@ -55,6 +69,7 @@ MAIN(testpvalink) IOC.init(); testGet(); + testPut(); IOC.shutdown(); }catch(std::exception& e){ diff --git a/testApp/testpvalink.db b/testApp/testpvalink.db index e73bb14..1af9832 100644 --- a/testApp/testpvalink.db +++ b/testApp/testpvalink.db @@ -1,4 +1,5 @@ +# used by testGet() record(longin, "target:li") { field(VAL, "42") } @@ -10,6 +11,11 @@ record(longin, "src:li1") { field(INP, {pva:"target:li"}) } -record(longin, "src:li2") { - field(INP, {pva:"target:ai CP"}) +# used by testPut() +record(longin, "target:li2") { + field(VAL, "43") +} + +record(longout, "src:li2") { + field(OUT, {pva:"target:li"}) }