Fix accessor struct inlining in GOOPS
[bpt/guile.git] / test-suite / standalone / test-scm-take-locale-symbol.c
1 /* Copyright (C) 2009 Free Software Foundation, Inc.
2 *
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.
7 *
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.
12 *
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
16 * 02110-1301 USA
17 */
18
19 /* Exercise `scm_take_locale_symbol ()', making sure it returns an interned
20 symbol. See https://savannah.gnu.org/bugs/index.php?25865 . */
21
22 #ifdef HAVE_CONFIG_H
23 # include <config.h>
24 #endif
25
26 #include <libguile.h>
27
28 #include <stdlib.h>
29 #include <string.h>
30
31 \f
32 static void *
33 do_test (void *result)
34 {
35 SCM taken_sym, sym;
36
37 taken_sym = scm_take_locale_symbol (strdup ("some random symbol"));
38 sym = scm_from_locale_symbol ("some random symbol");
39
40 if (scm_is_true (scm_symbol_p (sym))
41 && scm_is_true (scm_symbol_p (taken_sym))
42
43 /* Relying solely on `scm_symbol_interned_p ()' is insufficient since
44 it doesn't reflect the actual state of the symbol hashtable, hence
45 the additional `scm_is_eq' test. */
46 && scm_is_true (scm_symbol_interned_p (sym))
47 && scm_is_true (scm_symbol_interned_p (taken_sym))
48 && scm_is_eq (taken_sym, sym))
49 * (int *) result = EXIT_SUCCESS;
50 else
51 * (int *) result = EXIT_FAILURE;
52
53 return NULL;
54 }
55
56 int
57 main (int argc, char *argv[])
58 {
59 int result;
60
61 scm_with_guile (do_test, &result);
62
63 return result;
64 }