Skip to content

FCO/Test-Fuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status

Test::Fuzz

This module performs generative testing on Raku functions.

INSTALL

Install with:

zef install Test::Fuzz

Synopsis

use Test::Fuzz;

sub bla(Int $bla, Int $ble --> UInt) is fuzzed {
    $bla + $ble
}

sub ble(Int $ble) is fuzzed {
    die "it is prime!" if $ble.is-prime
}

sub bli(Str :$bli) is fuzzed {
    die "it's too long" unless $bli.chars < 10
}

sub blo("test") is fuzzed {
    "ok"
}

sub blu(Str $blu) {
    "ok";
}

fuzz &blu;

multi MAIN(Bool :$fuzz!) {
    run-tests
}

Description

Test::Fuzz is a tool for fuzzing or generative/fuzz testing.

Add the is fuzzed trait to a method or function and Test::Fuzz will try to figure out the best generators to use to test your function. If the function was already created without this trait, pass it to the fuzz function for the same effect.

To run the tests, just call the run-tests function.

INSTALLATION

    # with zef
    > zef install Test::Fuzz

    # or, with 6pm (https://github.com/FCO/6pm)
    > $ 6pm install Test::Fuzz

multi sub trait_mod:

multi sub trait_mod:<is>(
    Routine $func,
    :$fuzzed! (Any :$returns, :&test) where { ... }
) returns Mu

trait is fuzzed can receive params :returns and :test

multi sub trait_mod:

multi sub trait_mod:<is>(
    Routine $func,
    Bool :$fuzzed!
) returns Mu

trait is fuzzed

sub fuzz

sub fuzz(
    &func
) returns Mu

fuzz an existing sub

sub run-tests

sub run-tests(
    @funcs = Code.new,
    Int :$runs
) returns Nil

function that run fuzzed tests

class Mu $

if no specified the functions, it runs all fuzzed tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages