From cc0d8ba2d12da0b59b6e3ac1a6f3d957a48a04ca Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 10 Apr 2017 11:14:05 -0500 Subject: [PATCH] remove the current test suite --- Cargo.toml | 6 --- src/float/add.rs | 25 ---------- src/float/conv.rs | 109 ------------------------------------------ src/float/pow.rs | 19 -------- src/float/sub.rs | 25 ---------- src/int/mul.rs | 63 ------------------------- src/int/sdiv.rs | 117 ---------------------------------------------- src/int/shift.rs | 74 ----------------------------- src/int/udiv.rs | 117 ---------------------------------------------- src/lib.rs | 17 ------- 10 files changed, 572 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a82aad5..fdd3b2a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,12 +11,6 @@ rustc-cfg = "0.3.0" optional = true version = "0.3.36" -[dev-dependencies] -quickcheck = "0.3.1" -rand = "0.3.14" -gcc_s = { path = "gcc_s" } -compiler-rt = { path = "compiler-rt" } - [features] # Build the missing intrinsics from compiler-rt C source code c = ["gcc"] diff --git a/src/float/add.rs b/src/float/add.rs index 992d149..5024a72 100644 --- a/src/float/add.rs +++ b/src/float/add.rs @@ -192,28 +192,3 @@ add!("aapcs", __adddf3: f64); #[cfg(not(target_arch = "arm"))] add!("C", __adddf3: f64); - -// NOTE(cfg) for some reason, on arm*-unknown-linux-gnueabi*, our implementation doesn't -// match the output of its gcc_s or compiler-rt counterpart. Until we investigate further, we'll -// just avoid testing against them on those targets. Do note that our implementation gives the -// correct answer; gcc_s and compiler-rt are incorrect in this case. -#[cfg(all(test, not(arm_linux)))] -mod tests { - use core::{f32, f64}; - use qc::{F32, F64}; - - check! { - fn __addsf3(f: extern "C" fn(f32, f32) -> f32, - a: F32, - b: F32) - -> Option { - Some(F32(f(a.0, b.0))) - } - - fn __adddf3(f: extern "C" fn(f64, f64) -> f64, - a: F64, - b: F64) -> Option { - Some(F64(f(a.0, b.0))) - } - } -} diff --git a/src/float/conv.rs b/src/float/conv.rs index 2781ff5..e04b26b 100755 --- a/src/float/conv.rs +++ b/src/float/conv.rs @@ -155,112 +155,3 @@ fp_fix!(__fixunssfsi: f32, u32); fp_fix!(__fixunssfdi: f32, u64); fp_fix!(__fixunsdfsi: f64, u32); fp_fix!(__fixunsdfdi: f64, u64); - -// NOTE(cfg) for some reason, on arm*-unknown-linux-gnueabihf, our implementation doesn't -// match the output of its gcc_s or compiler-rt counterpart. Until we investigate further, we'll -// just avoid testing against them on those targets. Do note that our implementation gives the -// correct answer; gcc_s and compiler-rt are incorrect in this case. -// -#[cfg(all(test, not(arm_linux)))] -mod tests { - use qc::{I32, U32, I64, U64, F32, F64}; - - check! { - fn __floatsisf(f: extern "C" fn(i32) -> f32, - a: I32) - -> Option { - Some(F32(f(a.0))) - } - fn __floatsidf(f: extern "C" fn(i32) -> f64, - a: I32) - -> Option { - Some(F64(f(a.0))) - } - fn __floatdidf(f: extern "C" fn(i64) -> f64, - a: I64) - -> Option { - Some(F64(f(a.0))) - } - fn __floatunsisf(f: extern "C" fn(u32) -> f32, - a: U32) - -> Option { - Some(F32(f(a.0))) - } - fn __floatunsidf(f: extern "C" fn(u32) -> f64, - a: U32) - -> Option { - Some(F64(f(a.0))) - } - fn __floatundidf(f: extern "C" fn(u64) -> f64, - a: U64) - -> Option { - Some(F64(f(a.0))) - } - - fn __fixsfsi(f: extern "C" fn(f32) -> i32, - a: F32) - -> Option { - if (a.0 as f64) > (i32::max_value() as f64) || - (a.0 as f64) < (i32::min_value() as f64) || a.0.is_nan() { - None - } else { Some(I32(f(a.0))) } - } - fn __fixsfdi(f: extern "C" fn(f32) -> i64, - a: F32) - -> Option { - if (a.0 as f64) > (i64::max_value() as f64) || - (a.0 as f64) < (i64::min_value() as f64) || a.0.is_nan() { - None - } else { Some(I64(f(a.0))) } - } - fn __fixdfsi(f: extern "C" fn(f64) -> i32, - a: F64) - -> Option { - if a.0 > (i32::max_value() as f64) || - a.0 < (i32::min_value() as f64) || a.0.is_nan() { - None - } else { Some(I32(f(a.0))) } - } - fn __fixdfdi(f: extern "C" fn(f64) -> i64, - a: F64) - -> Option { - if a.0 > (i64::max_value() as f64) || - a.0 < (i64::min_value() as f64) || a.0.is_nan() { - None - } else { Some(I64(f(a.0))) } - } - - fn __fixunssfsi(f: extern "C" fn(f32) -> u32, - a: F32) - -> Option { - if (a.0 as f64) > (u32::max_value() as f64) || - (a.0 as f64) < (u32::min_value() as f64) || a.0.is_nan() { - None - } else { Some(U32(f(a.0))) } - } - fn __fixunssfdi(f: extern "C" fn(f32) -> u64, - a: F32) - -> Option { - if (a.0 as f64) > (u64::max_value() as f64) || - (a.0 as f64) < (u64::min_value() as f64) || a.0.is_nan() { - None - } else { Some(U64(f(a.0))) } - } - fn __fixunsdfsi(f: extern "C" fn(f64) -> u32, - a: F64) - -> Option { - if a.0 > (u32::max_value() as f64) || - a.0 < (u32::min_value() as f64) || a.0.is_nan() { - None - } else { Some(U32(f(a.0))) } - } - fn __fixunsdfdi(f: extern "C" fn(f64) -> u64, - a: F64) - -> Option { - if a.0 <= (u64::max_value() as f64) || - a.0 >= (u64::min_value() as f64) || a.0.is_nan() { - None - } else { Some(U64(f(a.0))) } - } - } -} diff --git a/src/float/pow.rs b/src/float/pow.rs index 52aba5d..5e28d95 100644 --- a/src/float/pow.rs +++ b/src/float/pow.rs @@ -28,22 +28,3 @@ macro_rules! pow { pow!(__powisf2: f32, i32); pow!(__powidf2: f64, i32); - -#[cfg(test)] -mod tests { - use qc::{I32, F32, F64}; - - check! { - fn __powisf2(f: extern "C" fn(f32, i32) -> f32, - a: F32, - b: I32) -> Option { - Some(F32(f(a.0, b.0))) - } - - fn __powidf2(f: extern "C" fn(f64, i32) -> f64, - a: F64, - b: I32) -> Option { - Some(F64(f(a.0, b.0))) - } - } -} diff --git a/src/float/sub.rs b/src/float/sub.rs index 928d738..a4fd884 100644 --- a/src/float/sub.rs +++ b/src/float/sub.rs @@ -18,28 +18,3 @@ sub!(#[cfg_attr(all(not(test), not(target_arch = "arm")), no_mangle)] sub!(#[cfg_attr(all(not(test), not(target_arch = "arm")), no_mangle)] #[cfg_attr(all(not(test), target_arch = "arm"), inline(always))] | __subdf3: f64); - -// NOTE(cfg) for some reason, on arm*-unknown-linux-gnueabi*, our implementation doesn't -// match the output of its gcc_s or compiler-rt counterpart. Until we investigate further, we'll -// just avoid testing against them on those targets. Do note that our implementation gives the -// correct answer; gcc_s and compiler-rt are incorrect in this case. -#[cfg(all(test, not(arm_linux)))] -mod tests { - use core::{f32, f64}; - use qc::{F32, F64}; - - check! { - fn __subsf3(f: extern "C" fn(f32, f32) -> f32, - a: F32, - b: F32) - -> Option { - Some(F32(f(a.0, b.0))) - } - - fn __subdf3(f: extern "C" fn(f64, f64) -> f64, - a: F64, - b: F64) -> Option { - Some(F64(f(a.0, b.0))) - } - } -} diff --git a/src/int/mul.rs b/src/int/mul.rs index 7b0d033..5381edd 100644 --- a/src/int/mul.rs +++ b/src/int/mul.rs @@ -93,66 +93,3 @@ mulo!(__mulodi4: i64); mulo!(__muloti4: i128, "unadjusted"); #[cfg(not(all(windows, target_pointer_width="64")))] mulo!(__muloti4: i128); - -#[cfg(test)] -mod tests { - use qc::{I32, I64, U64}; - - check! { - fn __muldi3(f: extern "C" fn(u64, u64) -> u64, a: U64, b: U64) - -> Option { - Some(f(a.0, b.0)) - } - - fn __mulosi4(f: extern "C" fn(i32, i32, &mut i32) -> i32, - a: I32, - b: I32) -> Option<(i32, i32)> { - let (a, b) = (a.0, b.0); - let mut overflow = 2; - let r = f(a, b, &mut overflow); - if overflow != 0 && overflow != 1 { - panic!("Invalid value {} for overflow", overflow); - } - Some((r, overflow)) - } - - fn __mulodi4(f: extern "C" fn(i64, i64, &mut i32) -> i64, - a: I64, - b: I64) -> Option<(i64, i32)> { - let (a, b) = (a.0, b.0); - let mut overflow = 2; - let r = f(a, b, &mut overflow); - if overflow != 0 && overflow != 1 { - panic!("Invalid value {} for overflow", overflow); - } - Some((r, overflow)) - } - } -} - -#[cfg(test)] -#[cfg(all(not(windows), - not(target_arch = "mips64"), - not(target_arch = "mips64el"), - target_pointer_width="64"))] -mod tests_i128 { - use qc::I128; - - check! { - fn __multi3(f: extern "C" fn(i128, i128) -> i128, a: I128, b: I128) - -> Option { - Some(f(a.0, b.0)) - } - fn __muloti4(f: extern "C" fn(i128, i128, &mut i32) -> i128, - a: I128, - b: I128) -> Option<(i128, i32)> { - let (a, b) = (a.0, b.0); - let mut overflow = 2; - let r = f(a, b, &mut overflow); - if overflow != 0 && overflow != 1 { - panic!("Invalid value {} for overflow", overflow); - } - Some((r, overflow)) - } - } -} diff --git a/src/int/sdiv.rs b/src/int/sdiv.rs index 1906560..5576898 100644 --- a/src/int/sdiv.rs +++ b/src/int/sdiv.rs @@ -100,120 +100,3 @@ divmod!("aapcs", __divmoddi4, __divdi3: i64); #[cfg(not(target_arch = "arm"))] divmod!("C", __divmoddi4, __divdi3: i64); - -#[cfg(test)] -mod tests { - use qc::{U32, U64}; - - check! { - fn __divdi3(f: extern "C" fn(i64, i64) -> i64, n: U64, d: U64) -> Option { - let (n, d) = (n.0 as i64, d.0 as i64); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __moddi3(f: extern "C" fn(i64, i64) -> i64, n: U64, d: U64) -> Option { - let (n, d) = (n.0 as i64, d.0 as i64); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - #[cfg(target_arch = "arm")] - fn __divmoddi4(f: extern "aapcs" fn(i64, i64, &mut i64) -> i64, - n: U64, - d: U64) -> Option<(i64, i64)> { - let (n, d) = (n.0 as i64, d.0 as i64); - if d == 0 { - None - } else { - let mut r = 0; - let q = f(n, d, &mut r); - Some((q, r)) - } - } - - #[cfg(not(target_arch = "arm"))] - fn __divmoddi4(f: extern "C" fn(i64, i64, &mut i64) -> i64, - n: U64, - d: U64) -> Option<(i64, i64)> { - let (n, d) = (n.0 as i64, d.0 as i64); - if d == 0 { - None - } else { - let mut r = 0; - let q = f(n, d, &mut r); - Some((q, r)) - } - } - - fn __divsi3(f: extern "C" fn(i32, i32) -> i32, - n: U32, - d: U32) -> Option { - let (n, d) = (n.0 as i32, d.0 as i32); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __modsi3(f: extern "C" fn(i32, i32) -> i32, - n: U32, - d: U32) -> Option { - let (n, d) = (n.0 as i32, d.0 as i32); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __divmodsi4(f: extern "C" fn(i32, i32, &mut i32) -> i32, - n: U32, - d: U32) -> Option<(i32, i32)> { - let (n, d) = (n.0 as i32, d.0 as i32); - if d == 0 { - None - } else { - let mut r = 0; - let q = f(n, d, &mut r); - Some((q, r)) - } - } - } -} - -#[cfg(test)] -#[cfg(all(not(windows), - not(target_arch = "mips64"), - not(target_arch = "mips64el"), - target_pointer_width="64"))] -mod tests_i128 { - use qc::U128; - check! { - - fn __divti3(f: extern "C" fn(i128, i128) -> i128, n: U128, d: U128) -> Option { - let (n, d) = (n.0 as i128, d.0 as i128); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __modti3(f: extern "C" fn(i128, i128) -> i128, n: U128, d: U128) -> Option { - let (n, d) = (n.0 as i128, d.0 as i128); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - } -} diff --git a/src/int/shift.rs b/src/int/shift.rs index fdd2f6c..8b5c4a1 100644 --- a/src/int/shift.rs +++ b/src/int/shift.rs @@ -72,77 +72,3 @@ ashr!(__ashrti3: i128); lshr!(__lshrdi3: u64); lshr!(__lshrti3: u128); - -#[cfg(test)] -mod tests { - use qc::{I64, U64}; - - // NOTE We purposefully stick to `u32` for `b` here because we want "small" values (b < 64) - check! { - fn __ashldi3(f: extern "C" fn(u64, u32) -> u64, a: U64, b: u32) -> Option { - let a = a.0; - if b >= 64 { - None - } else { - Some(f(a, b)) - } - } - - fn __ashrdi3(f: extern "C" fn(i64, u32) -> i64, a: I64, b: u32) -> Option { - let a = a.0; - if b >= 64 { - None - } else { - Some(f(a, b)) - } - } - - fn __lshrdi3(f: extern "C" fn(u64, u32) -> u64, a: U64, b: u32) -> Option { - let a = a.0; - if b >= 64 { - None - } else { - Some(f(a, b)) - } - } - } -} - -#[cfg(test)] -#[cfg(all(not(windows), - not(target_arch = "mips64"), - not(target_arch = "mips64el"), - target_pointer_width="64"))] -mod tests_i128 { - use qc::{I128, U128}; - - // NOTE We purposefully stick to `u32` for `b` here because we want "small" values (b < 64) - check! { - fn __ashlti3(f: extern "C" fn(u128, u32) -> u128, a: U128, b: u32) -> Option { - let a = a.0; - if b >= 64 { - None - } else { - Some(f(a, b)) - } - } - - fn __ashrti3(f: extern "C" fn(i128, u32) -> i128, a: I128, b: u32) -> Option { - let a = a.0; - if b >= 64 { - None - } else { - Some(f(a, b)) - } - } - - fn __lshrti3(f: extern "C" fn(u128, u32) -> u128, a: U128, b: u32) -> Option { - let a = a.0; - if b >= 128 { - None - } else { - Some(f(a, b)) - } - } - } -} diff --git a/src/int/udiv.rs b/src/int/udiv.rs index 6c125bb..e8db746 100644 --- a/src/int/udiv.rs +++ b/src/int/udiv.rs @@ -312,120 +312,3 @@ udivmodti4!(::U64x2, ::conv); #[cfg(not(all(windows, target_pointer_width="64")))] udivmodti4!(u128, |i|{ i }); - -#[cfg(test)] -mod tests { - use qc::{U32, U64}; - - check! { - fn __udivdi3(f: extern "C" fn(u64, u64) -> u64, n: U64, d: U64) -> Option { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __umoddi3(f: extern "C" fn(u64, u64) -> u64, n: U64, d: U64) -> Option { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __udivmoddi4(f: extern "C" fn(u64, u64, Option<&mut u64>) -> u64, - n: U64, - d: U64) -> Option<(u64, u64)> { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - let mut r = 0; - let q = f(n, d, Some(&mut r)); - Some((q, r)) - } - } - - fn __udivsi3(f: extern "C" fn(u32, u32) -> u32, n: U32, d: U32) -> Option { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __umodsi3(f: extern "C" fn(u32, u32) -> u32, n: U32, d: U32) -> Option { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __udivmodsi4(f: extern "C" fn(u32, u32, Option<&mut u32>) -> u32, - n: U32, - d: U32) -> Option<(u32, u32)> { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - let mut r = 0; - let q = f(n, d, Some(&mut r)); - Some((q, r)) - } - } - } -} - -#[cfg(test)] -#[cfg(all(not(windows), - not(target_arch = "mips64"), - not(target_arch = "mips64el"), - target_pointer_width="64"))] -mod tests_i128 { - use qc::U128; - - check! { - fn __udivti3(f: extern "C" fn(u128, u128) -> u128, - n: U128, - d: U128) -> Option { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __umodti3(f: extern "C" fn(u128, u128) -> u128, - n: U128, - d: U128) -> Option { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - Some(f(n, d)) - } - } - - fn __udivmodti4(f: extern "C" fn(u128, u128, Option<&mut u128>) -> u128, - n: U128, - d: U128) -> Option { - let (n, d) = (n.0, d.0); - if d == 0 { - None - } else { - // FIXME fix the segfault when the remainder is requested - /*let mut r = 0; - let q = f(n, d, Some(&mut r)); - Some((q, r))*/ - Some(f(n, d, None)) - } - } - } -} diff --git a/src/lib.rs b/src/lib.rs index 0da336e..8c7820b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,26 +111,9 @@ fn sconv(i: i128) -> U64x2 { U64x2(j.low(), j.high()) } -#[cfg(test)] -#[cfg_attr(target_arch = "arm", macro_use)] -extern crate quickcheck; - #[cfg(test)] extern crate core; -#[cfg(test)] -extern crate gcc_s; - -#[cfg(test)] -extern crate compiler_rt; - -#[cfg(test)] -extern crate rand; - -#[cfg(test)] -#[macro_use] -mod qc; - pub mod int; pub mod float;