Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
/ quickcheck-derive Public archive

Procedural macro for deriving Quickcheck's Arbitrary trait

Notifications You must be signed in to change notification settings

kafji/quickcheck-derive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quickcheck Derive

Procedural macro for deriving Quickcheck's Arbitrary trait.

Usage

use quickcheck_derive::Arbitrary;

#[derive(Arbitrary, Clone)]
struct Person {
    name: String,

    #[arbitrary(generator = "gen_age")]
    age: u8,
}

fn gen_age(g: &mut quickcheck::Gen) -> u8 {
    use quickcheck::Arbitrary;
    loop {
        let age = u8::arbitrary(g);
        if age > 20 {
            break age;
        }
    }
}

Install

quickcheck-derive = { git = "https://github.com/kafji/quickcheck-derive", tag = "v0.2.2" }

About

Procedural macro for deriving Quickcheck's Arbitrary trait

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages