3 * Test items of the Guile C API that aren't covered by any other tests.
6 /* Copyright (C) 2009, 2012, 2014 Free Software Foundation, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
36 #ifdef HAVE_INTTYPES_H
37 # include <inttypes.h>
41 test_scm_from_locale_keywordn ()
43 SCM kw
= scm_from_locale_keywordn ("thusly", 4);
44 assert (scm_is_true (scm_keyword_p (kw
)));
48 test_scm_local_eval ()
52 scm_c_use_module ("ice-9 local-eval");
53 result
= scm_local_eval
54 (scm_list_3 (scm_from_latin1_symbol ("+"),
55 scm_from_latin1_symbol ("x"),
56 scm_from_latin1_symbol ("y")),
57 scm_c_eval_string ("(let ((x 1) (y 2)) (the-environment))"));
59 assert (scm_is_true (scm_equal_p (result
,
60 scm_from_signed_integer (3))));
68 result
= scm_call (scm_c_public_ref ("guile", "+"),
72 assert (scm_is_true (scm_equal_p (result
, scm_from_int (3))));
74 result
= scm_call (scm_c_public_ref ("guile", "list"),
76 assert (scm_is_eq (result
, SCM_EOL
));
80 test_scm_to_pointer ()
82 int (*add3
) (int a
, int b
, int c
);
83 SCM int_type
= scm_c_public_ref ("system foreign", "int");
86 (scm_procedure_to_pointer (int_type
,
87 scm_c_public_ref ("guile", "+"),
92 assert ((*add3
) (1000000, 1000, -1) == 1000999);
96 tests (void *data
, int argc
, char **argv
)
98 test_scm_from_locale_keywordn ();
99 test_scm_local_eval ();
101 test_scm_to_pointer ();
105 main (int argc
, char *argv
[])
107 scm_boot_guile (argc
, argv
, tests
, NULL
);