+++ /dev/null
-;;; guile-irrlicht --- FFI bindings for Irrlicht Engine
-;;; Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
-;;;
-;;; This file is part of guile-irrlicht.
-;;;
-;;; Guile-irrlicht is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU Lesser General Public License as
-;;; published by the Free Software Foundation; either version 3 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; Guile-irrlicht 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
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU Lesser General Public
-;;; License along with guile-irrlicht. If not, see
-;;; <http://www.gnu.org/licenses/>.
-
-
-(use-modules (system foreign)
- (srfi srfi-64)
- (irrlicht util foreign))
-
-(test-begin "foreign-bit-fields")
-
-;; Simple bit field group
-(define bfg (bit-field-group (int8 2) (int8 3) (int8 1)))
-(test-equal (get-bit-field-group-type bfg)
- (list int8))
-(test-equal (make-c-bit-field-group bfg '(1 1 1))
- '(#b100101))
-(test-equal (parse-c-bit-field-group '(#b110011) bfg)
- '(3 4 1))
-
-;; Large bit field group
-(define bfg (bit-field-group (int8 2) (int8 3) (int8 5)))
-(test-equal (get-bit-field-group-type bfg)
- (list int8 int8))
-(test-equal (make-c-bit-field-group bfg '(1 1 2))
- '(#b101 #b10))
-(test-equal (parse-c-bit-field-group '(#b10011 #b10) bfg)
- '(3 4 2))
-
-;; Structs with bit fields
-(define types (list int8 (bit-field-group (int8 2) (int8 3) (int8 2))))
-(test-equal (sizeof+ types) 2)
-(define values '(10 (2 4 3)))
-(test-equal (parse-c-struct+ (make-c-struct+ types values) types) values)
-
-(test-end "foreign-bit-fields")
+++ /dev/null
-%%%% Starting test foreign-record
-Group begin: foreign-record
-Test begin:
- source-file: "tests/foreign-record.scm"
- source-line: 36
- source-form: (test-assert (dimension2d? dim))
-Test end:
- result-kind: pass
- actual-value: #t
-Test begin:
- source-file: "tests/foreign-record.scm"
- source-line: 37
- source-form: (test-equal 10 (dimension2d-width dim))
-Test end:
- result-kind: pass
- actual-value: 10
- expected-value: 10
-Test begin:
- source-file: "tests/foreign-record.scm"
- source-line: 38
- source-form: (test-equal 20 (dimension2d-height dim))
-Test end:
- result-kind: pass
- actual-value: 20
- expected-value: 20
-Test begin:
- source-file: "tests/foreign-record.scm"
- source-line: 43
- source-form: (test-equal 50 (dimension2d-width dim))
-Test end:
- result-kind: pass
- actual-value: 50
- expected-value: 50
-Test begin:
- source-file: "tests/foreign-record.scm"
- source-line: 44
- source-form: (test-equal 100 (dimension2d-height dim))
-Test end:
- result-kind: pass
- actual-value: 100
- expected-value: 100
-Test begin:
- source-file: "tests/foreign-record.scm"
- source-line: 47
- source-form: (test-assert (pointer? (foreign-record->pointer dim)))
-Test end:
- result-kind: pass
- actual-value: #t
-Group end: foreign-record
-# of expected passes 6
+++ /dev/null
-;;; guile-irrlicht --- FFI bindings for Irrlicht Engine
-;;; Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
-;;;
-;;; This file is part of guile-irrlicht.
-;;;
-;;; Guile-irrlicht is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU Lesser General Public License as
-;;; published by the Free Software Foundation; either version 3 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; Guile-irrlicht 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
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU Lesser General Public
-;;; License along with guile-irrlicht. If not, see
-;;; <http://www.gnu.org/licenses/>.
-
-
-(use-modules (system foreign)
- (srfi srfi-64)
- (irrlicht util foreign))
-
-(test-begin "foreign-record")
-
-;; Dimension 2D definition
-(define-foreign-record-type dimension2d
- (make-dimension2d width height)
- dimension2d?
- (width uint32 dimension2d-width set-dimension2d-width!)
- (height uint32 dimension2d-height set-dimension2d-height!))
-
-;; Create dimension
-(define dim (make-dimension2d 10 20))
-(test-assert (dimension2d? dim))
-(test-equal 10 (dimension2d-width dim))
-(test-equal 20 (dimension2d-height dim))
-
-;; Modify dimension
-(set-dimension2d-width! dim 50)
-(set-dimension2d-height! dim 100)
-(test-equal 50 (dimension2d-width dim))
-(test-equal 100 (dimension2d-height dim))
-
-;; Is a pointer
-(test-assert (pointer? (foreign-record->pointer dim)))
-
-;; Foreign record types as types for other foreign records
-(define-foreign-record-type point
- (make-point x y)
- point?
- (x int64 point-x)
- (y int64 point-y))
-
-(define-foreign-record-type triangle
- (make-triangle p1 p2 p3)
- triangle?
- (p1 point triangle-p1)
- (p2 point triangle-p2)
- (p3 point triangle-p3))
-
-;(define tr (make-triangle (make-point 0 10) (make-point -10 5) (make-point 15 -7)))
-;(test-equal -10 (point-x (triangle-p2 tr)))
-
-(test-end "foreign-record")