1 /* Copyright (C) 2012, 2014 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public License
5 * as published by the Free Software Foundation; either version 3 of
6 * the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
31 test_scm_c_value_ref_on_multiple_values ()
33 SCM values
= scm_values (scm_list_3 (scm_from_latin1_string ("foo"),
34 scm_from_latin1_string ("bar"),
35 scm_from_latin1_string ("baz")));
37 char *foo
= scm_to_latin1_string (scm_c_value_ref (values
, 0));
38 char *bar
= scm_to_latin1_string (scm_c_value_ref (values
, 1));
39 char *baz
= scm_to_latin1_string (scm_c_value_ref (values
, 2));
41 assert (strcmp (foo
, "foo") == 0);
42 assert (strcmp (bar
, "bar") == 0);
43 assert (strcmp (baz
, "baz") == 0);
51 test_scm_c_value_ref_on_a_single_value ()
53 SCM value
= scm_from_latin1_string ("foo");
54 char *foo
= scm_to_latin1_string (scm_c_value_ref (value
, 0));
55 assert (strcmp (foo
, "foo") == 0);
60 tests (void *data
, int argc
, char **argv
)
62 test_scm_c_value_ref_on_multiple_values ();
63 test_scm_c_value_ref_on_a_single_value ();
67 main (int argc
, char *argv
[])
69 scm_boot_guile (argc
, argv
, tests
, NULL
);