Browse Source

fix cargo check errors (#1338)

* fix cargo check errors

- move constants to associated constants
- format & lint

* remove superfluous use

* use static constant in property

* add parallelism to test262 conformance runs
pull/1345/head
neeldug 3 years ago committed by GitHub
parent
commit
f673cbc662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      Cargo.lock
  2. 2
      boa/src/builtins/bigint/conversions.rs
  3. 18
      boa/src/builtins/math/mod.rs
  4. 1
      boa_tester/Cargo.toml
  5. 7
      boa_tester/src/exec/mod.rs

1
Cargo.lock generated

@ -104,6 +104,7 @@ dependencies = [
"hex",
"num-format",
"once_cell",
"rayon",
"regex",
"serde",
"serde_json",

2
boa/src/builtins/bigint/conversions.rs

@ -53,7 +53,7 @@ impl BigInt {
/// Converts the BigInt to a f64 type.
///
/// Returns `std::f64::INFINITY` if the BigInt is too big.
/// Returns `f64::INFINITY` if the BigInt is too big.
#[inline]
pub fn to_f64(&self) -> f64 {
self.0.to_f64().unwrap_or(f64::INFINITY)

18
boa/src/builtins/math/mod.rs

@ -31,21 +31,19 @@ impl BuiltIn for Math {
}
fn init(context: &mut Context) -> (&'static str, Value, Attribute) {
use std::f64;
let _timer = BoaProfiler::global().start_event(Self::NAME, "init");
let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT;
let string_tag = WellKnownSymbols::to_string_tag();
let object = ObjectInitializer::new(context)
.property("E", f64::consts::E, attribute)
.property("LN2", f64::consts::LN_2, attribute)
.property("LN10", f64::consts::LN_10, attribute)
.property("LOG2E", f64::consts::LOG2_E, attribute)
.property("LOG10E", f64::consts::LOG10_E, attribute)
.property("SQRT1_2", 0.5_f64.sqrt(), attribute)
.property("SQRT2", f64::consts::SQRT_2, attribute)
.property("PI", f64::consts::PI, attribute)
.property("E", std::f64::consts::E, attribute)
.property("LN2", std::f64::consts::LN_2, attribute)
.property("LN10", std::f64::consts::LN_10, attribute)
.property("LOG2E", std::f64::consts::LOG2_E, attribute)
.property("LOG10E", std::f64::consts::LOG10_E, attribute)
.property("SQRT1_2", std::f64::consts::FRAC_1_SQRT_2, attribute)
.property("SQRT2", std::f64::consts::SQRT_2, attribute)
.property("PI", std::f64::consts::PI, attribute)
.function(Self::abs, "abs", 1)
.function(Self::acos, "acos", 1)
.function(Self::acosh, "acosh", 1)

1
boa_tester/Cargo.toml

@ -25,3 +25,4 @@ git2 = "0.13.20"
hex = "0.4.3"
num-format = "0.4.0"
gc = { version = "0.4.1", features = ["derive"] }
rayon = "1.5.1"

7
boa_tester/src/exec/mod.rs

@ -8,6 +8,7 @@ use super::{
};
use boa::{parse, Context, Value};
use colored::Colorize;
use rayon::prelude::*;
use std::panic;
impl TestSuite {
@ -17,17 +18,15 @@ impl TestSuite {
println!("Suite {}:", self.name);
}
// TODO: in parallel
let suites: Vec<_> = self
.suites
.iter()
.par_iter()
.map(|suite| suite.run(harness, verbose))
.collect();
// TODO: in parallel
let tests: Vec<_> = self
.tests
.iter()
.par_iter()
.map(|test| test.run(harness, verbose))
.flatten()
.collect();

Loading…
Cancel
Save