units: Test C-COMMON-TRAITS

Add structs to the `api` integration test file that verify the set of
common traits.
This commit is contained in:
Tobin C. Harding 2024-11-28 16:59:00 +11:00
parent 3a73a480c8
commit c49f40fd9a
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 25 additions and 0 deletions

View File

@ -81,6 +81,31 @@ impl Types {
fn new() -> Self { Self { a: Enums::new(), b: Structs::max() } } 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. /// A struct that includes all public error types.
// These derives are the policy of `rust-bitcoin` not Rust API guidelines. // These derives are the policy of `rust-bitcoin` not Rust API guidelines.
#[derive(Debug, Clone, PartialEq, Eq)] // All public types implement Debug (C-DEBUG). #[derive(Debug, Clone, PartialEq, Eq)] // All public types implement Debug (C-DEBUG).