forked from carp-lang/Carp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c600890
commit 0dac8da
Showing
3 changed files
with
23 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(tester/set-suite! "correctness") | ||
|
||
(deftest test-mutate-global-struct | ||
(do (defstruct Blergh [x :int]) | ||
(defn x2 [x] | ||
(* x 2)) | ||
(defn double-blergh [b] | ||
(Blergh-update-x b x2)) | ||
(def x (Blergh 123)) | ||
(assert-eq "(Blergh 246)" (str (double-blergh x))) | ||
(assert-eq "(Blergh 246)" (str (double-blergh x))) | ||
(assert-eq "(Blergh 246)" (str (double-blergh x))))) | ||
|
||
(deftest test-mutate-global-array | ||
(do (def stuff [1 2 3 4 5]) | ||
(defn map-stuff [x] (map inc x)) | ||
(bake map-stuff) | ||
(assert-eq "[1 2 3 4 5]" (str (map-stuff stuff))) | ||
(assert-eq "[1 2 3 4 5]" (str (map-stuff stuff))) | ||
(assert-eq "[1 2 3 4 5]" (str (map-stuff stuff))))) | ||
|
||
(tester/run-suite "correctness") |