Function: PARTITION-RESULTS

Source

(defun partition-results (results-list)
  (let ((num-checks (length results-list)))
    (destructuring-bind (passed skipped failed unknown)
	(partitionx results-list
		    (lambda (res)
		      (typep res 'test-passed))
		    (lambda (res)
		      (typep res 'test-skipped))
		    (lambda (res)
		      (typep res 'test-failure))
		    t)
      (if (zerop num-checks)
	  (values 0
		  nil 0 0
		  nil 0 0
		  nil 0 0
		  nil 0 0)
	  (values
	   num-checks
	   passed (length passed) (floor (* 100 (/ (length passed) num-checks)))
	   skipped (length skipped) (floor (* 100 (/ (length skipped) num-checks)))
	   failed (length failed) (floor (* 100 (/ (length failed) num-checks)))
	   unknown (length unknown) (floor (* 100 (/ (length failed) num-checks))))))))
Source Context