Added another test for program rules.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
static int GWENHYWFAR_CB test1(GWEN_TEST_MODULE *mod);
|
||||
static int GWENHYWFAR_CB test2(GWEN_TEST_MODULE *mod);
|
||||
static int GWENHYWFAR_CB test3(GWEN_TEST_MODULE *mod);
|
||||
|
||||
static int testAgainstValues(const char *ruleText, const uint64_t *ptrExpectedFields, double expectedValue);
|
||||
|
||||
@@ -43,6 +44,7 @@ int AQHREACT_PrgRule_AddTests(GWEN_TEST_MODULE *mod)
|
||||
|
||||
GWEN_Test_Module_AddTest(newMod, "parse rules 1", test1, NULL);
|
||||
GWEN_Test_Module_AddTest(newMod, "parse rules 2", test2, NULL);
|
||||
GWEN_Test_Module_AddTest(newMod, "match rules 1", test3, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -81,6 +83,30 @@ int test2(GWEN_UNUSED GWEN_TEST_MODULE *mod)
|
||||
|
||||
|
||||
|
||||
int test3(GWEN_UNUSED GWEN_TEST_MODULE *mod)
|
||||
{
|
||||
AQHREACT_PRGRULE_LIST *prgRuleList;
|
||||
AQHREACT_PRGRULE *prgRule;
|
||||
static char ruleText[]="/2 4-7 1-5,8,15,23-25 * 0,1,3,5 12.3";
|
||||
|
||||
prgRuleList=AQHREACT_PrgRule_ReadRules(ruleText);
|
||||
if (prgRuleList==NULL) {
|
||||
DBG_ERROR(NULL, "Error reading rules list");
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
|
||||
prgRule=AQHREACT_PrgRule_List_First(prgRuleList);
|
||||
|
||||
if (!AQHREACT_PrgRule_Matches(prgRule, 2, 5, 8, 4, 1)) {
|
||||
DBG_ERROR(NULL, "Error matching against rule");
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int testAgainstValues(const char *ruleText, const uint64_t *ptrExpectedFields, double expectedValue)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user