Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Fuzzer.date #215

Open
joshhornby opened this issue Nov 17, 2017 · 1 comment
Open

Fuzzer.date #215

joshhornby opened this issue Nov 17, 2017 · 1 comment
Labels

Comments

@joshhornby
Copy link

After looking through the docs I was surprised to not find a fuzzer for dates.

After asking on Slack @zwilias said:

You could potentially do something like fuzzing a float in a certain range and doing map Date.fromTime on that
you'd have to figure out what sort of granularity and range you want, though

I think it would be nice to have a date fuzzer in this package, so opening an issue for further discussions

@liamcurry
Copy link

liamcurry commented Dec 6, 2017

Here are some possible implementations (untested):

import Fuzz exposing (..)
import Date exposing (Date)
import Time exposing (Time)


time : Fuzzer Time
time =
    map ((*) Time.second) <| Fuzz.floatRange 0 2524608000


date : Fuzzer Date
date =
    map Date.fromTime time

@mgold mgold added the fuzzers label Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants