Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
racket-version: ["7.7", "current"]
racket-variant: ["regular", "CS"]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- uses: Bogdanp/setup-racket@v0.8
with:
architecture: x64
Expand Down Expand Up @@ -38,12 +38,12 @@ jobs:
# are in the `plot-test` package, so we don't expect any tests here, but
# just in case someone wrote a test module...

- run: sudo xvfb-run raco test --no-run-if-absent --deps --package plot
- run: sudo xvfb-run raco test --deps --package plot

# Install the plot-test package and run the tests

- run: sudo raco pkg install --batch --auto plot-test
- run: sudo xvfb-run raco test --no-run-if-absent --package plot-test
- run: sudo xvfb-run raco test --package plot-test

# If any of the plot-test tests failed, they will generate new draw step
# files and sample images. Upload these as an Github Actions Artifact,
Expand All @@ -52,5 +52,5 @@ jobs:
- uses: actions/upload-artifact@v2
if: failure()
with:
name: 'Updated Data Files'
path: plot-test/plot/tests/auto/data/new-*
name: New Test Data Files ${{ matrix.racket-version }} ${{ matrix.racket-variant }}
path: plot-test/plot/tests/**/test-data/new-*
52 changes: 40 additions & 12 deletions plot-test/plot/tests/PRs/13620.rkt
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
#lang racket
(require rackunit
plot
plot/utils
racket/draw
racket/runtime-path
"../helpers.rkt")

;; These tests pass when they terminate
;; https://github.com/racket/gnats-bugs/blob/7e4bb9a65cd4783bef9936b576c5e06a5da3fb01/all/13620

(require plot)
(define (do-plot-contour-intervals output-fn)
(output-fn (contour-intervals * -1 1 -1 1 #:alphas '())))

(printf "The following three plots should be blank:~n")
(plot (contour-intervals * -1 1 -1 1 #:alphas '()))
(plot3d (contour-intervals3d * -1 1 -1 1 #:alphas '()))
(plot3d (isosurfaces3d * -1 1 -1 1 -1 1 #:alphas '()))
(define (do-plot-contour-intervals3d output-fn)
(output-fn (contour-intervals3d * -1 1 -1 1 #:alphas '())))

(with-handlers ([exn? (λ (_) (void))])
(plot (stacked-histogram (list (vector 'a 1))
#:alphas '())))
(define (do-plot-isosurface3d output-fn)
(output-fn (isosurfaces3d * -1 1 -1 1 -1 1 #:alphas '())))

(with-handlers ([exn? (λ (_) (void))])
(plot3d (stacked-histogram3d (list (vector 'a 'a 1))
#:alphas '())))
(define-runtime-path gnats13620-ci-data "./test-data/gnats13620-ci.dat")
(define-runtime-path gnats13620-ci3d-data "./test-data/gnats13620-ci3d.dat")
(define-runtime-path gnats13620-is3d-data "./test-data/gnats13620-is3d.dat")

(define gnats13620-test-suite
(test-suite
"GNATS#13620: stacked-histogram loops when given an empty list of labels"
(test-case "gnats13620-contour-intervals"
(check-draw-steps do-plot-contour-intervals gnats13620-ci-data))
(test-case "gnats13620-contour-intervals3d"
(check-draw-steps-3d do-plot-contour-intervals3d gnats13620-ci3d-data))
(test-case "gnats13620-isosurface3d"
(check-draw-steps-3d do-plot-isosurface3d gnats13620-is3d-data))
(test-case "gnats13620-stacked-histogram"
;; Should fail with a "could not determine sensible plot bounds" message
(check-exn
exn:fail?
(lambda () (plot (stacked-histogram (list (vector 'a 1)) #:alphas '())))))
(test-case "gnats13620-histogram3d"
;; Should fail with a "could not determine sensible plot bounds" message
(check-exn
exn:fail?
(lambda () (plot3d (stacked-histogram3d (list (vector 'a 'a 1)) #:alphas '())))))))

(module+ test
(require rackunit/text-ui)
(run-tests gnats13620-test-suite))
56 changes: 36 additions & 20 deletions plot-test/plot/tests/PRs/24.rkt
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
#lang racket/base
(require plot plot/utils)
#lang racket
(require rackunit
plot
plot/utils
racket/draw
racket/runtime-path
"../helpers.rkt")

;; Tests for: https://github.com/racket/plot/pull/24

;; Plot all `known-point-symbols`.
;; This test succeeds when it terminates.
(define (do-plot output-fn)
(define NUM-ROWS 3)
(define YOFFSET 4)
(parameterize ([plot-x-axis? #f]
[plot-y-axis? #f]
[plot-x-far-axis? #f]
[plot-y-far-axis? #f]
[plot-decorations? #f])
(output-fn
(for/list ([s (in-list known-point-symbols)]
[i (in-naturals)])
(points (list (list (modulo i NUM-ROWS) (- (* YOFFSET (quotient i NUM-ROWS)))))
#:sym s
#:size 10))
#:x-min -1
#:x-max NUM-ROWS
#:y-min (- (* YOFFSET (add1 (quotient (length known-point-symbols) NUM-ROWS))))
#:y-max 1)))

(define-runtime-path pr24-data "./test-data/pr24.dat")

(define NUM-ROWS 3)
(define YOFFSET 4)
(define pr24-test-suite
(test-suite
"PR#24: Fix typo, 'cirlce2' => 'circle2'"
(test-case "pr24" (check-draw-steps do-plot pr24-data))))

(parameterize ([plot-x-axis? #f]
[plot-y-axis? #f]
[plot-x-far-axis? #f]
[plot-y-far-axis? #f]
[plot-decorations? #f])
(plot
(for/list ([s (in-list known-point-symbols)]
[i (in-naturals)])
(points (list (list (modulo i NUM-ROWS) (- (* YOFFSET (quotient i NUM-ROWS)))))
#:sym s
#:size 10))
#:x-min -1
#:x-max NUM-ROWS
#:y-min (- (+ 1 (* YOFFSET (quotient (length known-point-symbols) NUM-ROWS))))
#:y-max 1))
(module+ test
(require rackunit/text-ui)
(run-tests pr24-test-suite))
Loading