Implement counter blocks

This commit is contained in:
Florrie 2018-04-07 16:02:49 -03:00
parent 2d9bd92140
commit 797d16be26
3 changed files with 54 additions and 1 deletions

View file

@ -169,3 +169,20 @@ test('stop', t => {
t.strictEqual(state.stopThisScript, 1);
t.end();
});
test('counter, incrCounter, clearCounter', t => {
const rt = new Runtime();
const c = new Control(rt);
// Default value
t.strictEqual(c.getCounter(), 0);
c.incrCounter();
c.incrCounter();
t.strictEqual(c.getCounter(), 2);
c.clearCounter();
t.strictEqual(c.getCounter(), 0);
t.end();
});