+ /* test loop */
+ expr = ec_node("or", EC_NO_ID);
+ val = ec_node_int(EC_NO_ID, 0, 10, 0);
+ op = ec_node_str(EC_NO_ID, "!");
+ seq = EC_NODE_SEQ(EC_NO_ID,
+ op,
+ ec_node_clone(expr));
+ op = NULL;
+ if (expr == NULL || val == NULL || seq == NULL)
+ goto fail;
+ if (ec_node_or_add(expr, ec_node_clone(seq)) < 0)
+ goto fail;
+ ec_node_free(seq);
+ seq = NULL;
+ if (ec_node_or_add(expr, ec_node_clone(val)) < 0)
+ goto fail;
+ ec_node_free(val);
+ val = NULL;
+
+ testres |= EC_TEST_CHECK_PARSE(expr, 1, "1");
+ testres |= EC_TEST_CHECK_PARSE(expr, 3, "!", "!", "1");
+ testres |= EC_TEST_CHECK_PARSE(expr, -1, "!", "!", "!");
+
+ ec_node_free(expr);
+ expr = NULL;
+
+ /* same loop test, but keep some refs (released later) */
+ expr = ec_node("or", EC_NO_ID);
+ ec_node_clone(expr);
+ expr2 = expr;
+ val = ec_node_int(EC_NO_ID, 0, 10, 0);
+ op = ec_node_str(EC_NO_ID, "!");
+ seq = EC_NODE_SEQ(EC_NO_ID,
+ op,
+ ec_node_clone(expr));
+ op = NULL;
+ if (expr == NULL || val == NULL || seq == NULL)
+ goto fail;
+ if (ec_node_or_add(expr, ec_node_clone(seq)) < 0)
+ goto fail;
+ ec_node_free(seq);
+ seq = NULL;
+ if (ec_node_or_add(expr, ec_node_clone(val)) < 0)
+ goto fail;
+
+ testres |= EC_TEST_CHECK_PARSE(expr, 1, "1");
+ testres |= EC_TEST_CHECK_PARSE(expr, 3, "!", "!", "1");
+ testres |= EC_TEST_CHECK_PARSE(expr, -1, "!", "!", "!");
+
+ ec_node_free(expr2);
+ expr2 = NULL;
+ ec_node_free(val);
+ val = NULL;
+ ec_node_free(expr);
+ expr = NULL;
+