Code Monkey home page Code Monkey logo

rackcheck's Introduction

rackcheck

A property-based testing library for Racket with support for shrinking.

Setup

raco pkg install rackcheck

Usage

See the examples directory.

What about quickcheck?

I initially started out by forking the existing quickcheck library to add support for shrinking, but that required making many breaking changes so I figured I'd start from scratch instead.

License

rackcheck is licensed under the 3-Clause BSD license.

rackcheck's People

Contributors

bogdanp avatar laelath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rackcheck's Issues

gen:integer-in with lo = hi

The contract checks if hi > lo. I believe that's a mistake. According to the documentation: "A contract error is raised if lo is greater than hi", the correct check should be hi >= lo.

This behavior of gen:integer-in also affects gen:frequency; when gen:frequency has a single pair in the list, I will get a contract error from gen:integer-in (which I assume gen:frequency somehow depends on?).

A Potential Bug in the usage of Random Function

It might be my my fault somehow, but when I'm running a property I sometimes get

random: difference between first and second arguments is greater than 4294967087

as the error. My generators are rather naive and simple, that's why I thought it might be a bug with the library.

(define gen:kv (gen:tuple gen:natural gen:natural))

(define gen:kvlist (gen:list gen:kv))

(define bespoke
    (gen:let ([kvs gen:kvlist])
        (foldl insert_correct (E) kvs))       
)

Where insert_correct inserts a key-value pair to a binary search tree.

Is there any way I can provide you with more information? (the debug traces in Racket did not seem to help too much) How can I resolve this problem?

Raco complains about missing `rackcheck/main.rkt`

I think this is a consequence of the re-organisation from #8

It looks like the examples/ files are using (require rackcheck), and that's causing Racket to look for a non-existent rackcheck/main.rkt file as per the Racket docs:

when an id has no /, then /main is automatically added to the end. Thus, racket or racket/main refers to the module whose source is the "main.rkt" file in the "racket" collection.

It could be that I'm just DoingItWrong™, since I'm not super familiar with Racket/Raco. I encountered this problem when using Nix to wrap a Racket interpreter with env vars that point to a pre-fetched, pre-compiled, immutable copy of rackcheck. The code I'm using (including raco commands, etc.) are here, although this same code has been working for other packages since 2016.

Here's the error log I'm getting:

