Skip to content

Commit 180c805

Browse files
committed
Lower fuel consumption threshold from 10% to 2%
1 parent f955893 commit 180c805

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

crates/cli/tests/integration_test.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn test_fib(builder: &mut Builder) -> Result<()> {
3131

3232
let (output, _, fuel_consumed) = run_with_u8s(&mut runner, 5);
3333
assert_eq!(8, output);
34-
assert_fuel_consumed_within_threshold(66_007, fuel_consumed);
34+
assert_fuel_consumed_within_threshold(64_681, fuel_consumed);
3535
Ok(())
3636
}
3737

@@ -51,7 +51,7 @@ fn test_str(builder: &mut Builder) -> Result<()> {
5151

5252
let (output, _, fuel_consumed) = run(&mut runner, "hello".as_bytes());
5353
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);
5555
Ok(())
5656
}
5757

@@ -84,7 +84,7 @@ fn test_logging_with_compile(builder: &mut Builder) -> Result<()> {
8484
"hello world from console.log\nhello world from console.error\n",
8585
logs.as_str(),
8686
);
87-
assert_fuel_consumed_within_threshold(37309, fuel_consumed);
87+
assert_fuel_consumed_within_threshold(36_071, fuel_consumed);
8888
Ok(())
8989
}
9090

@@ -98,7 +98,7 @@ fn test_logging_without_redirect(builder: &mut Builder) -> Result<()> {
9898
let (output, logs, fuel_consumed) = run(&mut runner, &[]);
9999
assert_eq!(b"hello world from console.log\n".to_vec(), output);
100100
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);
102102
Ok(())
103103
}
104104

@@ -115,7 +115,7 @@ fn test_logging_with_redirect(builder: &mut Builder) -> Result<()> {
115115
"hello world from console.log\nhello world from console.error\n",
116116
logs.as_str(),
117117
);
118-
assert_fuel_consumed_within_threshold(37309, fuel_consumed);
118+
assert_fuel_consumed_within_threshold(36_042, fuel_consumed);
119119
Ok(())
120120
}
121121

@@ -177,7 +177,7 @@ fn test_readme_script(builder: &mut Builder) -> Result<()> {
177177

178178
let (output, _, fuel_consumed) = run(&mut runner, r#"{ "n": 2, "bar": "baz" }"#.as_bytes());
179179
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);
181181
Ok(())
182182
}
183183

@@ -223,7 +223,7 @@ fn test_exported_functions(builder: &mut Builder) -> Result<()> {
223223
.build()?;
224224
let (_, logs, fuel_consumed) = run_fn(&mut runner, "foo", &[]);
225225
assert_eq!("Hello from top-level\nHello from foo\n", logs);
226-
assert_fuel_consumed_within_threshold(63_310, fuel_consumed);
226+
assert_fuel_consumed_within_threshold(61_404, fuel_consumed);
227227
let (_, logs, _) = run_fn(&mut runner, "foo-bar", &[]);
228228
assert_eq!("Hello from top-level\nHello from fooBar\n", logs);
229229
Ok(())
@@ -407,7 +407,7 @@ fn run_fn(r: &mut Runner, func: &str, stdin: &[u8]) -> (Vec<u8>, String, u64) {
407407
fn assert_fuel_consumed_within_threshold(target_fuel: u64, fuel_consumed: u64) {
408408
let target_fuel = target_fuel as f64;
409409
let fuel_consumed = fuel_consumed as f64;
410-
let threshold = 10.0;
410+
let threshold = 2.0;
411411
let percentage_difference = ((fuel_consumed - target_fuel) / target_fuel).abs() * 100.0;
412412

413413
assert!(

0 commit comments

Comments
 (0)