A way to run all tests in one go.

This commit is contained in:
Erik Svedäng 2017-09-08 12:24:57 +02:00
parent a6051220fe
commit 8cae7a7a3b
16 changed files with 50 additions and 15 deletions

View File

@ -2,4 +2,5 @@
(register println (Fn [(Ref String)] ()))
(register print (Fn [(Ref String)] ()))
(register get-line (Fn [] String))
(register exit (Fn [Int] a))
)

View File

@ -14,5 +14,7 @@
(register from-string (Fn [(Ref String)] Int))
(register mask (Fn [Int Int] Bool))
(register inc (Fn [Int] Int))
(register dec (Fn [Int] Int)))
(register dec (Fn [Int] Int))
(register copy (Fn [(Ref Int)] Int)) ;; TODO: Should not be needed when refs to value types are auto-converted to non-refs.
)

View File

@ -47,6 +47,8 @@ int Int__GT_(x, y) { return x > y; }
int Int_inc(int x) { return x + 1; }
int Int_dec(int x) { return x - 1; }
int Int_copy(int *x) { return *x; }
#define Double__PLUS_(x, y) ((x) + (y))
#define Double__MINUS_(x, y) ((x) - (y))
#define Double__MUL_(x, y) ((x) * (y))

View File

@ -6,17 +6,17 @@
[4 5 6]
[7 8 9]])
(defn excl [x] (String.append x "!"))
(defn excl [x] (String.append x @"!"))
(defn main []
(let [a (Array.range 1 10)
(let [a [0 1 2 3 4 5 6 7 8 9]
;;b (Array.replicate 5 (ref "hej"))
]
(do
(println (ref (Int.str (nth (ref a) 5))))
(println (ref (str (ref (range 10 20)))))
(println (ref (str (ref (map excl (replicate 5 "Hi"))))))
;; (println (ref (str (ref ["hej" "san" "!"]))))
(println (ref (Int.str (Int.copy (nth (ref a) 5)))))
(println (ref (str &[10 11 12 13 14 15])))
x(println (ref (str (ref (map excl (replicate 5 @"Hi"))))))
(println (ref (str (ref [@"hej" @"san" @"!"]))))
;; (println (ref (str (nth (ref (nested)) 0))))
;; (println (ref (str (nth (ref (nested)) 1))))
;; (println (ref (str (nth (ref (nested)) 2))))

View File

@ -153,3 +153,4 @@
(build)
(run)
(quit)

View File

@ -15,3 +15,7 @@
a1 [(C.copy &c2) (C.copy &c2) (C.copy &c2)]
a2 (copy &a1)]
(IO.println "OK.")))
(build)
(run)
(quit)

View File

@ -11,3 +11,7 @@
(defn main []
(do (f)
(println "OK.")))
(build)
(run)
(quit)

View File

@ -29,3 +29,4 @@
(build)
(run)
(quit)

View File

@ -87,3 +87,6 @@
(handle-events app rend)
(draw rend &images)
(SDL_Delay 30)))))
(build)
(run)

View File

@ -54,3 +54,7 @@
;; (defn main []
;; (let [xs ["hej" "svej"]]
;; (println "yeah")))
(build)
(run)
(quit)

View File

@ -19,3 +19,4 @@
(build)
(run)
(quit)

View File

@ -52,3 +52,4 @@
(build)
(run)
(quit)

View File

@ -54,12 +54,7 @@
;; (println &"Yup.")))
(deftype Blahaha [s String])
(defn exclaim [x] (String.append x @"!"))
(defn main []
(let [;;x (Blahaha.init @"jahaja")
r [@"a" @"b" @"c"]]
(do
(println (nth &r 1))
;;(println (Blahaha.s &x))
)))
(println (ref (str (ref (map exclaim (replicate 5 @"Hi")))))))

View File

@ -27,3 +27,4 @@
(build)
(run)
(quit)

15
run_carp_tests.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
stack build;
stack exec Carp ./examples/basics.carp;
stack exec Carp ./examples/deleters.carp;
stack exec Carp ./examples/copying.carp;
stack exec Carp ./examples/polymorphic.carp;
stack exec Carp ./examples/selection.carp;
stack exec Carp ./examples/functor.carp;
stack exec Carp ./examples/vec2.carp;
#stack exec Carp ./examples/array.carp;
# Game will run until closed:
stack exec Carp ./examples/game.carp;

View File

@ -195,7 +195,7 @@ templateReplicate = defineTypeParameterizedTemplate templateCreator path t
, "}"]))
(\(FuncTy [_, _] arrayType) ->
let StructTy _ [insideType] = arrayType
in [defineArrayTypeAlias arrayType] ++ depsForDeleteFunc typeEnv env insideType)
in defineArrayTypeAlias arrayType : depsForDeleteFunc typeEnv env insideType)
templateRepeat :: (String, Binder)
templateRepeat = defineTypeParameterizedTemplate templateCreator path t