Skip to content

bug: printed shrink example is not actual input #24

@peter-jerry-ye

Description

@peter-jerry-ye

Example

///|
fn prop_deque(deque : (Deque, Int)) -> Bool {
  println("input: \{deque}")
  let (deque, n) = deque
  deque._.truncate(n)
  guard n < 0 || deque._.length() <= n else { return false }
  guard n > 0 || deque._.is_empty() else { return false }
  true
}

///|
type Deque @deque.T[Int] derive(Show)

///|
impl @quickcheck.Arbitrary for Deque with arbitrary(i, randomstate) {
  @deque.from_array(Array::arbitrary(i, randomstate))
}

test {
  @lib.quick_check_fn!(prop_deque)
}

Test with Core 532f2e8e4c5e041ba695c24ca69a50cc0005d7bd (where truncate has a bug)

Expected Output

*** [5/0/100] Failed! Falsified.
(Deque(@deque.of([])), -2)

Actual Output

*** [5/0/100] Failed! Falsified.
(Deque(@deque.of([])), 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions