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

Function test_for_incrementing_with_step

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

Source from the content-addressed store, hash-verified

4194
4195 #[test]
4196 fn test_for_incrementing_with_step() {
4197 let iter = VarRef::new("i", None);
4198 do_ok_test(
4199 "FOR i = 0 TO 5 STEP 2\nA\nNEXT",
4200 &[Statement::For(ForSpan {
4201 iter: iter.clone(),
4202 iter_pos: lc(1, 5),
4203 iter_double: false,
4204 start: expr_integer(0, 1, 9),
4205 end: Expr::LessEqual(Box::from(BinaryOpSpan {
4206 lhs: expr_symbol(iter.clone(), 1, 5),
4207 rhs: expr_integer(5, 1, 14),
4208 pos: lc(1, 11),
4209 })),
4210 next: Expr::Add(Box::from(BinaryOpSpan {
4211 lhs: expr_symbol(iter, 1, 5),
4212 rhs: expr_integer(2, 1, 21),
4213 pos: lc(1, 11),
4214 })),
4215 body: vec![make_bare_builtin_call("A", 2, 1)],
4216 })],
4217 );
4218
4219 let iter = VarRef::new("i", None);
4220 do_ok_test(
4221 "FOR i = 0 TO 5 STEP 2.5\nA\nNEXT",
4222 &[Statement::For(ForSpan {
4223 iter: iter.clone(),
4224 iter_pos: lc(1, 5),
4225 iter_double: true,
4226 start: expr_integer(0, 1, 9),
4227 end: Expr::LessEqual(Box::from(BinaryOpSpan {
4228 lhs: expr_symbol(iter.clone(), 1, 5),
4229 rhs: expr_integer(5, 1, 14),
4230 pos: lc(1, 11),
4231 })),
4232 next: Expr::Add(Box::from(BinaryOpSpan {
4233 lhs: expr_symbol(iter, 1, 5),
4234 rhs: expr_double(2.5, 1, 21),
4235 pos: lc(1, 11),
4236 })),
4237 body: vec![make_bare_builtin_call("A", 2, 1)],
4238 })],
4239 );
4240 }
4241
4242 #[test]
4243 fn test_for_decrementing_with_step() {

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