Demonstrate and use numeric literals in calc args
This commit is contained in:
@@ -92,7 +92,7 @@ from <tt>const</tt> links.</li>
|
||||
|
||||
<pre>
|
||||
field(INP, {calc:{expr:"A+B+1",
|
||||
args:[{const:5}, # A
|
||||
args:[5, # A
|
||||
{const:6}] # B
|
||||
}})
|
||||
</pre>
|
||||
|
||||
@@ -19,7 +19,7 @@ record(stringout, "rec:link2") {
|
||||
record(ai, "rec:j1") {
|
||||
field(INP, {calc:{
|
||||
expr:"A+5",
|
||||
args:{const:5}
|
||||
args:5
|
||||
}})
|
||||
field(PINI, "YES")
|
||||
}
|
||||
|
||||
@@ -73,10 +73,14 @@ static void testRetargetJLink(void)
|
||||
testDiag("In testRetargetJLink");
|
||||
|
||||
testdbGetFieldEqual("rec:j1", DBF_DOUBLE, 10.0);
|
||||
/* without [] */
|
||||
testLongStrEq("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":{\"const\":5}}}");
|
||||
/* minimal args */
|
||||
testLongStrEq("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":5}}");
|
||||
|
||||
/* with [] */
|
||||
testPutLongStr("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":[7]}}");
|
||||
testdbPutFieldOk("rec:j1.PROC", DBF_LONG, 1);
|
||||
|
||||
/* with const */
|
||||
testPutLongStr("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":[{\"const\":7}]}}");
|
||||
testdbPutFieldOk("rec:j1.PROC", DBF_LONG, 1);
|
||||
|
||||
@@ -86,7 +90,7 @@ static void testRetargetJLink(void)
|
||||
|
||||
MAIN(linkRetargetLinkTest)
|
||||
{
|
||||
testPlan(16);
|
||||
testPlan(18);
|
||||
|
||||
testdbPrepare();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user