Rename scm_call_varargs -> scm_call
[bpt/guile.git] / test-suite / standalone / test-loose-ends.c
CommitLineData
440ae510
NJ
1/* test-loose-ends.c
2 *
3 * Test items of the Guile C API that aren't covered by any other tests.
4 */
5
d062a8c1 6/* Copyright (C) 2009, 2012 Free Software Foundation, Inc.
440ae510
NJ
7 *
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.
12 *
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.
17 *
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
21 * 02110-1301 USA
22 */
23
24#if HAVE_CONFIG_H
25# include <config.h>
26#endif
27
28#include <libguile.h>
29
30#include <stdio.h>
31#include <assert.h>
32#include <string.h>
33
34#ifdef HAVE_INTTYPES_H
35# include <inttypes.h>
36#endif
37
38static void
39test_scm_from_locale_keywordn ()
40{
41 SCM kw = scm_from_locale_keywordn ("thusly", 4);
42 assert (scm_is_true (scm_keyword_p (kw)));
43}
44
d062a8c1
AW
45static void
46test_scm_local_eval ()
47{
0133e13f
AW
48 SCM result;
49
50 scm_c_use_module ("ice-9 local-eval");
51 result = scm_local_eval
d062a8c1
AW
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))"));
56
57 assert (scm_is_true (scm_equal_p (result,
58 scm_from_signed_integer (3))));
59}
60
741b8a23 61static void
07c2ca0f 62test_scm_call ()
741b8a23
MW
63{
64 SCM result;
65
07c2ca0f
MW
66 result = scm_call (scm_c_public_ref ("guile", "+"),
67 scm_from_int (1),
68 scm_from_int (2),
69 SCM_UNDEFINED);
741b8a23
MW
70 assert (scm_is_true (scm_equal_p (result, scm_from_int (3))));
71
07c2ca0f
MW
72 result = scm_call (scm_c_public_ref ("guile", "list"),
73 SCM_UNDEFINED);
741b8a23
MW
74 assert (scm_is_eq (result, SCM_EOL));
75}
76
440ae510
NJ
77static void
78tests (void *data, int argc, char **argv)
79{
80 test_scm_from_locale_keywordn ();
d062a8c1 81 test_scm_local_eval ();
07c2ca0f 82 test_scm_call ();
440ae510
NJ
83}
84
85int
86main (int argc, char *argv[])
87{
88 scm_boot_guile (argc, argv, tests, NULL);
89 return 0;
90}