Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit c3afab4

Browse files
committed
Improve error messages for libm-test
1 parent 36958fd commit c3afab4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

crates/libm-test/tests/system_libm.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Compare the results of the `libm` implementation against the system's libm.
22
#![cfg(test)]
3-
#![cfg(feature = "system_libm")]
3+
//#![cfg(feature = "system_libm")]
44

55
use libm_test::WithinUlps;
66

@@ -89,7 +89,7 @@ macro_rules! system_libm {
8989
}
9090

9191
// Generate a tuple of arguments containing random values:
92-
let mut args: ( $($arg_tys),+ ) = ( $(<$arg_tys as Rand>::gen(&mut rng)),+ );
92+
let mut args: ( $($arg_tys,)+ ) = ( $(<$arg_tys as Rand>::gen(&mut rng),)+ );
9393

9494
// HACK
9595
if let "j1" | "jn" = stringify!($id) {
@@ -104,7 +104,7 @@ macro_rules! system_libm {
104104
let result = args.call(libm_fn as FnTy);
105105
let expected = args.call($id as FnTy);
106106
if !result.within_ulps(expected, ULP_TOL) {
107-
eprintln!("result = {:?} != {:?} (expected)", result, expected);
107+
eprintln!("{}{:?} returns = {:?} != {:?} (expected)", stringify!($id), args, result, expected);
108108
panic!();
109109
}
110110
}
@@ -128,7 +128,7 @@ trait Call<F> {
128128
macro_rules! impl_call {
129129
(($($arg_tys:ty),*) -> $ret_ty:ty: $self_:ident: $($xs:expr),*) => {
130130
// We only care about unsafe extern "C" functions here, safe functions coerce to them:
131-
impl Call<unsafe extern"C" fn($($arg_tys),*) -> $ret_ty> for ($($arg_tys),+) {
131+
impl Call<unsafe extern"C" fn($($arg_tys),*) -> $ret_ty> for ($($arg_tys,)+) {
132132
type Ret = $ret_ty;
133133
fn call(self, f: unsafe extern "C" fn($($arg_tys),*) -> $ret_ty) -> Self::Ret {
134134
let $self_ = self;
@@ -138,10 +138,10 @@ macro_rules! impl_call {
138138
};
139139
}
140140

141-
impl_call!((f32) -> f32: x: x);
142-
impl_call!((f64) -> f64: x: x);
143-
impl_call!((f64) -> i32: x: x);
144-
impl_call!((f32) -> i32: x: x);
141+
impl_call!((f32) -> f32: x: x.0);
142+
impl_call!((f64) -> f64: x: x.0);
143+
impl_call!((f64) -> i32: x: x.0);
144+
impl_call!((f32) -> i32: x: x.0);
145145
impl_call!((f32, f32) -> f32: x: x.0, x.1);
146146
impl_call!((f64, f64) -> f64: x: x.0, x.1);
147147
impl_call!((f64, i32) -> f64: x: x.0, x.1);

0 commit comments

Comments
 (0)