/[cffi-objects]/tests.lisp
ViewVC logotype

Contents of /tests.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14 - (hide annotations)
Sun Dec 23 06:59:28 2012 UTC (15 months, 3 weeks ago) by rklochkov
File size: 767 byte(s)
Added tests
1 rklochkov 14 (defpackage #:cffi-objects.tests
2     (:use #:cl #:cffi-objects #:hu.dwim.stefil))
3    
4     (in-package #:cffi-objects.tests)
5    
6     (defsuite* (test-suite
7     :in root-suite
8     :documentation "Testing CFFI-objects"))
9    
10     (defcstruct* test
11     (x :int))
12    
13     (deftest test.carray ()
14     (is (= (let ((obj (make-instance 'test)))
15     (setf (x obj) 1)
16     (x obj)) 1))
17     (let ((obj (make-array 10)))
18     (dotimes (i 10)
19     (setf (aref obj i)
20     (let ((struct (make-instance 'test)))
21     (setf (x struct) i)
22     struct)))
23     (is (every (lambda (a b) (= (x a) (x b)))
24     obj
25     (convert-from-foreign
26     (convert-to-foreign obj '(carray (struct test)))
27     '(carray (struct test)))))))

  ViewVC Help
Powered by ViewVC 1.1.5