Skip to content

Commit

Permalink
add test to document functionality where AddHits is ignored if post c…
Browse files Browse the repository at this point in the history
…ondition does not have a hit target
  • Loading branch information
Jamiras committed Mar 19, 2019
1 parent 2219457 commit dc79017
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,32 @@ static void test_trigger(void) {
assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 3U);
}

{
/*------------------------------------------------------------------------
TestAddHitsNoHitCount
Odd use case: AddHits a=1
b=1
Since b=1 doesn't have a hitcount, it ignores the hits tallied by a=1
------------------------------------------------------------------------*/

unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56};
memory_t memory;
rc_trigger_t* trigger;

memory.ram = ram;
memory.size = sizeof(ram);

parse_trigger(&trigger, buffer, "C:0xH0001=18_0xH0000=1");
comp_trigger(trigger, &memory, 0);
assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U);
assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U);

ram[0] = 1;
comp_trigger(trigger, &memory, 1);
assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U);
assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U);
}

{
/*------------------------------------------------------------------------
TestHitCountPauseIfResetIf
Expand Down

0 comments on commit dc79017

Please sign in to comment.