test-list.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* test-list.c - exercise libguile/list.c functions */
  2. /* Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public License
  6. * as published by the Free Software Foundation; either version 3 of
  7. * the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301 USA
  18. */
  19. #ifdef HAVE_CONFIG_H
  20. # include <config.h>
  21. #endif
  22. #include <libguile.h>
  23. #include <stdlib.h>
  24. #include <stdio.h>
  25. #include <string.h>
  26. /* pretty trivial, but ensure this entrypoint exists, since it was
  27. documented in Guile 1.6 and earlier */
  28. static void
  29. test_scm_list (void)
  30. {
  31. {
  32. if (! scm_is_eq (SCM_EOL, scm_list (SCM_EOL)))
  33. {
  34. fprintf (stderr, "fail: scm_list SCM_EOL\n");
  35. exit (EXIT_FAILURE);
  36. }
  37. }
  38. {
  39. SCM lst = scm_list_2 (scm_from_int (1), scm_from_int (2));
  40. if (! scm_is_true (scm_equal_p (lst, scm_list (lst))))
  41. {
  42. fprintf (stderr, "fail: scm_list '(1 2)\n");
  43. exit (EXIT_FAILURE);
  44. }
  45. }
  46. }
  47. static void
  48. tests (void *data, int argc, char **argv)
  49. {
  50. test_scm_list ();
  51. }
  52. int
  53. main (int argc, char *argv[])
  54. {
  55. scm_boot_guile (argc, argv, tests, NULL);
  56. return 0;
  57. }