Skip to content

Commit abe0318

Browse files
committed
Include shared.rs in libm_test::op
These types from `libm_macros` provide a way to get information about an operation at runtime, rather than only being encoded in the type system. Include the file and reexport relevant types.
1 parent d32b312 commit abe0318

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

crates/libm-test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod test_traits;
1313
pub use f8_impl::f8;
1414
pub use libm::support::{Float, Int, IntTy, MinInt};
1515
pub use num::{FloatExt, logspace};
16-
pub use op::{BaseName, Identifier, MathOp, OpCFn, OpFTy, OpRustFn, OpRustRet};
16+
pub use op::{BaseName, FloatTy, Identifier, MathOp, OpCFn, OpFTy, OpRustFn, OpRustRet, Ty};
1717
pub use precision::{MaybeOverride, SpecialCase, default_ulp};
1818
pub use test_traits::{CheckBasis, CheckCtx, CheckOutput, GenerateInput, Hex, TupleCall};
1919

crates/libm-test/src/op.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,38 @@
1313
//! - "Operation" / "Op": Something that relates a routine to a function or is otherwise higher
1414
//! level. `Op` is also used as the name for generic parameters since it is terse.
1515
16+
use std::fmt;
17+
18+
pub use shared::{ALL_OPERATIONS, FloatTy, MathOpInfo, Ty};
19+
1620
use crate::{CheckOutput, Float, TupleCall};
1721

22+
mod shared {
23+
include!("../../libm-macros/src/shared.rs");
24+
}
25+
1826
/// An enum representing each possible symbol name (`sin`, `sinf`, `sinl`, etc).
1927
#[libm_macros::function_enum(BaseName)]
20-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
28+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
2129
pub enum Identifier {}
2230

31+
impl fmt::Display for Identifier {
32+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33+
f.write_str(self.as_str())
34+
}
35+
}
36+
2337
/// The name without any type specifier, e.g. `sin` and `sinf` both become `sin`.
2438
#[libm_macros::base_name_enum]
25-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
39+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
2640
pub enum BaseName {}
2741

42+
impl fmt::Display for BaseName {
43+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44+
f.write_str(self.as_str())
45+
}
46+
}
47+
2848
/// Attributes ascribed to a `libm` routine including signature, type information,
2949
/// and naming.
3050
pub trait MathOp {

0 commit comments

Comments
 (0)