Sha256: fa9e8ee461f176c0d892cde487fef0fe66df2aa5906aaef21b093102e590f5f5

Contents?: true

Size: 994 Bytes

Versions: 1

Compression:

Stored size: 994 Bytes

Contents

use super::*;

use crate::Flags;

#[test]
fn cases() {
    case(false, TestFlags::empty(), TestFlags::contains_unknown_bits);
    case(false, TestFlags::A, TestFlags::contains_unknown_bits);

    case(
        true,
        TestFlags::ABC | TestFlags::from_bits_retain(1 << 3),
        TestFlags::contains_unknown_bits,
    );

    case(
        true,
        TestFlags::empty() | TestFlags::from_bits_retain(1 << 3),
        TestFlags::contains_unknown_bits,
    );

    case(false, TestFlags::all(), TestFlags::contains_unknown_bits);

    case(false, TestZero::empty(), TestZero::contains_unknown_bits);
}
#[track_caller]
fn case<T: Flags + std::fmt::Debug>(expected: bool, value: T, inherent: impl FnOnce(&T) -> bool) {
    assert_eq!(
        expected,
        inherent(&value),
        "{:?}.contains_unknown_bits()",
        value
    );
    assert_eq!(
        expected,
        Flags::contains_unknown_bits(&value),
        "Flags::contains_unknown_bits({:?})",
        value
    );
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/bitflags-2.8.0/src/tests/unknown.rs