From 889df318db4cd8a0c482da7988a621a2ecac7184 Mon Sep 17 00:00:00 2001 From: redxef Date: Thu, 7 Nov 2024 22:26:53 +0100 Subject: [PATCH] test: method invocation. --- Tests/Tests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/Tests.cs b/Tests/Tests.cs index ec16a5a..0f370c6 100644 --- a/Tests/Tests.cs +++ b/Tests/Tests.cs @@ -16,6 +16,9 @@ namespace Tests } public int i { get => _i; } public bool b { get => _b; } + public int I() { + return _i; + } } public class Test { @@ -200,6 +203,8 @@ namespace Tests Assert.Equal(((Lisp_Boolean)r).Value(), true); r = e.eval("""(getitems o "i" "b")"""); Assert.Equal(string.Format("{0}", r), "(5 nil)"); + r = e.eval("""(invoke o "I" nil)"""); + Assert.Equal(string.Format("{0}", r), "5"); } [Fact] @@ -215,6 +220,10 @@ namespace Tests Assert.Equal("t", e.eval("(and (quote (1 2 3 4)))").ToString()); Assert.Equal("t", e.eval("(or (quote (nil nil 1 nil)))").ToString()); Assert.Equal("nil", e.eval("(or (quote (nil nil nil nil)))").ToString()); + Assert.Equal("t", e.eval("(any (lambda (x) (= x 2)) (list 1 2 3 4 5 6))").ToString()); + Assert.Equal("nil", e.eval("(any (lambda (x) (= x 2)) (list 1 3 4 5 6))").ToString()); + Assert.Equal("t", e.eval("(all (lambda (x) (= 1 (% x 2))) (list 1 3 5))").ToString()); + Assert.Equal("nil", e.eval("(all (lambda (x) (= 1 (% x 2))) (list 1 3 4 5))").ToString()); } } }