Merge rust-bitcoin/rust-bitcoin#3680: units: Test C-COMMON-TRAITS
c49f40fd9a
units: Test C-COMMON-TRAITS (Tobin C. Harding)
Pull request description:
Add structs to the `api` integration test file that verify the set of common traits.
ACKs for top commit:
apoelstra:
ACK c49f40fd9af1b9446a7c9a35aefdc02b30801275; successfully ran local tests; good idea!
Tree-SHA512: bc60ed8912e705d4c07714e9d19c0eee4fb2eb6be17a6ee67c2bb922ea27ef3a737eda3f7de690fa3a9fa364c34029989f20361d03f706fd3152ec4f20f33aab
This commit is contained in:
commit
99bf3f74b9
|
@ -81,6 +81,31 @@ impl Types {
|
|||
fn new() -> Self { Self { a: Enums::new(), b: Structs::max() } }
|
||||
}
|
||||
|
||||
/// A struct that includes all public non-error non-helper structs.
|
||||
// C-COMMON-TRAITS excluding `Default` and `Display`. `Display` is done in `./str.rs`.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
struct CommonTraits {
|
||||
a: Amount,
|
||||
c: SignedAmount,
|
||||
d: BlockHeight,
|
||||
e: BlockInterval,
|
||||
f: FeeRate,
|
||||
g: absolute::Height,
|
||||
h: absolute::Time,
|
||||
i: relative::Height,
|
||||
j: relative::Time,
|
||||
k: Weight,
|
||||
}
|
||||
|
||||
/// A struct that includes all types that implement `Default`.
|
||||
#[derive(Default)] // C-COMMON-TRAITS: `Default`
|
||||
struct Default {
|
||||
a: Amount,
|
||||
b: SignedAmount,
|
||||
c: relative::Height,
|
||||
d: relative::Time,
|
||||
}
|
||||
|
||||
/// A struct that includes all public error types.
|
||||
// These derives are the policy of `rust-bitcoin` not Rust API guidelines.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)] // All public types implement Debug (C-DEBUG).
|
||||
|
|
Loading…
Reference in New Issue