Feat: script execution performance optimization
This commit is contained in:
@@ -3,7 +3,7 @@ use super::harness::*;
|
||||
#[test]
|
||||
fn quotation_on_stack() {
|
||||
// Quotation should be pushable to stack
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let result = f.evaluate("{ 1 2 + }", &default_ctx());
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
@@ -79,7 +79,7 @@ fn quotation_with_emit() {
|
||||
#[test]
|
||||
fn quotation_skips_emit() {
|
||||
// When false, . should not fire
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let outputs = f
|
||||
.evaluate(r#""kick" s { . } 0 ?"#, &default_ctx())
|
||||
.unwrap();
|
||||
@@ -107,7 +107,7 @@ fn every_with_quotation_integration() {
|
||||
// { 2 distort } 2 every — on even iterations, distort is applied
|
||||
for iter in 0..4 {
|
||||
let ctx = ctx_with(|c| c.iter = iter);
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let outputs = f
|
||||
.evaluate(r#""kick" s { 2 distort } 2 every ."#, &ctx)
|
||||
.unwrap();
|
||||
@@ -132,7 +132,7 @@ fn every_with_quotation_integration() {
|
||||
#[test]
|
||||
fn bjork_with_sound() {
|
||||
let ctx = ctx_with(|c| c.runs = 2); // position 2 is a hit for (3,8)
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let outputs = f
|
||||
.evaluate(r#""kick" s { 2 distort } 3 8 bjork ."#, &ctx)
|
||||
.unwrap();
|
||||
@@ -158,7 +158,7 @@ fn when_and_unless_complementary() {
|
||||
// Using iter mod + ?/!? for if-else behavior (every no longer pushes bool)
|
||||
for iter in 0..4 {
|
||||
let ctx = ctx_with(|c| c.iter = iter);
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let outputs = f
|
||||
.evaluate(
|
||||
r#""kick" s { 2 distort } iter 2 mod 0 = ? { 4 distort } iter 2 mod 0 = !? ."#,
|
||||
|
||||
Reference in New Issue
Block a user