Skip to content

Commit 1850182

Browse files
change up autotest.py
1 parent 0cbbb41 commit 1850182

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

autotest.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@
66

77
TESTS = r"""
88
9-
(defvar errors 0)
9+
(defvar errors nil)
1010
(defvar crashes 0)
1111
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+
(defun aeq (testname x y)
13+
(unless (or (and (floatp x)
14+
(floatp y)
15+
(< (abs (- x y)) 0.000005))
16+
(equal x y))
17+
(let (b (assoc testname errors))
18+
(if b (incf (cdr b))
19+
(push (cons testname 1) errors)))
20+
(format t "~a fail: expected ~a, got ~a~%" testname x y)))
1321
1422
#| Symbols |#
1523
@@ -23,10 +31,10 @@
2331
(aeq 'let 88 (let ((abcdefgh 88)) abcdefgh))
2432
(aeq 'let 99 (let ((abcdefghi 99)) abcdefghi))
2533
(aeq 'let 1010 (let ((abcdefghij 1010)) abcdefghij))
26-
(aeq 'let "ab9" (princ-to-string 'ab9))
27-
(aeq 'let t (eq 'me 'me))
28-
(aeq 'let t (eq 'fishcake 'fishcake))
29-
(aeq 'let nil (eq 'fishcak 'fishca))
34+
(aeq 'princ-to-string "ab9" (princ-to-string 'ab9))
35+
(aeq 'eq t (eq 'me 'me))
36+
(aeq 'eq t (eq 'fishcake 'fishcake))
37+
(aeq 'eq nil (eq 'fishcak 'fishca))
3038
3139
#| Arithmetic |#
3240
@@ -783,12 +791,12 @@
783791
784792
#| errors |#
785793
786-
(format t "~%~a errors, ~a crashes~%" errors crashes)
794+
(format t "~%Failing tests:~%~{~a~%~}~%~a tests crashed." errors crashes)
787795
788796
"""
789797

790798

791-
def talk(string, port, ttw=0.1):
799+
def talk(string: str, port: serial.Serial, ttw: float = 0.1):
792800
port.reset_output_buffer()
793801
port.write(string.encode())
794802
time.sleep(ttw)
@@ -810,5 +818,5 @@ def test():
810818
if "Error:" in text or "Error in" in text:
811819
talk("(incf crashes)", port)
812820

813-
test()
814821

822+
test()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy