Skip to content

factor test failures #1841

@nicoonoclaste

Description

@nicoonoclaste

The test I added in #1831 is sometimes exhibiting an invariant violation:

---- factor::tests::exponentiate_factors stdout ----
thread 'factor::tests::exponentiate_factors' panicked at 'assertion failed: `(left == right)`
  left: `Some((18451, 2))`,
 right: `None`', src/uu/factor/src/factor.rs:33:9
stack backtrace:
   0: rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: uu_factor::factor::Decomposition::add
             at ./src/factor.rs:33:9
   3: uu_factor::factor::factor
             at ./src/factor.rs:209:25
   4: uu_factor::factor::tests::exponentiate_factors::prop
             at ./src/factor.rs:282:28
   5: <fn(A,B) .> T as quickcheck::tester::Testable>::result::{{closure}}
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:384:35
   6: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /build/rustc-1.49.0-src/library/std/src/panic.rs:322:9
   7: std::panicking::try::do_call
             at /build/rustc-1.49.0-src/library/std/src/panicking.rs:381:40
   8: __rust_try
   9: std::panicking::try
             at /build/rustc-1.49.0-src/library/std/src/panicking.rs:345:19
  10: std::panic::catch_unwind
             at /build/rustc-1.49.0-src/library/std/src/panic.rs:396:14
  11: quickcheck::tester::safe
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:415:5
  12: <fn(A,B) .> T as quickcheck::tester::Testable>::result
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:384:21
  13: quickcheck::tester::QuickCheck<G>::quicktest
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:134:19
  14: quickcheck::tester::QuickCheck<G>::quickcheck
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:176:36
  15: quickcheck::tester::quickcheck
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:196:5
  16: uu_factor::factor::tests::exponentiate_factors
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/lib.rs:65:21
  17: uu_factor::factor::tests::exponentiate_factors::{{closure}}
             at /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/lib.rs:61:17
  18: core::ops::function::FnOnce::call_once
             at /build/rustc-1.49.0-src/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'factor::tests::exponentiate_factors' panicked at '[quickcheck] TEST FAILED (runtime error). Arguments: (Factors(RefCell { value: Decomposition([(18451, 1), (3, 1)]) }), 3)
Error: "assertion failed: `(left == right)`\n  left: `Some((18451, 2))`,\n right: `None`"', /home/nicoo/.cargo/registry/src/github.com-1ecc6299db9ec823/quickcheck-0.9.2/src/tester.rs:178:28

I believe the bug was introduced when prototype PR #1571 was merged, or by one of the subsequent bug fixes.
Thanks a bunch @sylvestre for sending me the test failure you encountered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions