test: method invocation.
This commit is contained in:
parent
8257acbfbb
commit
889df318db
1 changed files with 9 additions and 0 deletions
|
@ -16,6 +16,9 @@ namespace Tests
|
||||||
}
|
}
|
||||||
public int i { get => _i; }
|
public int i { get => _i; }
|
||||||
public bool b { get => _b; }
|
public bool b { get => _b; }
|
||||||
|
public int I() {
|
||||||
|
return _i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Test {
|
public class Test {
|
||||||
|
@ -200,6 +203,8 @@ namespace Tests
|
||||||
Assert.Equal(((Lisp_Boolean)r).Value(), true);
|
Assert.Equal(((Lisp_Boolean)r).Value(), true);
|
||||||
r = e.eval("""(getitems o "i" "b")""");
|
r = e.eval("""(getitems o "i" "b")""");
|
||||||
Assert.Equal(string.Format("{0}", r), "(5 nil)");
|
Assert.Equal(string.Format("{0}", r), "(5 nil)");
|
||||||
|
r = e.eval("""(invoke o "I" nil)""");
|
||||||
|
Assert.Equal(string.Format("{0}", r), "5");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -215,6 +220,10 @@ namespace Tests
|
||||||
Assert.Equal("t", e.eval("(and (quote (1 2 3 4)))").ToString());
|
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("t", e.eval("(or (quote (nil nil 1 nil)))").ToString());
|
||||||
Assert.Equal("nil", e.eval("(or (quote (nil nil nil 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue