mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
DEV: Default test case for select expressions.
This commit is contained in:
parent
c1f84c4861
commit
fa294a2188
@ -16,7 +16,8 @@ use super::scope::Stack;
|
||||
use super::Composite::{List, Tuple};
|
||||
use super::Op::{
|
||||
Add, Bang, Bind, Cp, DeRef, Div, Element, Equal, FCall, Field, Func, InitList, InitThunk,
|
||||
InitTuple, Jump, JumpIfFalse, JumpIfTrue, Module, Mul, Noop, Return, SelectJump, Sub, Sym, Val,
|
||||
InitTuple, Jump, JumpIfFalse, JumpIfTrue, Module, Mul, Noop, Pop, Return, SelectJump, Sub, Sym,
|
||||
Val,
|
||||
};
|
||||
use super::Primitive::{Bool, Float, Int, Str};
|
||||
use super::Value::{C, P};
|
||||
@ -411,8 +412,22 @@ fn test_select_short_circuit() {
|
||||
Sym("field".to_owned()), // 5 // second field to compare
|
||||
SelectJump(2), // 6
|
||||
Val(Int(1)), // 7 // expression for second field
|
||||
Jump(2), // 8
|
||||
Pop, // 9 // pop the search field off
|
||||
Bang, // 10 // default case
|
||||
] => P(Int(1)),
|
||||
vec![
|
||||
Sym("field".to_owned()), // 0 // search field
|
||||
Sym("not_field".to_owned()), // 1 // first field to compare
|
||||
SelectJump(2), // 2
|
||||
Val(Str("not our value".to_owned())), // 3 // expression for first field
|
||||
Jump(4), // 4
|
||||
Sym("als not field".to_owned()), // 5 // second field to compare
|
||||
SelectJump(2), // 6
|
||||
Val(Int(1)), // 7 // expression for second field
|
||||
Jump(1), // 8
|
||||
Bang, // 9 // default case
|
||||
Pop, // 9 // pop the search field off
|
||||
Val(Int(1)), // 10 // default case
|
||||
] => P(Int(1)),
|
||||
];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user