adding better native testing

This commit is contained in:
Paul R. Tagliamonte 2013-03-05 22:15:45 -05:00
parent da234b1d8f
commit 81d6a6515b
4 changed files with 28 additions and 0 deletions

View File

@ -33,6 +33,7 @@ def _ast_spotcheck(arg, root, secondary):
def test_ast_bad_type():
"Make sure AST breakage can happen"
try:
hy_compile("foo")
assert True == False

View File

@ -5,5 +5,6 @@ from hy.importer import import_file_to_module
def test_basics():
"Make sure the basics of the importer work"
module = import_file_to_module("basic",
"tests/resources/importer/basic.hy")

View File

@ -1,4 +1,5 @@
;
(def test_lists (fn []
"NATIVE: test lists work right"
(assert (= [1 2 3 4] (+ [1 2] [3 4])))))

View File

@ -1,5 +1,30 @@
; copyright ..
(def square (fn [x]
(* x x)))
(def test_basic_math (fn []
"NATIVE: Test basic math."
(assert (= (+ 2 2) 4))))
(def test_mult (fn []
"NATIVE: Test multiplication."
(assert (= 4 (square 2)))))
(def test_sub (fn []
"NATIVE: Test subtraction"
(assert (= 4 (- 8 4)))))
(def test_add (fn []
"NATIVE: Test addition"
(assert (= 4 (+ 1 1 1 1)))))
(def test_div (fn []
"NATIVE: Test division"
(assert (= 25 (/ 100 2 2)))))