Created
October 6, 2014 06:13
-
-
Save PuercoPop/674c4e7aac989ff8725b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(defpackage :famiclom-tests* | |
(:use :cl :famiclom :hu.dwim.stefil)) | |
(in-package :famiclom-tests*) | |
(defsuite (input-suite :in root-suite) | |
(run-child-tests)) | |
(in-suite input-suite) | |
;; Buttoms should not be set on 0 | |
;; Buttons should be set on 1 | |
;; Strobe should reset on 1 (or 0) | |
(deftest buttons-should-not-be-set-on-read () | |
"Buttons should not be set while on read mode" | |
(let ((pad (famiclom::make-pad))) | |
(famiclom::read-mode pad) | |
(famiclom::set-key :B pad 1) | |
(is (eql 0 (famiclom::get-button :B pad))))) | |
(deftest buttons-should-be-set-on-write () | |
"Buttons should be set while on write mode" | |
(let ((pad (famiclom::make-pad))) | |
(famiclom::write-mode pad) | |
(famiclom::set-key :B pad 1) | |
(is (eql 1 (famiclom::get-button :B pad))))) | |
(deftest reset-strobe-should-reset () | |
(let ((pad (famiclom::make-pad))) | |
;; Do Stuff | |
(famiclom::next-state pad) | |
(setf (famiclom::pad-buttons pad) #*11000011) | |
(famiclom::reset-strobe pad) | |
(is (eq :a (car (famiclom::pad-strobe pad)))) | |
(is (equal #*00000000 (famiclom::pad-buttons pad))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment