~starkingdoms/starkingdoms

368a71522d2a8715a4a53fd021e299efbf7ceb62 — ghostly_zsh 1 year, 4 months ago 0216bf5
fix tests
4 files changed, 18 insertions(+), 38 deletions(-)

D kabel/test/runtime/turbo_oop.kab
D kabel/test/runtime/turbo_oop.out
M kabel/test/syntax/assignment.out
M kabel/test/syntax/if_else.out
D kabel/test/runtime/turbo_oop.kab => kabel/test/runtime/turbo_oop.kab +0 -26
@@ 1,26 0,0 @@
// modules.select(type, group ...)
//
// select all super thrusters that are in both the 'forward' and 
// 'lowpoweronly' user-defined groups
//
// 'forward' and 'lowpoweronly' are vecs of modules that have 
// been tagged in the ship editor as such

function sleep(h) {}

var lp_forwards = modules.select(modules.types.SuperThruster, "forward", "lowpoweronly");
var sensors = modules.select(modules.types.ShipProximitySensor);

loop { 
  // yes, i think we need 'loop' - while True 
  // may confuse beginners

  sleep(1); // 1 second
  
  // if something is less than 15u away,
  if (sensors.read() < 15) { 
    lp_forwards.activate();
  } else {
    lp_forwards.off(); // alias of Module.deactivate
  }
}

D kabel/test/runtime/turbo_oop.out => kabel/test/runtime/turbo_oop.out +0 -0
M kabel/test/syntax/assignment.out => kabel/test/syntax/assignment.out +9 -6
@@ 1,7 1,10 @@
Program
| Decl i
| | Lit 0
| Assign i
| | Lit string
| Decl _foo
| | Lit 3
| Expr
| | Decl i
| | | Lit 0
| Expr
| | Assign i
| | | Lit string
| Expr
| | Decl _foo
| | | Lit 3

M kabel/test/syntax/if_else.out => kabel/test/syntax/if_else.out +9 -6
@@ 4,17 4,20 @@ Program
| | | Lit i
| | | Lit 0
| | Block
| | | Assign i
| | | | Lit 1
| | | Expr
| | | | Assign i
| | | | | Lit 1
| Else
| | If
| | | Binary Eq
| | | | Lit i
| | | | Lit 1
| | | Block
| | | | Assign i
| | | | | Lit 2
| | | | Expr
| | | | | Assign i
| | | | | | Lit 2
| | Else
| | | Block
| | | | Assign i
| | | | | Lit 3
| | | | Expr
| | | | | Assign i
| | | | | | Lit 3