static void run_test_in_policy(const char *policy_filename, TestFn fn) { GenericAgentConfig *agent_config = GenericAgentConfigNewDefault( AGENT_TYPE_EXECUTOR); EvalContext *ctx = EvalContextNew(); Policy *policy = TestParsePolicy(policy_filename); PolicyResolve(ctx, policy, agent_config); /* Setup global environment */ strcpy(VFQNAME, "localhost.localdomain"); strcpy(VIPADDRESS, "127.0.0.100"); EvalContextAddIpAddress(ctx, "127.0.0.100"); EvalContextAddIpAddress(ctx, "127.0.0.101"); fn(ctx, policy); PolicyDestroy(policy); GenericAgentFinalize(ctx, agent_config); }
void test_constraint_ifvarclass_invalid(void) { Policy *p = TestParsePolicy("constraint_ifvarclass_invalid.cf"); assert_false(p); }
void test_promise_promiser_nonscalar(void) { assert_false(TestParsePolicy("promise_promiser_nonscalar.cf")); }
void test_bundle_body_promiser_unknown_constraint_id(void) { assert_false(TestParsePolicy("bundle_body_promiser_unknown_constraint_id.cf")); }
void test_bundle_body_promisee_missing_arrow(void) { assert_false(TestParsePolicy("bundle_body_promise_missing_arrow.cf")); }
void test_bundle_body_promiser_statement_contains_colon(void) { assert_false(TestParsePolicy("bundle_body_promiser_statement_contains_colon.cf")); }
void test_bundle_body_wrong_statement(void) { assert_false(TestParsePolicy("bundle_body_wrong_statement.cf")); }
void test_bundle_invalid_promise_type(void) { assert_false(TestParsePolicy("bundle_invalid_promise_type.cf")); }
void test_body_body_forget_cb_eof(void) { assert_false(TestParsePolicy("body_body_forget_cb_eof.cf")); }
void test_body_selection_unknown_selection_id(void) { assert_false(TestParsePolicy("body_selection_unknown_selection_id.cf")); }
void test_body_selection_forgot_semicolon(void) { assert_false(TestParsePolicy("body_selection_forgot_semicolon.cf")); }
void test_body_selection_wrong_token(void) { assert_false(TestParsePolicy("body_selection_wrong_token.cf")); }
void test_benchmark(void) { Policy *p = TestParsePolicy("benchmark.cf"); assert_true(p); PolicyDestroy(p); }
void test_bundle_body_promisee_no_colon_allowed(void) { assert_false(TestParsePolicy("bundle_body_promisee_no_colon_allowed.cf")); }
void test_bundle_args_forgot_cp(void) { assert_false(TestParsePolicy("bundle_args_forgot_cp.cf")); }
void test_bundle_body_forgot_ob(void) { assert_false(TestParsePolicy("bundle_body_forgot_ob.cf")); }
void test_body_body_forget_cb_bundle(void) { assert_false(TestParsePolicy("body_body_forget_cb_bundle.cf")); }
void test_bundle_body_wrong_promise_type_token(void) { assert_false(TestParsePolicy("bundle_body_wrong_promise_type_token.cf")); }
void test_rval_wrong_input_type(void) { assert_false(TestParsePolicy("rval_wrong_input_type.cf")); }
void test_bundle_body_forgot_semicolon(void) { assert_false(TestParsePolicy("bundle_body_forgot_semicolon.cf")); }
void test_no_bundle_or_body_keyword(void) { assert_false(TestParsePolicy("no_bundle_or_body_keyword.cf")); }
void test_bundle_body_promiser_statement_missing_assign(void) { assert_false(TestParsePolicy("bundle_body_promiser_statement_missing_assign.cf")); }
void test_rval_list_forgot_cb_colon(void) { assert_false(TestParsePolicy("rval_list_forgot_cb_colon.cf")); }
void test_bundle_body_promiser_wrong_constraint_token(void) { assert_false(TestParsePolicy("bundle_body_promiser_wrong_constraint_token.cf")); }
void test_rval_function_forgot_cp_colon(void) { assert_false(TestParsePolicy("rval_function_forgot_cp_colon.cf")); }
void test_body_invalid_type(void) { assert_false(TestParsePolicy("body_invalid_type.cf")); }
void test_body_edit_xml_common_constraints(void) { assert_true(TestParsePolicy("body_edit_xml_common_constraints.cf")); }