Feat: add slicing words
This commit is contained in:
@@ -196,21 +196,21 @@ fn ifelse_false() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pick_first() {
|
||||
expect_int("{ 10 } { 20 } { 30 } 0 pick", 10);
|
||||
fn select_first() {
|
||||
expect_int("{ 10 } { 20 } { 30 } 0 select", 10);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pick_second() {
|
||||
expect_int("{ 10 } { 20 } { 30 } 1 pick", 20);
|
||||
fn select_second() {
|
||||
expect_int("{ 10 } { 20 } { 30 } 1 select", 20);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pick_third() {
|
||||
expect_int("{ 10 } { 20 } { 30 } 2 pick", 30);
|
||||
fn select_third() {
|
||||
expect_int("{ 10 } { 20 } { 30 } 2 select", 30);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pick_preserves_stack() {
|
||||
expect_int("5 { 10 } { 20 } 0 pick +", 15);
|
||||
fn select_preserves_stack() {
|
||||
expect_int("5 { 10 } { 20 } 0 select +", 15);
|
||||
}
|
||||
|
||||
@@ -255,3 +255,16 @@ fn all_replaces_previous_global() {
|
||||
assert_eq!(outputs.len(), 1);
|
||||
assert!(outputs[0].contains("lpf/2000"), "latest lpf should be 2000: {}", outputs[0]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slice_param() {
|
||||
let outputs = expect_outputs(r#""break" s 8 slice ."#, 1);
|
||||
assert!(outputs[0].contains("slice/8"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pick_param() {
|
||||
let outputs = expect_outputs(r#""break" s 8 slice 3 pick ."#, 1);
|
||||
assert!(outputs[0].contains("slice/8"));
|
||||
assert!(outputs[0].contains("pick/3"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user