Clojurians
# test-check

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

gfredericks 14:40:52

I think test.check should have builtin generators for uniform doubles and uniform integers

gfredericks 14:41:24

since those can be useful tools for building other generators

gfredericks 14:41:35

each is a bit tricky though

gfredericks 14:41:59

A) for uniform doubles, should the value shrink? how exactly?

gfredericks 14:42:53

B) for uniform integers, how should the clj and cljs versions relate? clj could provide arbitrary ranges of integers, while cljs is natively limited to ±2^53

gfredericks 14:43:53

cljs could do something fancy where it allows goog integers as well as native integers and if you give it bounds outside of native integers it generates googs

gfredericks 14:44:31

(or would it be more correct to generate types based on the types you pass in? so if you give it a couple small googs for the range it still generates googs)

gfredericks 14:44:51

now that I've said "goog" so many times out loud I realize that a reasonable cljs approach is just to only support the native range

gfredericks 14:45:10

and have the generator constructor throw if you try to do anything else

gfredericks 15:00:03

okay I think I will do that. (gen/uniform-integer min-inclusive max-exclusive) and gen/uniform-double