@@ -31,7 +31,7 @@ fn test_fib(builder: &mut Builder) -> Result<()> {
31
31
32
32
let ( output, _, fuel_consumed) = run_with_u8s ( & mut runner, 5 ) ;
33
33
assert_eq ! ( 8 , output) ;
34
- assert_fuel_consumed_within_threshold ( 66_007 , fuel_consumed) ;
34
+ assert_fuel_consumed_within_threshold ( 64_681 , fuel_consumed) ;
35
35
Ok ( ( ) )
36
36
}
37
37
@@ -51,7 +51,7 @@ fn test_str(builder: &mut Builder) -> Result<()> {
51
51
52
52
let ( output, _, fuel_consumed) = run ( & mut runner, "hello" . as_bytes ( ) ) ;
53
53
assert_eq ! ( "world" . as_bytes( ) , output) ;
54
- assert_fuel_consumed_within_threshold ( 142_849 , fuel_consumed) ;
54
+ assert_fuel_consumed_within_threshold ( 146_027 , fuel_consumed) ;
55
55
Ok ( ( ) )
56
56
}
57
57
@@ -84,7 +84,7 @@ fn test_logging_with_compile(builder: &mut Builder) -> Result<()> {
84
84
"hello world from console.log\n hello world from console.error\n " ,
85
85
logs. as_str( ) ,
86
86
) ;
87
- assert_fuel_consumed_within_threshold ( 37309 , fuel_consumed) ;
87
+ assert_fuel_consumed_within_threshold ( 36_071 , fuel_consumed) ;
88
88
Ok ( ( ) )
89
89
}
90
90
@@ -98,7 +98,7 @@ fn test_logging_without_redirect(builder: &mut Builder) -> Result<()> {
98
98
let ( output, logs, fuel_consumed) = run ( & mut runner, & [ ] ) ;
99
99
assert_eq ! ( b"hello world from console.log\n " . to_vec( ) , output) ;
100
100
assert_eq ! ( "hello world from console.error\n " , logs. as_str( ) ) ;
101
- assert_fuel_consumed_within_threshold ( 37485 , fuel_consumed) ;
101
+ assert_fuel_consumed_within_threshold ( 36_641 , fuel_consumed) ;
102
102
Ok ( ( ) )
103
103
}
104
104
@@ -115,7 +115,7 @@ fn test_logging_with_redirect(builder: &mut Builder) -> Result<()> {
115
115
"hello world from console.log\n hello world from console.error\n " ,
116
116
logs. as_str( ) ,
117
117
) ;
118
- assert_fuel_consumed_within_threshold ( 37309 , fuel_consumed) ;
118
+ assert_fuel_consumed_within_threshold ( 36_042 , fuel_consumed) ;
119
119
Ok ( ( ) )
120
120
}
121
121
@@ -177,7 +177,7 @@ fn test_readme_script(builder: &mut Builder) -> Result<()> {
177
177
178
178
let ( output, _, fuel_consumed) = run ( & mut runner, r#"{ "n": 2, "bar": "baz" }"# . as_bytes ( ) ) ;
179
179
assert_eq ! ( r#"{"foo":3,"newBar":"baz!"}"# . as_bytes( ) , output) ;
180
- assert_fuel_consumed_within_threshold ( 270_919 , fuel_consumed) ;
180
+ assert_fuel_consumed_within_threshold ( 254_503 , fuel_consumed) ;
181
181
Ok ( ( ) )
182
182
}
183
183
@@ -223,7 +223,7 @@ fn test_exported_functions(builder: &mut Builder) -> Result<()> {
223
223
. build ( ) ?;
224
224
let ( _, logs, fuel_consumed) = run_fn ( & mut runner, "foo" , & [ ] ) ;
225
225
assert_eq ! ( "Hello from top-level\n Hello from foo\n " , logs) ;
226
- assert_fuel_consumed_within_threshold ( 63_310 , fuel_consumed) ;
226
+ assert_fuel_consumed_within_threshold ( 61_404 , fuel_consumed) ;
227
227
let ( _, logs, _) = run_fn ( & mut runner, "foo-bar" , & [ ] ) ;
228
228
assert_eq ! ( "Hello from top-level\n Hello from fooBar\n " , logs) ;
229
229
Ok ( ( ) )
@@ -407,7 +407,7 @@ fn run_fn(r: &mut Runner, func: &str, stdin: &[u8]) -> (Vec<u8>, String, u64) {
407
407
fn assert_fuel_consumed_within_threshold ( target_fuel : u64 , fuel_consumed : u64 ) {
408
408
let target_fuel = target_fuel as f64 ;
409
409
let fuel_consumed = fuel_consumed as f64 ;
410
- let threshold = 10 .0;
410
+ let threshold = 2 .0;
411
411
let percentage_difference = ( ( fuel_consumed - target_fuel) / target_fuel) . abs ( ) * 100.0 ;
412
412
413
413
assert ! (
0 commit comments