.raco-wrapped: version: 8.9
.raco-wrapped: platform: aarch64-linux [cs]
.raco-wrapped: target machine: tarm64le
.raco-wrapped: installation name: 8.9
.raco-wrapped: variants: cs
.raco-wrapped: main collects: /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/
.raco-wrapped: collects paths: 
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/etc/.local/share/racket/8.9/collects
.raco-wrapped:   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/
.raco-wrapped: main pkgs: /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/pkgs
.raco-wrapped: pkgs paths: 
.raco-wrapped:   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/pkgs
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/etc/.local/share/racket/8.9/pkgs
.raco-wrapped: links files: 
.raco-wrapped:   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/links.rktd
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/etc/.local/share/racket/8.9/links.rktd
.raco-wrapped: compiled-file roots: 
.raco-wrapped:   same
.raco-wrapped:   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/lib/racket/compiled
.raco-wrapped: main docs: /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/doc/racket
.raco-wrapped: --- updating info-domain tables ---                    [21:17:04]
.raco-wrapped: updating: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/etc/.local/share/racket/8.9/share/info-cache.rktd
.raco-wrapped: --- pre-installing collections ---                     [21:17:04]
.raco-wrapped: --- installing foreign libraries ---                   [21:17:04]
.raco-wrapped: --- installing shared files ---                        [21:17:04]
.raco-wrapped: --- compiling collections ---                          [21:17:04]
.raco-wrapped: making: <collects>/racket
.raco-wrapped: --- parallel build using 4 jobs ---                    [21:17:04]
.raco-wrapped: 3 making: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/.github
.raco-wrapped: 3 making: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/.github/workflows
.raco-wrapped: 3 making: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples
.raco-wrapped: 2 making: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck
.raco-wrapped: 1 making: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck-lib
/nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/coin.rkt:24:11: cannot open module file
  module path: rackcheck
  path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
  system error: no such file or directory; rkt_err=3
  compilation context...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/coin.rkt
  location...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/coin.rkt:24:11
  context...:
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:452:15
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:441:12: build
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:412:0: maybe-compile-zo
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:210:0: compile-root
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:105:4
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-build.rkt:332:9
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:456:25
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:442:20: loop
/nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/distance.rkt:13:11: cannot open module file
  module path: rackcheck
  path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
  system error: no such file or directory; rkt_err=3
  compilation context...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/distance.rkt
  location...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/distance.rkt:13:11
  context...:
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:452:15
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:441:12: build
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:412:0: maybe-compile-zo
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:210:0: compile-root
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:105:4
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-build.rkt:332:9
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:456:25
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:442:20: loop
/nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/json.rkt:5:11: cannot open module file
  module path: rackcheck
  path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
  system error: no such file or directory; rkt_err=3
  compilation context...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/json.rkt
  location...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/json.rkt:5:11
  context...:
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:452:15
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:441:12: build
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:412:0: maybe-compile-zo
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:210:0: compile-root
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:105:4
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-build.rkt:332:9
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:456:25
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:442:20: loop
/nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/list.rkt:4:11: cannot open module file
  module path: rackcheck
  path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
  system error: no such file or directory; rkt_err=3
  compilation context...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/list.rkt
  location...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/list.rkt:4:11
  context...:
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:452:15
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:441:12: build
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:412:0: maybe-compile-zo
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:210:0: compile-root
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:105:4
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-build.rkt:332:9
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:456:25
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:442:20: loop
/nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/ring.rkt:40:11: cannot open module file
  module path: rackcheck
  path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
  system error: no such file or directory; rkt_err=3
  compilation context...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/ring.rkt
  location...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/ring.rkt:40:11
  context...:
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:452:15
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:441:12: build
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:412:0: maybe-compile-zo
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:210:0: compile-root
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:105:4
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-build.rkt:332:9
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:456:25
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:442:20: loop
/nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/web-api.rkt:93:11: cannot open module file
  module path: rackcheck
  path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
  system error: no such file or directory; rkt_err=3
  compilation context...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/web-api.rkt
  location...:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/web-api.rkt:93:11
  context...:
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:452:15
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:441:12: build
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:412:0: maybe-compile-zo
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:210:0: compile-root
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/compiler/private/cm-minimal.rkt:105:4
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-build.rkt:332:9
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:456:25
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-do.rkt:442:20: loop
.raco-wrapped: 1 making: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck-lib/gen
.raco-wrapped: --- installing collections ---                         [21:17:37]
.raco-wrapped: installing: <collects>/racket
.raco-wrapped: installing: <pkgs>/gui-lib/mred
.raco-wrapped: installing: <pkgs>/gui-lib/racket/gui
.raco-wrapped: installing: <pkgs>/mzscheme-lib/mzscheme
.raco-wrapped: installing: <pkgs>/racket-doc/help
.raco-wrapped: --- post-installing collections ---                    [21:17:37]
.raco-wrapped: --- checking package dependencies ---                  [21:17:37]
.raco-wrapped: --- summary of errors ---                              [21:17:37]
.raco-wrapped: error: during making for /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/coin.rkt:24:11: cannot open module file
.raco-wrapped:     module path: rackcheck
.raco-wrapped:     path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
.raco-wrapped:     system error: no such file or directory; rkt_err=3
.raco-wrapped:     compiling: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/coin.rkt
.raco-wrapped: error: during making for /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/distance.rkt:13:11: cannot open module file
.raco-wrapped:     module path: rackcheck
.raco-wrapped:     path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
.raco-wrapped:     system error: no such file or directory; rkt_err=3
.raco-wrapped:     compiling: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/distance.rkt
.raco-wrapped: error: during making for /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/json.rkt:5:11: cannot open module file
.raco-wrapped:     module path: rackcheck
.raco-wrapped:     path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
.raco-wrapped:     system error: no such file or directory; rkt_err=3
.raco-wrapped:     compiling: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/json.rkt
STDERR:
standard-module-name-resolver: collection not found
  for module path: rackcheck/gen/unicode
  collection: "rackcheck/gen"
  in collection directories:
   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/etc/.local/share/racket/8.9/collects
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/
   ... [167 additional linked and package directories]
  context...:
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/syntax/private/modresolve-noctc.rkt:60:0: resolve-module-path
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/racket/contract/private/arrow-val-first.rkt:489:18
   /nix/store/9ds73ksn2qxgr6cag3047r643qnv68df-racket-8.9/share/racket/collects/setup/parallel-build.rkt:405:3
