test-list.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* test-list.c - exercise libguile/list.c functions */
  2. /* Copyright (C) 2006, 2008 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
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but 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 02110-1301 USA
  17. */
  18. #ifndef HAVE_CONFIG_H
  19. # include <config.h>
  20. #endif
  21. #include <libguile.h>
  22. #include <stdio.h>
  23. #include <assert.h>
  24. #include <string.h>
  25. /* pretty trivial, but ensure this entrypoint exists, since it was
  26. documented in Guile 1.6 and earlier */
  27. static void
  28. test_scm_list (void)
  29. {
  30. {
  31. if (! scm_is_eq (SCM_EOL, scm_list (SCM_EOL)))
  32. {
  33. fprintf (stderr, "fail: scm_list SCM_EOL\n");
  34. exit (1);
  35. }
  36. }
  37. {
  38. SCM lst = scm_list_2 (scm_from_int (1), scm_from_int (2));
  39. if (! scm_is_true (scm_equal_p (lst, scm_list (lst))))
  40. {
  41. fprintf (stderr, "fail: scm_list '(1 2)\n");
  42. exit (1);
  43. }
  44. }
  45. }
  46. static void
  47. tests (void *data, int argc, char **argv)
  48. {
  49. test_scm_list ();
  50. }
  51. int
  52. main (int argc, char *argv[])
  53. {
  54. scm_boot_guile (argc, argv, tests, NULL);
  55. return 0;
  56. }