aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Olaechea <pirata@gmail.com>2020-05-16 23:48:05 -0500
committerJavier Olaechea <pirata@gmail.com>2020-05-16 23:48:05 -0500
commit0b629f7be3ccc998c583ac5d360b38f00c0f53ea (patch)
tree7ae0a65f73ed1242ea945e13582e4a2869f991e4
parentec95613c14361abb3eb6956b53680ef136b37118 (diff)
downloadcl-xcb-0b629f7be3ccc998c583ac5d360b38f00c0f53ea.tar.gz
Test the code that models XCB types
-rw-r--r--cl-xcb.asd1
-rw-r--r--tests/lang/types.lisp38
2 files changed, 39 insertions, 0 deletions
diff --git a/cl-xcb.asd b/cl-xcb.asd
index ed977f9..13e309a 100644
--- a/cl-xcb.asd
+++ b/cl-xcb.asd
@@ -29,6 +29,7 @@
:components ((:module "lang"
:components ((:file "package")
(:file "enum")
+ (:file "types")
(:file "mop")))
(:file "package")
(:file "parse-display")
diff --git a/tests/lang/types.lisp b/tests/lang/types.lisp
new file mode 100644
index 0000000..49964ce
--- /dev/null
+++ b/tests/lang/types.lisp
@@ -0,0 +1,38 @@
+;; CL-XCB is a Common Lisp implementation of the XCB protocol.
+;; Copyright (C) 2018 Javier Olaechea <pirata@gmail.com>
+
+;; This program is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU Affero General Public License
+;; as published by the Free Software Foundation, either version 3 of
+;; the License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; Affero General Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public
+;; License along with this program. If not, see
+;; <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(in-package "XCB-LANG/TESTS")
+
+(deftest test-type-size ()
+ (let ((card8 (gethash :card8 xcb/lang::*type-info*))
+ (card16 (gethash :card16 xcb/lang::*type-info*)))
+ (is (= (xcb/lang::type-size card8)
+ 1))
+ (is (= (xcb/lang::type-size card16)
+ 2))))
+
+(deftest test-type-kind ()
+ (let ((card8 (gethash :card8 xcb/lang::*type-info*)))
+ (is (eq (xcb/lang::kind card8)
+ :fixed))))
+
+(deftest test-type-alias ()
+ (let ((cookie (gethash :cookie xcb/lang::*type-info*)))
+ (is (= (xcb/lang::type-size cookie)
+ 2))))