test: method invocation.

This commit is contained in:
redxef 2024-11-07 22:26:53 +01:00
parent 8257acbfbb
commit 889df318db
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -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());
}
}
}