MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_for_decrementing_with_step

Function test_for_decrementing_with_step

core/src/parser.rs:4243–4287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4241
4242 #[test]
4243 fn test_for_decrementing_with_step() {
4244 let iter = VarRef::new("i", None);
4245 do_ok_test(
4246 "FOR i = 5 TO 0 STEP -1\nA\nNEXT",
4247 &[Statement::For(ForSpan {
4248 iter: iter.clone(),
4249 iter_pos: lc(1, 5),
4250 iter_double: false,
4251 start: expr_integer(5, 1, 9),
4252 end: Expr::GreaterEqual(Box::from(BinaryOpSpan {
4253 lhs: expr_symbol(iter.clone(), 1, 5),
4254 rhs: expr_integer(0, 1, 14),
4255 pos: lc(1, 11),
4256 })),
4257 next: Expr::Add(Box::from(BinaryOpSpan {
4258 lhs: expr_symbol(iter, 1, 5),
4259 rhs: expr_integer(-1, 1, 22),
4260 pos: lc(1, 11),
4261 })),
4262 body: vec![make_bare_builtin_call("A", 2, 1)],
4263 })],
4264 );
4265
4266 let iter = VarRef::new("i", None);
4267 do_ok_test(
4268 "FOR i = 5 TO 0 STEP -1.2\nA\nNEXT",
4269 &[Statement::For(ForSpan {
4270 iter: iter.clone(),
4271 iter_pos: lc(1, 5),
4272 iter_double: true,
4273 start: expr_integer(5, 1, 9),
4274 end: Expr::GreaterEqual(Box::from(BinaryOpSpan {
4275 lhs: expr_symbol(iter.clone(), 1, 5),
4276 rhs: expr_integer(0, 1, 14),
4277 pos: lc(1, 11),
4278 })),
4279 next: Expr::Add(Box::from(BinaryOpSpan {
4280 lhs: expr_symbol(iter, 1, 5),
4281 rhs: expr_double(-1.2, 1, 22),
4282 pos: lc(1, 11),
4283 })),
4284 body: vec![make_bare_builtin_call("A", 2, 1)],
4285 })],
4286 );
4287 }
4288
4289 #[test]
4290 fn test_for_errors() {

Callers

nothing calls this directly

Calls 5

lcFunction · 0.85
expr_integerFunction · 0.85
expr_symbolFunction · 0.85
expr_doubleFunction · 0.85
do_ok_testFunction · 0.70

Tested by

no test coverage detected