Skip to content

Commit

Permalink
add missing test for pda.clear()
Browse files Browse the repository at this point in the history
  • Loading branch information
minecrawler committed Feb 8, 2024
1 parent 4609155 commit c546c17
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/pda/pda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,20 @@ describe('Test PDA', () => {
assert.equal(pda.pop(), undefined);
assert.equal(pda.size, 0);
});

it('clear', () => {
const pda = new PushDownAutomaton<State>();
pda.push(State1);
pda.push(State1);
pda.push(State1);
pda.push(State1);
pda.push(State1);

assert.equal(pda.size, 5);

pda.clear();

assert.equal(pda.size, 0);
assert.equal(pda.pop(), undefined);
});
});

0 comments on commit c546c17

Please sign in to comment.