mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-04 02:00:29 -04:00
Implement counter blocks
This commit is contained in:
parent
2d9bd92140
commit
797d16be26
3 changed files with 54 additions and 1 deletions
test/unit
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue