Fix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors.
[bpt/guile.git] / test-suite / tests / c-api.test
CommitLineData
48fadf49
MD
1;;;; c-api.test --- complementary test suite for the c-api -*- scheme -*-
2;;;; MDJ 990915 <djurfeldt@nada.kth.se>
3;;;;
82b8cfa4 4;;;; Copyright (C) 1999, 2006, 2012, 2014 Free Software Foundation, Inc.
34a1045f 5;;;;
53befeb7
NJ
6;;;; This library is free software; you can redistribute it and/or
7;;;; modify it under the terms of the GNU Lesser General Public
8;;;; License as published by the Free Software Foundation; either
9;;;; version 3 of the License, or (at your option) any later version.
34a1045f 10;;;;
53befeb7 11;;;; This library is distributed in the hope that it will be useful,
48fadf49 12;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
53befeb7
NJ
13;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14;;;; Lesser General Public License for more details.
34a1045f 15;;;;
53befeb7
NJ
16;;;; You should have received a copy of the GNU Lesser General Public
17;;;; License along with this library; if not, write to the Free Software
18;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
48fadf49 19
34a1045f
MG
20(use-modules (test-suite lib))
21
48fadf49
MD
22(define srcdir (cdr (assq 'srcdir %guile-build-info)))
23
44fdbfc6 24(define (egrep string filename)
82b8cfa4
LC
25 (zero? (system (string-append "egrep '" string "' " filename
26 " >" %null-device))))
48fadf49
MD
27
28(define (seek-offset-test dirname)
29 (let ((dir (opendir dirname)))
30 (do ((filename (readdir dir) (readdir dir)))
34a1045f
MG
31 ((eof-object? filename))
32 (if (and
33 (eqv? (string-ref filename (- (string-length filename) 1)) #\c)
34 (eqv? (string-ref filename (- (string-length filename) 2)) #\.))
35 (let ((file (string-append dirname "/" filename)))
36 (if (and (file-exists? file)
37 (egrep "SEEK_(SET|CUR|END)" file))
38 (pass-if file (egrep "unistd.h" file))))))))
48fadf49
MD
39
40;;; A rough conservative test to check that all source files
41;;; which use SEEK_SET, SEEK_CUR, and SEEK_END include unistd.h.
42;;;
43;;; If this test start to trigger without reason, we just modify it
44;;; to be more precise.
45(with-test-prefix "SEEK_XXX => #include <unistd.h>"
46 (if (file-exists? srcdir)
47 (seek-offset-test srcdir)))