Last active
October 9, 2017 22:39
-
-
Save tavurth/28201fc710a068852f6467fca15e0f4f to your computer and use it in GitHub Desktop.
cl-sdl2 test suite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ql:quickload :sdl2/examples) | |
(ql:quickload :glkit-examples) | |
(ql:quickload :sdl2kit-examples) | |
(defpackage :test | |
(:use :cl) | |
(:export :*is-new* :try-call)) | |
(in-package :test) | |
(use-package :kit.gl.test) | |
(use-package :kit.sdl2.test) | |
(use-package :sdl2-examples) | |
(defvar *is-new* nil) | |
(defvar *total-tests* 0) | |
(defvar *passed-tests* 0) | |
(defun try-call (name) | |
(lambda (f-name function) | |
(incf *total-tests*) | |
(with-simple-restart | |
(skip-test "Skip this test") | |
(format t "Trying function ~A:~A~%" name f-name) | |
(progn | |
(if *is-new* | |
;; New functions don't require conditionals | |
(funcall function) | |
;; Old functionality requires some wrapping | |
#+sbcl (sdl2:make-this-thread-main function) | |
#-sbcl (funcall function)) | |
(incf *passed-tests*))))) | |
(defun test-sdl2 () | |
(let ((tester (test:try-call "SDL2-example"))) | |
(funcall tester "Basic" #'sdl2-examples:basic-test) | |
;; (funcall tester "Cairo" #'sdl2-examples:cairo-test) ;; Isn't included in sdl2-examples package | |
(funcall tester "Renderer" #'sdl2-examples:renderer-test))) | |
(defun test-glkit () | |
(let ((tester (test:try-call "GL-example"))) | |
(funcall tester "Vaos" #'kit.gl.test:vaos) | |
(funcall tester "Vaos 120" #'kit.gl.test:vao-shader-120) | |
(funcall tester "Vaos 150" #'kit.gl.test:vao-shader-150) | |
(funcall tester "Vaos 330" #'kit.gl.test:vao-shader-330) | |
(funcall tester "Vaos 410" #'kit.gl.test:vao-shader-410))) | |
(defun test-sdl2kit () | |
(let ((tester (test:try-call "SDL2Kit-example"))) | |
(funcall tester "Test-window" (lambda () (make-instance 'kit.sdl2.test:test-window))) | |
(funcall tester "Cube-window" (lambda () (make-instance 'kit.sdl2.test:cube-window))) | |
(funcall tester "Simple-window" (lambda () (make-instance 'kit.sdl2.test:simple-window))))) | |
(test-sdl2) | |
(test-glkit) | |
(test-sdl2kit) | |
(format | |
t "Total: ~A~t~tPassed: ~A~%Percentage: ~A~%" | |
*total-tests* | |
*passed-tests* | |
(* (/ *passed-tests* *total-tests*)) 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment