From 1cad1c5ba6b91bd172d2b9b36ea03cc60a25643b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 29 Apr 2017 20:43:54 -0500 Subject: [PATCH] Demonstrate and use numeric literals in calc args --- documentation/RELEASE_NOTES.html | 2 +- src/std/rec/test/linkRetargetLink.db | 2 +- src/std/rec/test/linkRetargetLinkTest.c | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 48f48c64e..20287ed4f 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -92,7 +92,7 @@ from const links.
   field(INP, {calc:{expr:"A+B+1",
-                    args:[{const:5}, # A
+                    args:[5,         # A
                           {const:6}] # B
              }})
 
diff --git a/src/std/rec/test/linkRetargetLink.db b/src/std/rec/test/linkRetargetLink.db index 16d033e44..148e2d50b 100644 --- a/src/std/rec/test/linkRetargetLink.db +++ b/src/std/rec/test/linkRetargetLink.db @@ -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") } diff --git a/src/std/rec/test/linkRetargetLinkTest.c b/src/std/rec/test/linkRetargetLinkTest.c index 8000419d6..2a37696aa 100644 --- a/src/std/rec/test/linkRetargetLinkTest.c +++ b/src/std/rec/test/linkRetargetLinkTest.c @@ -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();