Esempio n. 1
0
const ConstraintSyntax *PromiseTypeSyntaxGetConstraintSyntax(const PromiseTypeSyntax *promise_type_syntax, const char *lval)
{
 for (int i = 0; promise_type_syntax->constraints[i].lval; i++)
    {
    if (strcmp(promise_type_syntax->constraints[i].lval, lval) == 0)
       {
       return &promise_type_syntax->constraints[i];
       }
    }

 const ConstraintSyntax *constraint_syntax = NULL;
 if (strcmp("edit_line", promise_type_syntax->bundle_type) == 0)
    {
    constraint_syntax = BodySyntaxGetConstraintSyntax(CF_COMMON_EDITBODIES, lval);
    if (constraint_syntax)
       {
       return constraint_syntax;
       }
    }
 else if (strcmp("edit_xml", promise_type_syntax->bundle_type) == 0)
    {
    constraint_syntax = BodySyntaxGetConstraintSyntax(CF_COMMON_XMLBODIES, lval);
    if (constraint_syntax)
       {
       return constraint_syntax;
       }
    }

 return GetCommonConstraint(lval);
}
Esempio n. 2
0
static void test_lookup_body_process_count(void)
{
    const BodySyntax *x = BodySyntaxGet("process_count");
    assert_true(x);

    const ConstraintSyntax *y = BodySyntaxGetConstraintSyntax(x->constraints, "match_range");
    assert_true(y);
    assert_string_equal("match_range", y->lval);
}
Esempio n. 3
0
static void test_lookup_body_delete_select(void)
{
    const BodySyntax *x = BodySyntaxGet("delete_select");
    assert_true(x);

    const ConstraintSyntax *y = BodySyntaxGetConstraintSyntax(x->constraints, "delete_if_startwith_from_list");
    assert_true(y);
    assert_string_equal("delete_if_startwith_from_list", y->lval);
}
Esempio n. 4
0
static void test_lookup_body_classes(void)
{
    const BodySyntax *x = BodySyntaxGet("classes");
    assert_true(x);

    const ConstraintSyntax *y = BodySyntaxGetConstraintSyntax(x->constraints, "promise_repaired");
    assert_true(y);
    assert_string_equal("promise_repaired", y->lval);
}