bugfix generative test case

This commit is contained in:
2021-08-04 20:08:05 -06:00
parent ed4a24a03d
commit 2c076d1ab0
2 changed files with 8 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
(defMacroVar maxExps 4)
(defMacroFunction _macroList [func length]
~(for _ (range length) (func)))
(for _ (range length) (func)))
(defMacro macroRepeat [exp length]
`(begin ,@(_macroList ->{exp} (eval length))))
@@ -12,7 +12,7 @@
(_macroList func (+ 2 (random (- maxExps 2)))))
(defMacroFunction _randomLetterString []
(ReaderExp.StrExp (apply + (for _ (range (random maxStringLength)) (chooseRandom (.split "abcdefghijklmnopqrstuvwxyz" ""))))))
(ReaderExp.StrExp (apply + (for _ (range (+ 1 (random (- maxStringLength 1)))) (chooseRandom (.split "abcdefghijklmnopqrstuvwxyz" ""))))))
(defMacroFunction _randomFalsyExp []
((chooseRandom
@@ -24,7 +24,7 @@
->{`(or ,@(_randomLengthMacroList _randomFalsyExp))}
->{`(and
,@(_randomLengthMacroList _randomUncertainExp)
(_randomFalsyExp)
,(_randomFalsyExp)
,@(_randomLengthMacroList _randomUncertainExp))}
])))
(defMacro randomFalsyExp []
@@ -46,10 +46,10 @@
->(_randomTruthyExp)
])))
(defMacro randomUncertainExp []
~(_randomUncertainExp))
(_randomUncertainExp))
(function _testTruthy []
(macroRepeat (Assert.isTrue ?(randomTruthyExp)) maxExps))
(macroRepeat (Assert.isTrue ?(randomTruthyExp)) 10))
(function _testFalsy []
(macroRepeat (Assert.isFalse ?(randomFalsyExp)) maxExps))
(macroRepeat (Assert.isFalse ?(randomFalsyExp)) 10))

View File

@@ -26,8 +26,8 @@
(doFor [name type] argPairs
(untypedArgs.push name)
(letBindings.push name)
(print type)
(print name)
// (print type)
// (print name)
(letBindings.push `(the ,type ,name)))
(print letBindings)
`(function ,name ,untypedArgs