File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 6
6
7
7
TESTS = r"""
8
8
9
- (defvar ers 0)
9
+ (defvar errors 0)
10
+ (defvar crashes 0)
10
11
11
- (defun aeq (tst x y) (unless (or (and (floatp x) (floatp y) (< (abs (- x y)) 0.000005)) (equal x y)) (incf ers ) (format t "~a=~a/~a~%" tst x y)))
12
+ (defun aeq (testname x y) (unless (or (and (floatp x) (floatp y) (< (abs (- x y)) 0.000005)) (equal x y)) (incf errors ) (format t "~a=~a/~a~%" testname x y)))
12
13
13
14
#| Symbols |#
14
15
782
783
783
784
#| errors |#
784
785
785
- (aeq 'errors 0 ers)
786
+ (format t "~%~a errors, ~a crashes~%" errors crashes)
787
+
786
788
"""
787
789
788
790
789
791
def talk (string , port , ttw = 0.1 ):
790
792
port .reset_output_buffer ()
791
793
port .write (string .encode ())
792
794
time .sleep (ttw )
793
- sys .stdout .write (port .read (port .in_waiting ).decode ().replace ("\r \n " , "\n " ))
795
+ text = port .read (port .in_waiting ).decode ().replace ("\r \n " , "\n " )
796
+ sys .stdout .write (text )
797
+ return text
794
798
795
799
796
800
def test ():
@@ -802,7 +806,9 @@ def test():
802
806
803
807
for line in TESTS .split ("\n " ):
804
808
if line and line .startswith ("(" ):
805
- talk (line , port )
809
+ text = talk (line , port )
810
+ if "Error:" in text :
811
+ talk ("(incf crashes)" , port )
806
812
807
813
test ()
808
814
You can’t perform that action at this time.
0 commit comments