test-list.c 1.6 KB

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