Skip to content

Commit

Permalink
refile the failing test (it now passes)
Browse files Browse the repository at this point in the history
  • Loading branch information
countvajhula committed Aug 11, 2024
1 parent 2bd0f6e commit 85d29b8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
19 changes: 8 additions & 11 deletions qi-test/tests/compiler/rules/deforest.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@
(test-suite
"deforestation"
;; Note that these test deforestation in isolation
;; without necessarily taking normalization (a preceding
;; step in compilation) into account
;; *without* taking normalization (a preceding
;; step in compilation) into account.
;; If a test is failing that you are expecting should pass,
;; it could be that it implicitly assumes that normalization
;; will be done, so double check this.
;; For testing behavior of the full cycle of compilation
;; involving normalization as well as deforestation, use the
;; `full-cycle.rkt` test module.

(test-suite
"deforest-pass"
Expand Down Expand Up @@ -90,15 +96,6 @@
(deforest-pass
(expand-flow
#'(>< (~> (filter odd?) (map sqr))))))))
;; TODO: this test fails because normalization would not collapse
;; forms with different threading directions, but in some cases
;; (like this test), deforestation should not care about the chirality
;; difference.
;; (test-true "nested, different threading direction"
;; (deforested? (phase1-eval
;; (deforest-pass
;; (expand-flow
;; #'(~> (filter odd?) (~>> (map sqr))))))))
(test-case "multiple independent positions"
(let ([stx (phase1-eval
(deforest-pass
Expand Down
13 changes: 12 additions & 1 deletion qi-test/tests/compiler/rules/full-cycle.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@
(deforested?
(phase1-eval
(qi-compile
#'(~>> (filter odd?) values (map sqr)))))))))
#'(~>> (filter odd?) values (map sqr))))))
;; We expect the Qi expander to translate threading direction simply to
;; chirality of individual contained forms (indicated by the presence of
;; a blanket template on either side) if they are applications of host
;; language functions, and to leave them unchanged if they are syntactic
;; forms (where chirality is irrelevant). We also expect normalization
;; to collapse nested threading forms, so that the following should be
;; deforested.
(test-true "nested, different threading direction"
(deforested? (phase1-eval
(qi-compile
#'(~> (filter odd?) (~>> (map sqr))))))))))

(module+ main
(void
Expand Down

0 comments on commit 85d29b8

Please sign in to comment.