Commit a7300f03 authored by Carl Shapiro's avatar Carl Shapiro
Browse files

Merge branch 'zero-tests' into 'master'

Guard against a division by zero when reporting test results

See merge request !161
parents 24152f4d 5b27393f
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -110,9 +110,10 @@
    (format t " ~5D tests failed~%" failed)
    (format t " ~5D tests failed~%" failed)
    (format t " ~5D tests with execution errors~%" execute-errors)
    (format t " ~5D tests with execution errors~%" execute-errors)
    (format t "~5,3f% of the tests passed~%"
    (format t "~5,3f% of the tests passed~%"
	    (float (* 100
	    (let ((total (+ passed failed execute-errors)))
		      (- 1 (/ (+ failed execute-errors)
	      (if (zerop total)
			      (+ passed failed execute-errors))))))
		  0.0
		  (* 100.0 (- 1.0 (/ (- total passed) total))))))
    ;; Print some info about any failed tests.  Then exit.  We want to
    ;; Print some info about any failed tests.  Then exit.  We want to
    ;; set the exit code so that any scripts runnning this can
    ;; set the exit code so that any scripts runnning this can
    ;; determine if there were any test failures.
    ;; determine if there were any test failures.