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

Diff of /tests.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 14 by rklochkov, Sun Dec 23 06:59:28 2012 UTC revision 15 by rklochkov, Tue Dec 25 01:10:43 2012 UTC
# Line 10  Line 10 
10  (defcstruct* test  (defcstruct* test
11    (x :int))    (x :int))
12    
13  (deftest test.carray ()  (deftest test.struct ()
14    (is (= (let ((obj (make-instance 'test)))    (is (= (let ((obj (make-instance 'test)))
15             (setf (x obj) 1)             (setf (x obj) 1)
16             (x obj)) 1))             (x obj)) 1))
17      (is (= 1 (x (make-instance 'test :x 1)))))
18    
19    (deftest test.carray ()
20    (let ((obj (make-array 10)))    (let ((obj (make-array 10)))
21      (dotimes (i 10)      (dotimes (i 10)
22        (setf (aref obj i)        (setf (aref obj i)
23              (let ((struct (make-instance 'test)))              (let ((struct (make-instance 'test)))
24                (setf (x struct) i)                (setf (x struct) i)
25                struct)))                struct)))
26        (setf (mem-ref *array-length* :int) 10)
27      (is (every (lambda (a b) (= (x a) (x b)))      (is (every (lambda (a b) (= (x a) (x b)))
28                 obj                 obj
29                 (convert-from-foreign                 (convert-from-foreign
30                  (convert-to-foreign obj '(carray (struct test)))                  (convert-to-foreign obj '(carray (struct test)))
                 '(carray (struct test)))))))  
31                    '(carray (struct test)))))))

Legend:
Removed from v.14  
changed lines
  Added in v.15

  ViewVC Help
Powered by ViewVC 1.1.5