class FunctionT issubclassof TestDriver functions public tests : () -> seqof TestCase
tests() ==
[ new FunctionT01(), new FunctionT02(), new FunctionT03()
]; end FunctionT ----------------------------------------------------------
class FunctionT01 issubclassof TestCase operations protected test: () ==> bool
test() == let f1 = lambda x : int & x * 2,
p1 = lambda x : int & x > 1000,
p11 = lambda x : int & x <= 1000,
f2 = lambda x : seqofchar & x ^ "0",
p2 = lambda x : seqofchar & len x > 9,
p21 = lambda x : seqofchar & len x <= 9 in return
Function`Fwhile[int](p11)(f1)(1) = 1024 and
Function`Fwhile[seqofchar](p21)(f2)("123456") = "1234560000"and
Function`Funtil[int](p1)(f1)(1) = 1024 and
Function`Funtil[seqofchar](p2)(f2)("123456") = "1234560000"
; protected setUp: () ==> ()
setUp() == TestName := "FunctionT01:\tTest Fwhile, Funtil."; protected tearDown: () ==> ()
tearDown() == return; end FunctionT01 ----------------------------------------------------------
class FunctionT02 issubclassof TestCase operations protected test: () ==> bool
test() == let f1 = lambda x : int & x * 2,
f2 = lambda x : int & x * 3,
f3 = lambda x : int & x ** 2,
funcSeq1 = [f1, f2, f3],
f10 = lambda x : seqofchar & x ^ x,
f11 = Sequence`take[char](10),
f12 = Sequence`drop[char](4),
funcSeq2 = [f10, f11, f12] in return
Function`Seq[int](funcSeq1)(2) = (2 * 2 * 3) ** 2 and
Function`Seq[seqofchar](funcSeq2)("12345678") = "567812"
; protected setUp: () ==> ()
setUp() == TestName := "FunctionT02:\tTest function apply."; protected tearDown: () ==> ()
tearDown() == return; end FunctionT02 ----------------------------------------------------------
class FunctionT03 issubclassof TestCase types publicINT = int; public ReadingFunctionType = INT -> INT -> INT; --public ReadingFunctionType = int -> int -> int;
functions public ReadingFunction: () -> ReadingFunctionType
ReadingFunction() == let fn = "./fread-func.txt" in
Function`readFn[ReadingFunctionType](fn);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.