Commit 43619b22 authored by Erick's avatar Erick

Added tests on functions declared with 'λ' symbol

parent 63416722
This diff is collapsed.
......@@ -21,7 +21,7 @@
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 1-Mar-2000 19:51 (eg)
* Last file update: 21-Mar-2018 11:36 (eg)
* Last file update: 23-Mar-2018 17:28 (eg)
*/
// INLINER values
......@@ -1922,7 +1922,7 @@ DEFINE_PRIMITIVE("%make-continuation", make_continuation, subr0, (void))
SCM z;
struct continuation_obj *k;
vm_thread_t *vm = STk_get_current_vm();
int csize, ssize;
unsigned int csize, ssize;
void *cstart, *sstart, *cend, *send;
void *addr, *start_stack;
......@@ -1947,6 +1947,11 @@ DEFINE_PRIMITIVE("%make-continuation", make_continuation, subr0, (void))
send = vm->stack + vm->stack_len;
ssize = (send - sstart) * sizeof(SCM);
printf("ssize = %d else %d\n", ssize, vm->stack_len *sizeof(SCM));
sstart = vm->stack;
ssize = vm->stack_len *sizeof(SCM);
/* Allocate a continuation object */
NEWCELL_WITH_LEN(z, continuation, sizeof(struct continuation_obj) + ssize + csize);
k = (struct continuation_obj *) z;
......
;;;;
;;;; test-r5.stk -- Test various exemaples of R5RS
;;;; test-r5.stk -- Test various exemaples of R5RS
;;;;
;;;; Copyright © 2010 Erick Gallesio - Polytech'Nice-Sophia <eg@unice.fr>
;;;; Copyright © 2010-2018 Erick Gallesio - Polytech'Nice-Sophia <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 23-Dec-2010 18:47 (eg)
;;;; Last file update: 23-Dec-2010 20:17 (eg)
;;;; Last file update: 23-Mar-2018 17:42 (eg)
;;;;
(require "test")
......@@ -33,26 +33,37 @@
(test "Quasiquote.1" '(list 3 4) `(list ,(+ 1 2) 4))
(test "Quasiquote.2" '(list a (quote a))
(let ((name 'a)) `(list ,name ',name)))
(let ((name 'a)) `(list ,name ',name)))
(test "Quasiquote.3" '(a 3 4 5 6 b)
`(a ,(+ 1 2) ,@(map abs '(4 -5 6)) b))
`(a ,(+ 1 2) ,@(map abs '(4 -5 6)) b))
(test "Quasiquote.4" '((foo 7) . cons)
`(( foo ,(- 10 3)) ,@(cdr '(c)) . ,(car '(cons))))
`(( foo ,(- 10 3)) ,@(cdr '(c)) . ,(car '(cons))))
(test "Quasiquote.5" '#(10 5 2 4 3 8)
`#(10 5 ,(sqrt 4) ,@(map sqrt '(16 9)) 8))
`#(10 5 ,(sqrt 4) ,@(map sqrt '(16 9)) 8))
(test "Quasiquote.6" '(a `(b ,(+ 1 2) ,(foo 4 d) e) f)
`(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f))
`(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f))
(test "Quasiquote.7" '(a `(b ,x ,'y d) e)
(let ((name1 'x)
(name2 'y))
`(a `(b ,,name1 ,',name2 d) e)))
(let ((name1 'x)
(name2 'y))
`(a `(b ,,name1 ,',name2 d) e)))
;;---- tests added for STklos
(test "Quasiquote.stklos.1"
'(quasiquote ((unquote-splicing (append (list 2 3) (list 5 7)))))
``(,@(append ,@'((list 2 3) (list 5 7)))))
;;---- Test the lambda form with λ symbol
(test "lambda symbol.1"
'(1 2 3)
( (λ l l) 1 2 3))
(test "lambda symbol.2"
'(1 2 3)
( (λ λ λ) 1 2 3))
;;------------------------------------------------------------------
(test-section-end)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment