Skip to content

Lab3: Ex 4 #6

@BertLisser

Description

@BertLisser
-- Generators for exercise 2 and 4 - By Michael {
formNProps :: Int -> Int -> Gen Form
formNProps maxProp 0 = liftM Prop (choose (1, maxProp))
formNProps maxProp n | n > 0 = oneof [liftM Prop (choose (1, maxProp)), liftM Neg subform,
                                      liftM Cnj (vectorOf 2 subform), liftM Dsj (vectorOf 2 subform),
                                      liftM2 Impl subform subform, liftM2 Equiv subform subform]
where subform = formNProps maxProp (n - 1)

You missed important test cases. Namely Dsj and Cnj with a list of variable length (the empty list included)

I have only looked at the quickCheck testing. The manually test random generation is difficult to follow, which all these cases.

Well done (=9)

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