=====
.raco-wrapped: error: during making for /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/list.rkt:4:11: cannot open module file
.raco-wrapped:     module path: rackcheck
.raco-wrapped:     path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
.raco-wrapped:     system error: no such file or directory; rkt_err=3
.raco-wrapped:     compiling: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/list.rkt
.raco-wrapped: error: during making for /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/ring.rkt:40:11: cannot open module file
.raco-wrapped:     module path: rackcheck
.raco-wrapped:     path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
.raco-wrapped:     system error: no such file or directory; rkt_err=3
.raco-wrapped:     compiling: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/ring.rkt
.raco-wrapped: error: during making for /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples
.raco-wrapped:   /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/web-api.rkt:93:11: cannot open module file
.raco-wrapped:     module path: rackcheck
.raco-wrapped:     path: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/rackcheck/main.rkt
.raco-wrapped:     system error: no such file or directory; rkt_err=3
.raco-wrapped:     compiling: /nix/store/pvsn3v3h7k832zl89sbc3vd3yi3w4d3d-racket-8.9-with-deps/share/pkgs/pylcr4fhgwk4rckzjazivwsdnr8s97pn-source/examples/web-api.rkt

Introduce a gen:hash alternative for mappings

Would it be worth adding an alternative to the gen:hash, gen:hasheq, and gen:hasheqv forms that doesn't require hardcoding the keys?

Motivation: One alternative use of a hashtable involves mapping from arbitrary keys to values. However, the current gen:hash implementation expects the hardcoding of keys, such that the generated hashtables all have the same keys. This current implementation is useful for generating hashtables that represent jsexprs of some constant structure but is quite limiting for the other use/purpose.

An example of this alternative use would be a mapping of string IDs to naturals (maybe representing a score of some type). However, generating something like this is cumbersome (lifting+modifying this from the examples):

(define gen:mapping
  (gen:let ([keys&vals (gen:list (gen:tuple (gen:string gen:char-alphanumeric) gen:natural) #:max-length 5)])
    (make-immutable-hasheq keys&vals)))

Introducing such a generator for the mappings, however, would make it considerably more concise (assume gen:hash* represents that generator):

(define gen:mapping (gen:hash* (gen:string gen:char-alphanumeric) gen:natural))

Could this just be implemented by the users? Yes, but currently my stance is that the library itself should support this.

Streams aren't a general enough abstraction for efficient shrinking

I'm writing a generator for program expressions, which means that the number of possible shrinks for every statement grows exponentially with the height of the program. When shrinking something like an if statement you want to shrink on the predicate, shrink either or both of the branches, or produce all the shrinks of the branches. It's possible to prune many shrinks by assuming that if one shrink passes, all the shrinks of that shrink will (i.e. if the shrink to just one of the branch passes, then we can ignore all the shrinks of that branch).

The only way I can think of to do this currently would be to pass the property being checked into the generator so it could use it for manually shrinking the expression, which is flagrantly breaking the abstraction.

Another quirk with the streams is that the only way to get a sensible ordering of the shrinks is to sort based on some expression size function, but doing that is way too costly for the number of shrinks that are produced.

Modular package

Hi

Currently in rackcheck package depends on scribble, racket-doc etc, because it is single package.

Would it be possible to make it more modular e.g. by splitting it into rackcheck-lib and rackcheck containing both rackcheck-lib and docs like base64?

Even more modular approach would be to have rackcheck-lib, rackcheck-doc and rackcheck like in crypto.

This would allow building faster & smaller docker images by using rackcheck-lib.

Typing

I was thinking about adding typed/racket support to this library. There's a lot of ways to do this. Here's some ways that look simple enough to me.

  • We could make a new dir within rackcheck-lib called typed and re-export everything from rackcheck.
  • The same, but within a new lib rackcheck-typed

Alternatively (or even in parallel?), one could gradually type the library and get it to work that way.

What do you think?

Specifying custom size function causes contract error

Minimal test case:

> (check-property
   (make-config #:size identity)
   (property () #t))
--------------------
ERROR
location:   2-interactions from an unsaved editor:31:2
name:       unnamed
seed:       433968128
params:     '(#<prop> #<config>)

make-config: broke its own contract
  promised: exact-positive-integer?
  produced: 0
  in: the 1st argument of
      the #:size argument of
      (->*
       ()
       (#:deadline
        (>=/c 0)
        #:seed
        (integer-in 0 2147483647)
        #:size
        (-> exact-positive-integer? natural?)
        #:tests
        exact-positive-integer?)
       config?)
  contract from: (function make-config)
  blaming: (function make-config)
   (assuming the contract is correct)
  at: <pkgs>/rackcheck/prop.rkt:65:18
--------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.