Modify database tests to use JSON5
(except for the tests that check parsing). Remove escaped double-quotes in map keys where possible. Replace escaped double-quotes with single quotes.
This commit is contained in:
@@ -612,7 +612,7 @@ MAIN(chfPluginTest)
|
||||
/* tag i */
|
||||
e1 = e_alloc; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"alloc-fail\":{\"i\":1}}")),
|
||||
"x.{'alloc-fail':{i:1}}")),
|
||||
"create channel for alloc-fail: allocPvt returning NULL");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
@@ -627,7 +627,7 @@ MAIN(chfPluginTest)
|
||||
/* tag D (t and d) and f */
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"strict-tagged\":{\"D\":1.2e15,\"f\":false}}")),
|
||||
"x.{'strict-tagged':{D:1.2e15,f:false}}")),
|
||||
"create channel for strict-tagged parsing: D (t and d) and f");
|
||||
testOk(checkValues(puser1, 3, 12, 0, 1.2e15, "hello", 0, 4),
|
||||
"guards intact, values correct");
|
||||
@@ -641,7 +641,7 @@ MAIN(chfPluginTest)
|
||||
/* tag D2 (t and d) and f */
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"strict-tagged\":{\"D2\":1.2e15,\"f\":false}}")),
|
||||
"x.{'strict-tagged':{D2:1.2e15,f:false}}")),
|
||||
"create channel for strict-tagged parsing: D2 (t and d) and f");
|
||||
testOk(checkValues(puser1, 4, 12, 0, 1.2e15, "hello", 0, 4),
|
||||
"guards intact, values correct");
|
||||
@@ -655,7 +655,7 @@ MAIN(chfPluginTest)
|
||||
/* tag F: (t and f), d missing) */
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"strict-tagged\":{\"F\":false}}")),
|
||||
"x.{'strict-tagged':{F:false}}")),
|
||||
"create channel for strict-tagged parsing: F (t and f), d missing");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
@@ -663,7 +663,7 @@ MAIN(chfPluginTest)
|
||||
/* tag I: (t and i) and f, d missing) */
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"strict-tagged\":{\"I\":1,\"f\":false}}")),
|
||||
"x.{'strict-tagged':{I:1,f:false}}")),
|
||||
"create channel for strict-tagged parsing: I (t and i) and f, d missing");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
@@ -676,7 +676,7 @@ MAIN(chfPluginTest)
|
||||
/* tag i */
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"sloppy-tagged\":{\"I\":1}}")),
|
||||
"x.{'sloppy-tagged':{I:1}}")),
|
||||
"create channel for sloppy-tagged parsing: I");
|
||||
testOk(checkValues(puser1, 1, 1, 1, 1.234e5, "hello", 0, 4),
|
||||
"guards intact, values correct");
|
||||
@@ -690,7 +690,7 @@ MAIN(chfPluginTest)
|
||||
/* tag f */
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"sloppy-tagged\":{\"F\":false}}")),
|
||||
"x.{'sloppy-tagged':{F:false}}")),
|
||||
"create channel for sloppy-tagged parsing: F");
|
||||
testOk(checkValues(puser1, 2, 12, 0, 1.234e5, "hello", 0, 4),
|
||||
"guards intact, values correct");
|
||||
@@ -704,7 +704,7 @@ MAIN(chfPluginTest)
|
||||
/* tag d */
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"sloppy-tagged\":{\"D\":1.2e15}}")),
|
||||
"x.{'sloppy-tagged':{D:1.2e15}}")),
|
||||
"create channel for sloppy-tagged parsing: D");
|
||||
testOk(checkValues(puser1, 3, 12, 1, 1.2e15, "hello", 0, 4),
|
||||
"guards intact, values correct");
|
||||
@@ -718,7 +718,7 @@ MAIN(chfPluginTest)
|
||||
/* tag s */
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"sloppy-tagged\":{\"S\":\"bar\"}}")),
|
||||
"x.{'sloppy-tagged':{S:'bar'}}")),
|
||||
"create channel for sloppy-tagged parsing: S");
|
||||
testOk(checkValues(puser1, 4, 12, 1, 1.234e5, "bar", 0, 4),
|
||||
"guards intact, values correct");
|
||||
@@ -732,7 +732,7 @@ MAIN(chfPluginTest)
|
||||
/* tag c */
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"sloppy-tagged\":{\"C\":\"R\"}}")),
|
||||
"x.{'sloppy-tagged':{C:'R'}}")),
|
||||
"create channel for sloppy-tagged parsing: C");
|
||||
testOk(checkValues(puser1, 5, 12, 1, 1.234e5, "hello", 0, 1),
|
||||
"guards intact, values correct");
|
||||
@@ -749,7 +749,7 @@ MAIN(chfPluginTest)
|
||||
/* All perfect */
|
||||
testHead("STRICT parsing: all ok");
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate("x.{\"strict\":{\"i\":1,\"f\":false,\"d\":1.2e15,\"s\":\"bar\",\"c\":\"R\"}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.{strict:{i:1,f:false,d:1.2e15,s:'bar',c:'R'}}")),
|
||||
"create channel for strict parsing: JSON correct");
|
||||
testOk(checkValues(puser1, 99, 1, 0, 1.2e15, "bar", 0, 1),
|
||||
"guards intact, values correct");
|
||||
@@ -765,35 +765,35 @@ MAIN(chfPluginTest)
|
||||
testHead("STRICT parsing: any missing parameter must fail");
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"strict\":{\"i\":1,\"f\":false,\"d\":1.2e15,\"s\":\"bar\"}}")),
|
||||
"x.{strict:{i:1,f:false,d:1.2e15,s:'bar'}}")),
|
||||
"create channel for strict parsing: c missing");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
testDiag("expected %#x - called %#x", e1, c1);
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"strict\":{\"f\":false,\"i\":1,\"d\":1.2e15,\"c\":\"R\"}}")),
|
||||
"x.{strict:{f:false,i:1,d:1.2e15,c:'R'}}")),
|
||||
"create channel for strict parsing: s missing");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
testDiag("expected %#x - called %#x", e1, c1);
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"strict\":{\"i\":1,\"c\":\"R\",\"f\":false,\"s\":\"bar\"}}")),
|
||||
"x.{strict:{i:1,c:'R',f:false,s:'bar'}}")),
|
||||
"create channel for strict parsing: d missing");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
testDiag("expected %#x - called %#x", e1, c1);
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"strict\":{\"d\":1.2e15,\"c\":\"R\",\"i\":1,\"s\":\"bar\"}}")),
|
||||
"x.{strict:{d:1.2e15,c:'R',i:1,s:'bar'}}")),
|
||||
"create channel for strict parsing: f missing");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
testDiag("expected %#x - called %#x", e1, c1);
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0;
|
||||
testOk(!(pch = dbChannelCreate(
|
||||
"x.{\"strict\":{\"c\":\"R\",\"s\":\"bar\",\"f\":false,\"d\":1.2e15}}")),
|
||||
"x.{strict:{c:'R',s:'bar',f:false,d:1.2e15}}")),
|
||||
"create channel for strict parsing: i missing");
|
||||
testOk(!puser1, "user part cleaned up");
|
||||
if (!testOk(c1 == e1, "all expected calls happened"))
|
||||
@@ -805,7 +805,7 @@ MAIN(chfPluginTest)
|
||||
testHead("NOCONV parsing: missing parameters get default value");
|
||||
e1 = e_alloc | e_ok; c1 = 0;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"noconv\":{\"i\":1,\"f\":false,\"d\":1.2e15,\"s\":\"bar\"}}")),
|
||||
"x.{noconv:{i:1,f:false,d:1.2e15,s:'bar'}}")),
|
||||
"create channel for noconv parsing: c missing");
|
||||
testOk(checkValues(puser1, 99, 1, 0, 1.2e15, "bar", 0, 4),
|
||||
"guards intact, values correct");
|
||||
@@ -819,28 +819,28 @@ MAIN(chfPluginTest)
|
||||
|
||||
e1 = e_any;
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"noconv\":{\"i\":1,\"f\":false,\"d\":1.2e15,\"c\":\"R\"}}")),
|
||||
"x.{noconv:{i:1,f:false,d:1.2e15,c:'R'}}")),
|
||||
"create channel for noconv parsing: s missing");
|
||||
testOk(checkValues(puser1, 99, 1, 0, 1.2e15, "hello", 0, 1),
|
||||
"guards intact, values correct");
|
||||
if (pch) dbChannelDelete(pch);
|
||||
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"noconv\":{\"i\":1,\"f\":false,\"s\":\"bar\",\"c\":\"R\"}}")),
|
||||
"x.{noconv:{i:1,f:false,s:'bar',c:'R'}}")),
|
||||
"create channel for noconv parsing: d missing");
|
||||
testOk(checkValues(puser1, 99, 1, 0, 1.234e5, "bar", 0, 1),
|
||||
"guards intact, values correct");
|
||||
if (pch) dbChannelDelete(pch);
|
||||
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"noconv\":{\"i\":1,\"d\":1.2e15,\"s\":\"bar\",\"c\":\"R\"}}")),
|
||||
"x.{noconv:{i:1,d:1.2e15,s:'bar',c:'R'}}")),
|
||||
"create channel for noconv parsing: f missing");
|
||||
testOk(checkValues(puser1, 99, 1, 1, 1.2e15, "bar", 0, 1),
|
||||
"guards intact, values correct");
|
||||
if (pch) dbChannelDelete(pch);
|
||||
|
||||
testOk(!!(pch = dbChannelCreate(
|
||||
"x.{\"noconv\":{\"f\":false,\"d\":1.2e15,\"s\":\"bar\",\"c\":\"R\"}}")),
|
||||
"x.{noconv:{f:false,d:1.2e15,s:'bar',c:'R'}}")),
|
||||
"create channel for noconv parsing: i missing");
|
||||
testOk(checkValues(puser1, 99, 12, 0, 1.2e15, "bar", 0, 1),
|
||||
"guards intact, values correct");
|
||||
@@ -849,7 +849,7 @@ MAIN(chfPluginTest)
|
||||
/* Reject wrong types */
|
||||
#define WRONGTYPETEST(Var, Val, Typ) \
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0; \
|
||||
testOk(!(pch = dbChannelCreate("x.{\"noconv\":{\""#Var"\":"#Val"}}")), \
|
||||
testOk(!(pch = dbChannelCreate("x.{noconv:{'"#Var"':"#Val"}}")), \
|
||||
"create channel for noconv parsing: wrong type "#Typ" for "#Var); \
|
||||
testOk(!puser1, "user part cleaned up"); \
|
||||
if (!testOk(c1 == e1, "all expected calls happened")) \
|
||||
@@ -877,8 +877,8 @@ MAIN(chfPluginTest)
|
||||
|
||||
#define CONVTESTGOOD(Var, Val, Typ, Ival, Fval, Dval, Sval1, Sval2, Cval) \
|
||||
e1 = e_alloc | e_ok; c1 = 0; \
|
||||
testDiag("Calling dbChannelCreate x.{\"sloppy\":{\""#Var"\":"#Val"}}"); \
|
||||
testOk(!!(pch = dbChannelCreate("x.{\"sloppy\":{\""#Var"\":"#Val"}}")), \
|
||||
testDiag("Calling dbChannelCreate x.{sloppy:{"#Var":"#Val"}}"); \
|
||||
testOk(!!(pch = dbChannelCreate("x.{sloppy:{"#Var":"#Val"}}")), \
|
||||
"create channel for sloppy parsing: "#Typ" (good) for "#Var); \
|
||||
testOk(checkValues(puser1, 99, Ival, Fval, Dval, Sval1, Sval2, Cval), \
|
||||
"guards intact, values correct"); \
|
||||
@@ -892,8 +892,8 @@ MAIN(chfPluginTest)
|
||||
|
||||
#define CONVTESTBAD(Var, Val, Typ) \
|
||||
e1 = e_alloc | e_error | e_free; c1 = 0; \
|
||||
testDiag("Calling dbChannelCreate x.{\"sloppy\":{\""#Var"\":"#Val"}}"); \
|
||||
testOk(!(pch = dbChannelCreate("x.{\"sloppy\":{\""#Var"\":"#Val"}}")), \
|
||||
testDiag("Calling dbChannelCreate x.{sloppy:{"#Var":"#Val"}}"); \
|
||||
testOk(!(pch = dbChannelCreate("x.{sloppy:{"#Var":"#Val"}}")), \
|
||||
"create channel for sloppy parsing: "#Typ" (bad) for "#Var); \
|
||||
testOk(!puser1, "user part cleaned up"); \
|
||||
if (!testOk(c1 == e1, "create channel: all expected calls happened")) \
|
||||
@@ -1018,36 +1018,36 @@ MAIN(chfPluginTest)
|
||||
if (!testOk(c1 == e1, "delete channel (1): all expected calls happened")) testDiag("expected %#x - called %#x", e1, c1); \
|
||||
if (!testOk(c2 == e2, "delete channel (2): all expected calls happened")) testDiag("expected %#x - called %#x", e2, c2);
|
||||
|
||||
CHAINTEST1("1 pre", "{\"pre\":{}}", e_reg_pre, e_pre | e_dtor, 1); /* One filter, pre chain */
|
||||
CHAINTEST1("1 post", "{\"post\":{}}", e_reg_post, e_post | e_dtor, 1); /* One filter, post chain */
|
||||
CHAINTEST1("1 both", "{\"sloppy\":{}}", e_reg_pre | e_reg_post, e_pre | e_post | e_dtor, 2); /* One, both chains */
|
||||
CHAINTEST2("2 pre", "{\"pre\":{},\"pre\":{}}", e_reg_pre, e_pre | e_dtor, e_reg_pre, e_pre, 2); /* Two filters, pre chain */
|
||||
CHAINTEST2("2 post", "{\"post\":{},\"post\":{}}", e_reg_post, e_post | e_dtor, e_reg_post, e_post, 2); /* Two filters, post chain */
|
||||
CHAINTEST2("2 both", "{\"sloppy\":{},\"sloppy\":{}}", /* Two, both chains */
|
||||
CHAINTEST1("1 pre", "{pre:{}}", e_reg_pre, e_pre | e_dtor, 1); /* One filter, pre chain */
|
||||
CHAINTEST1("1 post", "{post:{}}", e_reg_post, e_post | e_dtor, 1); /* One filter, post chain */
|
||||
CHAINTEST1("1 both", "{sloppy:{}}", e_reg_pre | e_reg_post, e_pre | e_post | e_dtor, 2); /* One, both chains */
|
||||
CHAINTEST2("2 pre", "{pre:{},pre:{}}", e_reg_pre, e_pre | e_dtor, e_reg_pre, e_pre, 2); /* Two filters, pre chain */
|
||||
CHAINTEST2("2 post", "{post:{},post:{}}", e_reg_post, e_post | e_dtor, e_reg_post, e_post, 2); /* Two filters, post chain */
|
||||
CHAINTEST2("2 both", "{sloppy:{},sloppy:{}}", /* Two, both chains */
|
||||
e_reg_pre | e_reg_post, e_pre | e_post | e_dtor, e_reg_pre | e_reg_post, e_pre | e_post, 4);
|
||||
CHAINTEST2("1 pre, 1 post", "{\"pre\":{},\"post\":{}}", e_reg_pre, e_pre | e_dtor, e_reg_post, e_post, 2); /* Two, pre then post */
|
||||
CHAINTEST2("1 post, 1 pre", "{\"post\":{},\"pre\":{}}", e_reg_post, e_post, e_reg_pre, e_pre | e_dtor, 2); /* Two, post then pre */
|
||||
CHAINTEST2("1 pre, 1 both", "{\"pre\":{},\"sloppy\":{}}", /* Two, pre then both */
|
||||
CHAINTEST2("1 pre, 1 post", "{pre:{},post:{}}", e_reg_pre, e_pre | e_dtor, e_reg_post, e_post, 2); /* Two, pre then post */
|
||||
CHAINTEST2("1 post, 1 pre", "{post:{},pre:{}}", e_reg_post, e_post, e_reg_pre, e_pre | e_dtor, 2); /* Two, post then pre */
|
||||
CHAINTEST2("1 pre, 1 both", "{pre:{},sloppy:{}}", /* Two, pre then both */
|
||||
e_reg_pre, e_pre | e_dtor, e_reg_pre | e_reg_post, e_pre | e_post, 3);
|
||||
CHAINTEST2("1 both, 1 pre", "{\"sloppy\":{},\"pre\":{}}", /* Two, both then pre */
|
||||
CHAINTEST2("1 both, 1 pre", "{sloppy:{},pre:{}}", /* Two, both then pre */
|
||||
e_reg_pre | e_reg_post, e_pre | e_post | e_dtor, e_reg_pre, e_pre, 3);
|
||||
CHAINTEST2("1 post, 1 both", "{\"post\":{},\"sloppy\":{}}", /* Two, post then both */
|
||||
CHAINTEST2("1 post, 1 both", "{post:{},sloppy:{}}", /* Two, post then both */
|
||||
e_reg_post, e_post, e_reg_pre | e_reg_post, e_pre | e_post | e_dtor, 3);
|
||||
CHAINTEST2("1 both, 1 post", "{\"sloppy\":{},\"post\":{}}", /* Two, both then post */
|
||||
CHAINTEST2("1 both, 1 post", "{sloppy:{},post:{}}", /* Two, both then post */
|
||||
e_reg_pre | e_reg_post, e_pre | e_post | e_dtor, e_reg_post, e_post, 3);
|
||||
|
||||
/* Plugins dropping updates */
|
||||
drop = 0;
|
||||
CHAINTEST2("2 both (drop at 0)", "{\"sloppy\":{},\"sloppy\":{}}", /* Two, both chains, drop at filter 0 */
|
||||
CHAINTEST2("2 both (drop at 0)", "{sloppy:{},sloppy:{}}", /* Two, both chains, drop at filter 0 */
|
||||
e_reg_pre | e_reg_post, e_pre, e_reg_pre | e_reg_post, 0, -1);
|
||||
drop = 1;
|
||||
CHAINTEST2("2 both (drop at 1)", "{\"sloppy\":{},\"sloppy\":{}}", /* Two, both chains, drop at filter 1 */
|
||||
CHAINTEST2("2 both (drop at 1)", "{sloppy:{},sloppy:{}}", /* Two, both chains, drop at filter 1 */
|
||||
e_reg_pre | e_reg_post, e_pre, e_reg_pre | e_reg_post, e_pre, -1);
|
||||
drop = 2;
|
||||
CHAINTEST2("2 both (drop at 2)", "{\"sloppy\":{},\"sloppy\":{}}", /* Two, both chains, drop at filter 2 */
|
||||
CHAINTEST2("2 both (drop at 2)", "{sloppy:{},sloppy:{}}", /* Two, both chains, drop at filter 2 */
|
||||
e_reg_pre | e_reg_post, e_pre | e_post, e_reg_pre | e_reg_post, e_pre, -1);
|
||||
drop = 3;
|
||||
CHAINTEST2("2 both (drop at 3)", "{\"sloppy\":{},\"sloppy\":{}}", /* Two, both chains, drop at filter 3 */
|
||||
CHAINTEST2("2 both (drop at 3)", "{sloppy:{},sloppy:{}}", /* Two, both chains, drop at filter 3 */
|
||||
e_reg_pre | e_reg_post, e_pre | e_post, e_reg_pre | e_reg_post, e_pre | e_post, -1);
|
||||
drop = -1;
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
/* dbChannelTest() allows but ignores field modifiers */
|
||||
testOk1(!dbChannelTest("x.NAME$"));
|
||||
testOk1(!dbChannelTest("x.{}"));
|
||||
testOk1(!dbChannelTest("x.VAL{\"json\":true}"));
|
||||
testOk1(!dbChannelTest("x.VAL{json:true}"));
|
||||
|
||||
/* dbChannelCreate() accepts field modifiers */
|
||||
testOk1(!!(pch = dbChannelCreate("x.{}")));
|
||||
@@ -212,34 +212,34 @@ MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
testOk(!dbChannelCreate("x.NOFIELD"), "Create, bad field");
|
||||
testOk(!dbChannelCreate("x.{not-json}"), "Create, bad JSON");
|
||||
eltc(0);
|
||||
testOk(!dbChannelCreate("x.{\"none\":null}"), "Create, bad filter");
|
||||
testOk(!dbChannelCreate("x.{none:null}"), "Create, bad filter");
|
||||
eltc(1);
|
||||
|
||||
dbRegisterFilter("any", &testIf, NULL);
|
||||
|
||||
/* Parser event rejection by filter */
|
||||
e = e_start;
|
||||
testOk1(!dbChannelCreate("x.{\"any\":null}"));
|
||||
testOk1(!dbChannelCreate("x.{any:null}"));
|
||||
|
||||
r = e_start;
|
||||
e = e_start | e_null | e_abort;
|
||||
testOk1(!dbChannelCreate("x.{\"any\":null}"));
|
||||
testOk1(!dbChannelCreate("x.{any:null}"));
|
||||
|
||||
r = e_start | e_null;
|
||||
e = e_start | e_null | e_end;
|
||||
testOk1(!dbChannelCreate("x.{\"any\":null}"));
|
||||
testOk1(!dbChannelCreate("x.{any:null}"));
|
||||
|
||||
/* Successful parsing... */
|
||||
r = r_any;
|
||||
e = e_start | e_null | e_end;
|
||||
testOk1(!!(pch = dbChannelCreate("x.{\"any\":null}")));
|
||||
testOk1(!!(pch = dbChannelCreate("x.{any:null}")));
|
||||
e = e_close;
|
||||
if (pch) dbChannelDelete(pch);
|
||||
|
||||
dbRegisterFilter("scalar", &testIf, NULL);
|
||||
|
||||
e = e_start | e_null | e_end;
|
||||
testOk1(!!(pch = dbChannelCreate("x.{\"scalar\":null}")));
|
||||
testOk1(!!(pch = dbChannelCreate("x.{scalar:null}")));
|
||||
|
||||
e = e_report;
|
||||
dbChannelShow(pch, 2, 2);
|
||||
@@ -249,23 +249,23 @@ MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
|
||||
e = e_start | e_start_array | e_boolean | e_integer | e_end_array
|
||||
| e_end;
|
||||
testOk1(!!(pch = dbChannelCreate("x.{\"any\":[true,1]}")));
|
||||
testOk1(!!(pch = dbChannelCreate("x.{any:[true,1]}")));
|
||||
e = e_close;
|
||||
if (pch) dbChannelDelete(pch);
|
||||
|
||||
e = e_start | e_start_map | e_map_key | e_double | e_string | e_end_map
|
||||
| e_end;
|
||||
testOk1(!!(pch = dbChannelCreate("x.{\"any\":{\"a\":2.7183,\"b\":\"c\"}}")));
|
||||
testOk1(!!(pch = dbChannelCreate("x.{any:{a:2.7183,b:'c'}}")));
|
||||
e = e_close;
|
||||
if (pch) dbChannelDelete(pch);
|
||||
|
||||
/* More event rejection */
|
||||
r = r_scalar;
|
||||
e = e_start | e_start_array | e_abort;
|
||||
testOk1(!dbChannelCreate("x.{\"scalar\":[null]}"));
|
||||
testOk1(!dbChannelCreate("x.{scalar:[null]}"));
|
||||
|
||||
e = e_start | e_start_map | e_abort;
|
||||
testOk1(!dbChannelCreate("x.{\"scalar\":{}}"));
|
||||
testOk1(!dbChannelCreate("x.{scalar:{}}"));
|
||||
|
||||
testIocShutdownOk();
|
||||
testdbCleanup();
|
||||
|
||||
@@ -178,7 +178,7 @@ static void check(short dbr_type) {
|
||||
/* Default: should not change anything */
|
||||
|
||||
testHead("Ten %s elements from rec, increment 1, full size (default)", typname);
|
||||
createAndOpen(valname, "{\"arr\":{}}", "(default)", &pch, 1);
|
||||
createAndOpen(valname, "{arr:{}}", "(default)", &pch, 1);
|
||||
testOk(pch->final_type == valaddr.field_type,
|
||||
"final type unchanged (%d->%d)", valaddr.field_type, pch->final_type);
|
||||
testOk(pch->final_no_elements == valaddr.no_elements,
|
||||
@@ -188,7 +188,7 @@ static void check(short dbr_type) {
|
||||
dbChannelDelete(pch);
|
||||
|
||||
testHead("Ten %s elements from rec, increment 1, out-of-bound start parameter", typname);
|
||||
createAndOpen(valname, "{\"arr\":{\"s\":-500}}", "out-of-bound start", &pch, 1);
|
||||
createAndOpen(valname, "{arr:{s:-500}}", "out-of-bound start", &pch, 1);
|
||||
testOk(pch->final_type == valaddr.field_type,
|
||||
"final type unchanged (%d->%d)", valaddr.field_type, pch->final_type);
|
||||
testOk(pch->final_no_elements == valaddr.no_elements,
|
||||
@@ -197,7 +197,7 @@ static void check(short dbr_type) {
|
||||
dbChannelDelete(pch);
|
||||
|
||||
testHead("Ten %s elements from rec, increment 1, out-of-bound end parameter", typname);
|
||||
createAndOpen(valname, "{\"arr\":{\"e\":500}}", "out-of-bound end", &pch, 1);
|
||||
createAndOpen(valname, "{arr:{e:500}}", "out-of-bound end", &pch, 1);
|
||||
testOk(pch->final_type == valaddr.field_type,
|
||||
"final type unchanged (%d->%d)", valaddr.field_type, pch->final_type);
|
||||
testOk(pch->final_no_elements == valaddr.no_elements,
|
||||
@@ -206,7 +206,7 @@ static void check(short dbr_type) {
|
||||
dbChannelDelete(pch);
|
||||
|
||||
testHead("Ten %s elements from rec, increment 1, zero increment parameter", typname);
|
||||
createAndOpen(valname, "{\"arr\":{\"i\":0}}", "zero increment", &pch, 1);
|
||||
createAndOpen(valname, "{arr:{i:0}}", "zero increment", &pch, 1);
|
||||
testOk(pch->final_type == valaddr.field_type,
|
||||
"final type unchanged (%d->%d)", valaddr.field_type, pch->final_type);
|
||||
testOk(pch->final_no_elements == valaddr.no_elements,
|
||||
@@ -215,7 +215,7 @@ static void check(short dbr_type) {
|
||||
dbChannelDelete(pch);
|
||||
|
||||
testHead("Ten %s elements from rec, increment 1, invalid increment parameter", typname);
|
||||
createAndOpen(valname, "{\"arr\":{\"i\":-30}}", "invalid increment", &pch, 1);
|
||||
createAndOpen(valname, "{arr:{i:-30}}", "invalid increment", &pch, 1);
|
||||
testOk(pch->final_type == valaddr.field_type,
|
||||
"final type unchanged (%d->%d)", valaddr.field_type, pch->final_type);
|
||||
testOk(pch->final_no_elements == valaddr.no_elements,
|
||||
@@ -225,7 +225,7 @@ static void check(short dbr_type) {
|
||||
|
||||
#define TEST5(Incr, Left, Right, Type) \
|
||||
testHead("Five %s elements from rec, increment " #Incr ", " Type " addressing", typname); \
|
||||
createAndOpen(valname, "{\"arr\":{\"s\":" #Left ",\"e\":" #Right ",\"i\":" #Incr "}}", \
|
||||
createAndOpen(valname, "{arr:{s:" #Left ",e:" #Right ",i:" #Incr "}}", \
|
||||
"(" #Left ":" #Incr ":" #Right ")", &pch, 1); \
|
||||
testOk(pch->final_type == valaddr.field_type, \
|
||||
"final type unchanged (%d->%d)", valaddr.field_type, pch->final_type); \
|
||||
@@ -262,7 +262,7 @@ static void check(short dbr_type) {
|
||||
|
||||
#define TEST5B(Incr, Left, Right, Type) \
|
||||
testHead("Five %s elements from buffer, increment " #Incr ", " Type " addressing", typname); \
|
||||
createAndOpen(valname, "{\"arr\":{},\"arr\":{\"s\":" #Left ",\"e\":" #Right ",\"i\":" #Incr "}}", \
|
||||
createAndOpen(valname, "{arr:{},arr:{s:" #Left ",e:" #Right ",i:" #Incr "}}", \
|
||||
"(" #Left ":" #Incr ":" #Right ")", &pch, 2); \
|
||||
testOk(pch->final_type == valaddr.field_type, \
|
||||
"final type unchanged (%d->%d)", valaddr.field_type, pch->final_type); \
|
||||
|
||||
@@ -148,7 +148,7 @@ MAIN(dbndTest)
|
||||
|
||||
testOk(!!(plug = dbFindFilter(dbnd, strlen(dbnd))), "plugin dbnd registered correctly");
|
||||
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dbnd\":{}}")), "dbChannel with plugin dbnd (delta=0) created");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dbnd:{}}")), "dbChannel with plugin dbnd (delta=0) created");
|
||||
testOk((ellCount(&pch->filters) == 1), "channel has one plugin");
|
||||
|
||||
/* Start the free-list */
|
||||
@@ -202,7 +202,7 @@ MAIN(dbndTest)
|
||||
/* Delta = -1: pass any update */
|
||||
|
||||
testHead("Delta = -1: pass any update");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dbnd\":{\"d\":-1.0}}")), "dbChannel with plugin dbnd (delta=-1) created");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dbnd:{d:-1.0}}")), "dbChannel with plugin dbnd (delta=-1) created");
|
||||
testOk(!(dbChannelOpen(pch)), "dbChannel with plugin dbnd opened");
|
||||
|
||||
pfl2 = db_create_read_log(pch);
|
||||
@@ -220,7 +220,7 @@ MAIN(dbndTest)
|
||||
/* Delta = absolute */
|
||||
|
||||
testHead("Delta = absolute");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dbnd\":{\"d\":3}}")), "dbChannel with plugin dbnd (delta=3) created");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dbnd:{d:3}}")), "dbChannel with plugin dbnd (delta=3) created");
|
||||
testOk(!(dbChannelOpen(pch)), "dbChannel with plugin dbnd opened");
|
||||
|
||||
pfl2 = db_create_read_log(pch);
|
||||
@@ -254,7 +254,7 @@ MAIN(dbndTest)
|
||||
/* Delta = relative */
|
||||
|
||||
testHead("Delta = relative");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dbnd\":{\"m\":\"rel\",\"d\":50}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dbnd:{m:'rel',d:50}}")),
|
||||
"dbChannel with plugin dbnd (mode=rel, delta=50) created");
|
||||
testOk(!(dbChannelOpen(pch)), "dbChannel with plugin dbnd opened");
|
||||
|
||||
|
||||
@@ -149,20 +149,20 @@ MAIN(decTest)
|
||||
"plugin '%s' registered correctly", myname);
|
||||
|
||||
/* N < 1 */
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{\"dec\":{\"n\":-1}}")),
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{dec:{n:-1}}")),
|
||||
"dbChannel with dec (n=-1) failed");
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{\"dec\":{\"n\":0}}")),
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{dec:{n:0}}")),
|
||||
"dbChannel with dec (n=0) failed");
|
||||
/* Bad parms */
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{\"dec\":{}}")),
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{dec:{}}")),
|
||||
"dbChannel with dec (no parm) failed");
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{\"dec\":{\"x\":true}}")),
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{dec:{x:true}}")),
|
||||
"dbChannel with dec (x=true) failed");
|
||||
|
||||
/* No Decimation (N=1) */
|
||||
|
||||
testHead("No Decimation (n=1)");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dec\":{\"n\":1}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dec:{n:1}}")),
|
||||
"dbChannel with plugin dec (n=1) created");
|
||||
|
||||
/* Start the free-list */
|
||||
@@ -192,7 +192,7 @@ MAIN(decTest)
|
||||
/* Decimation (N=2) */
|
||||
|
||||
testHead("Decimation (n=2)");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dec\":{\"n\":2}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dec:{n:2}}")),
|
||||
"dbChannel with plugin dec (n=2) created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
@@ -222,7 +222,7 @@ MAIN(decTest)
|
||||
/* Decimation (N=3) */
|
||||
|
||||
testHead("Decimation (n=3)");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dec\":{\"n\":3}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dec:{n:3}}")),
|
||||
"dbChannel with plugin dec (n=3) created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
@@ -252,7 +252,7 @@ MAIN(decTest)
|
||||
/* Decimation (N=4) */
|
||||
|
||||
testHead("Decimation (n=4)");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"dec\":{\"n\":4}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{dec:{n:4}}")),
|
||||
"dbChannel with plugin dec (n=4) created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
|
||||
@@ -225,19 +225,19 @@ MAIN(syncTest)
|
||||
testOk(!!(red = dbStateCreate("red")), "state 'red' created successfully");
|
||||
|
||||
/* nonexisting state */
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"while\",\"s\":\"blue\"}}")),
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{sync:{m:'while',s:'blue'}}")),
|
||||
"dbChannel with sync (m='while' s='blue') (nonex state) failed");
|
||||
/* missing state */
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"while\"}}")),
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{sync:{m:'while'}}")),
|
||||
"dbChannel with sync (m='while') (no state) failed");
|
||||
/* missing mode */
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{\"sync\":{\"s\":\"red\"}}")),
|
||||
testOk(!(pch = dbChannelCreate("x.VAL{sync:{s:'red'}}")),
|
||||
"dbChannel with sync (s='red') (no mode) failed");
|
||||
|
||||
/* mode WHILE */
|
||||
|
||||
testHead("Mode WHILE (m='while', s='red')");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"while\",\"s\":\"red\"}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{sync:{m:'while',s:'red'}}")),
|
||||
"dbChannel with plugin sync (m='while' s='red') created");
|
||||
|
||||
/* Start the free-list */
|
||||
@@ -274,7 +274,7 @@ MAIN(syncTest)
|
||||
/* mode UNLESS */
|
||||
|
||||
testHead("Mode UNLESS (m='unless', s='red')");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"unless\",\"s\":\"red\"}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{sync:{m:'unless',s:'red'}}")),
|
||||
"dbChannel with plugin sync (m='unless' s='red') created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
@@ -306,7 +306,7 @@ MAIN(syncTest)
|
||||
/* mode BEFORE */
|
||||
|
||||
testHead("Mode BEFORE (m='before', s='red')");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"before\",\"s\":\"red\"}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{sync:{m:'before',s:'red'}}")),
|
||||
"dbChannel with plugin sync (m='before' s='red') created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
@@ -340,7 +340,7 @@ MAIN(syncTest)
|
||||
/* mode FIRST */
|
||||
|
||||
testHead("Mode FIRST (m='first', s='red')");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"first\",\"s\":\"red\"}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{sync:{m:'first',s:'red'}}")),
|
||||
"dbChannel with plugin sync (m='first' s='red') created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
@@ -373,7 +373,7 @@ MAIN(syncTest)
|
||||
/* mode LAST */
|
||||
|
||||
testHead("Mode LAST (m='last', s='red')");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"last\",\"s\":\"red\"}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{sync:{m:'last',s:'red'}}")),
|
||||
"dbChannel with plugin sync (m='last' s='red') created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
@@ -407,7 +407,7 @@ MAIN(syncTest)
|
||||
/* mode AFTER */
|
||||
|
||||
testHead("Mode AFTER (m='after', s='red')");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"sync\":{\"m\":\"after\",\"s\":\"red\"}}")),
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{sync:{m:'after',s:'red'}}")),
|
||||
"dbChannel with plugin sync (m='after' s='red') created");
|
||||
|
||||
checkAndOpenChannel(pch, plug);
|
||||
|
||||
@@ -74,7 +74,7 @@ MAIN(tsTest)
|
||||
|
||||
testOk(!!(plug = dbFindFilter(ts, strlen(ts))), "plugin ts registered correctly");
|
||||
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{\"ts\":{}}")), "dbChannel with plugin ts created");
|
||||
testOk(!!(pch = dbChannelCreate("x.VAL{ts:{}}")), "dbChannel with plugin ts created");
|
||||
testOk((ellCount(&pch->filters) == 1), "channel has one plugin");
|
||||
|
||||
memset(&fl, PATTERN, sizeof(fl));
|
||||
|
||||
@@ -53,9 +53,9 @@ static void testCalc()
|
||||
{
|
||||
dbStateId red;
|
||||
|
||||
testPutLongStr("io.INPUT", "{\"calc\":{"
|
||||
"\"expr\":\"a\","
|
||||
"\"args\":[{\"state\":\"red\"}]"
|
||||
testPutLongStr("io.INPUT", "{calc:{"
|
||||
"expr:'a',"
|
||||
"args:[{state:'red'}]"
|
||||
"}}");
|
||||
if (testOk1(pinp->type == JSON_LINK))
|
||||
testDiag("Link was set to '%s'", pinp->value.json.string);
|
||||
@@ -78,11 +78,11 @@ static void testCalc()
|
||||
dbStateId minor = dbStateCreate("minor");
|
||||
epicsEnum16 stat, sevr;
|
||||
|
||||
testPutLongStr("io.INPUT", "{\"calc\":{"
|
||||
"\"expr\":\"0\","
|
||||
"\"major\":\"A\","
|
||||
"\"minor\":\"B\","
|
||||
"\"args\":[{\"state\":\"major\"},{\"state\":\"minor\"}]"
|
||||
testPutLongStr("io.INPUT", "{calc:{"
|
||||
"expr:'0',"
|
||||
"major:'A',"
|
||||
"minor:'B',"
|
||||
"args:[{state:'major'},{state:'minor'}]"
|
||||
"}}");
|
||||
if (testOk1(pinp->type == JSON_LINK))
|
||||
testDiag("Link was set to '%s'", pinp->value.json.string);
|
||||
@@ -114,12 +114,12 @@ static void testCalc()
|
||||
dbStateId red = dbStateFind("red");
|
||||
dbStateId out = dbStateCreate("out");
|
||||
|
||||
testPutLongStr("io.OUTPUT", "{\"calc\":{"
|
||||
"\"expr\":\"!a\","
|
||||
"\"out\":{\"state\":\"out\"},"
|
||||
"\"args\":[{\"state\":\"red\"}],"
|
||||
"\"units\":\"things\","
|
||||
"\"prec\":3"
|
||||
testPutLongStr("io.OUTPUT", "{calc:{"
|
||||
"expr:'!a',"
|
||||
"out:{state:'out'},"
|
||||
"args:[{state:'red'}],"
|
||||
"units:'things',"
|
||||
"prec:3"
|
||||
"}}");
|
||||
if (testOk1(pout->type == JSON_LINK))
|
||||
testDiag("Link was set to '%s'", pout->value.json.string);
|
||||
|
||||
@@ -50,7 +50,7 @@ static void testState()
|
||||
red = dbStateFind("red");
|
||||
testOk(!red, "No state red exists");
|
||||
|
||||
testdbPutFieldOk("io.INPUT", DBF_STRING, "{\"state\":\"red\"}");
|
||||
testdbPutFieldOk("io.INPUT", DBF_STRING, "{state:'red'}");
|
||||
if (testOk1(pinp->type == JSON_LINK))
|
||||
testDiag("Link was set to '%s'", pinp->value.json.string);
|
||||
red = dbStateFind("red");
|
||||
@@ -64,7 +64,7 @@ static void testState()
|
||||
testOk(!status, "dbGetLink succeeded (status = %ld)", status);
|
||||
testOk(i16, "Got TRUE");
|
||||
|
||||
testdbPutFieldOk("io.INPUT", DBF_STRING, "{\"state\":\"!red\"}");
|
||||
testdbPutFieldOk("io.INPUT", DBF_STRING, "{state:'!red'}");
|
||||
if (testOk1(pinp->type == JSON_LINK))
|
||||
testDiag("Link was set to '%s'", pinp->value.json.string);
|
||||
|
||||
@@ -72,7 +72,7 @@ static void testState()
|
||||
testOk(!status, "dbGetLink succeeded (status = %ld)", status);
|
||||
testOk(!i16, "Got FALSE");
|
||||
|
||||
testdbPutFieldOk("io.OUTPUT", DBF_STRING, "{\"state\":\"red\"}");
|
||||
testdbPutFieldOk("io.OUTPUT", DBF_STRING, "{state:'red'}");
|
||||
if (testOk1(pout->type == JSON_LINK))
|
||||
testDiag("Link was set to '%s'", pout->value.json.string);
|
||||
|
||||
@@ -106,7 +106,7 @@ static void testState()
|
||||
testOk(!status, "dbPutLink %g succeeded (status = %ld)", f64, status);
|
||||
testOk(dbStateGet(red), "state was set");
|
||||
|
||||
testdbPutFieldOk("io.OUTPUT", DBF_STRING, "{\"state\":\"!red\"}");
|
||||
testdbPutFieldOk("io.OUTPUT", DBF_STRING, "{state:'!red'}");
|
||||
if (testOk1(pout->type == JSON_LINK))
|
||||
testDiag("Link was set to '%s'", pout->value.json.string);
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ MAIN(analogMonitorTest)
|
||||
for (irec = 0; irec < NO_OF_RECORD_TYPES; irec++) {
|
||||
strcpy(cval, t_Record[irec]);
|
||||
strcpy(chan, cval);
|
||||
strcat(chan, ".VAL{\"test\":{}}");
|
||||
strcat(chan, ".VAL{test:{}}");
|
||||
if ((strcmp(t_Record[irec], "sel") == 0)
|
||||
|| (strcmp(t_Record[irec], "calc") == 0)
|
||||
|| (strcmp(t_Record[irec], "calcout") == 0)) {
|
||||
|
||||
@@ -18,7 +18,7 @@ record(stringout, "rec:link2") {
|
||||
|
||||
record(ai, "rec:j1") {
|
||||
field(INP, {calc:{
|
||||
expr:"A+5",
|
||||
expr:'A+5',
|
||||
args:5
|
||||
}})
|
||||
field(PINI, "YES")
|
||||
|
||||
@@ -75,18 +75,18 @@ static void testRetargetJLink(void)
|
||||
|
||||
testdbGetFieldEqual("rec:j1", DBF_DOUBLE, 10.0);
|
||||
/* minimal args */
|
||||
testLongStrEq("rec:j1.INP$", "{calc:{expr:\"A+5\",args:5}}");
|
||||
testLongStrEq("rec:j1.INP$", "{calc:{expr:'A+5',args:5}}");
|
||||
|
||||
/* with [] */
|
||||
testPutLongStr("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":[7]}}");
|
||||
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}]}}");
|
||||
testPutLongStr("rec:j1.INP$", "{calc:{expr:'A+5',args:[{const:7}]}}");
|
||||
testdbPutFieldOk("rec:j1.PROC", DBF_LONG, 1);
|
||||
|
||||
testdbGetFieldEqual("rec:j1", DBF_DOUBLE, 12.0);
|
||||
testLongStrEq("rec:j1.INP$", "{calc:{expr:\"A+5\",args:[{const:7}]}}");
|
||||
testLongStrEq("rec:j1.INP$", "{calc:{expr:'A+5',args:[{const:7}]}}");
|
||||
}
|
||||
|
||||
MAIN(linkRetargetLinkTest)
|
||||
|
||||
Reference in New Issue
Block a user