Skip to content

Commit a39b31c

Browse files
committed
Add tests for setting counter to object
1 parent 68baab7 commit a39b31c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/logic/vm/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,20 +312,22 @@ mod tests {
312312
fn test_set() {
313313
let mut vm = single_processor_vm(
314314
BlockType::MicroProcessor,
315-
"
315+
r#"
316316
set foo 1
317317
noop
318318
set foo 2
319319
set @counter 6
320320
stop
321321
stop
322+
set @counter null
323+
set @counter "foo"
322324
set @ipt 10
323325
set true 0
324326
set pi @pi
325327
set pi_fancy π
326328
set e @e
327329
noop
328-
",
330+
"#,
329331
);
330332

331333
with_processor(&mut vm, 0, |p| {
@@ -345,6 +347,12 @@ mod tests {
345347
assert_eq!(p.state.counter, 6);
346348
});
347349

350+
vm.do_tick(Duration::ZERO);
351+
352+
with_processor(&mut vm, 0, |p| {
353+
assert_eq!(p.state.counter, 8);
354+
});
355+
348356
vm.do_tick(Duration::ZERO);
349357
vm.do_tick(Duration::ZERO);
350358
vm.do_tick(Duration::ZERO);

0 commit comments

Comments
 (0)