3 * Test items of the Guile C API that aren't covered by any other tests.
6 /* Copyright (C) 2009, 2012 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
34 #ifdef HAVE_INTTYPES_H
35 # include <inttypes.h>
39 test_scm_from_locale_keywordn ()
41 SCM kw
= scm_from_locale_keywordn ("thusly", 4);
42 assert (scm_is_true (scm_keyword_p (kw
)));
46 test_scm_local_eval ()
50 scm_c_use_module ("ice-9 local-eval");
51 result
= scm_local_eval
52 (scm_list_3 (scm_from_latin1_symbol ("+"),
53 scm_from_latin1_symbol ("x"),
54 scm_from_latin1_symbol ("y")),
55 scm_c_eval_string ("(let ((x 1) (y 2)) (the-environment))"));
57 assert (scm_is_true (scm_equal_p (result
,
58 scm_from_signed_integer (3))));
66 result
= scm_call (scm_c_public_ref ("guile", "+"),
70 assert (scm_is_true (scm_equal_p (result
, scm_from_int (3))));
72 result
= scm_call (scm_c_public_ref ("guile", "list"),
74 assert (scm_is_eq (result
, SCM_EOL
));
78 test_scm_to_pointer ()
80 int (*add3
) (int a
, int b
, int c
);
81 SCM int_type
= scm_c_public_ref ("system foreign", "int");
84 (scm_procedure_to_pointer (int_type
,
85 scm_c_public_ref ("guile", "+"),
90 assert ((*add3
) (1000000, 1000, -1) == 1000999);
94 tests (void *data
, int argc
, char **argv
)
96 test_scm_from_locale_keywordn ();
97 test_scm_local_eval ();
99 test_scm_to_pointer ();
103 main (int argc
, char *argv
[])
105 scm_boot_guile (argc
, argv
, tests
, NULL
);