This commit is contained in:
Yadunand Prem 2022-09-15 13:31:32 +08:00
parent a2fa97383c
commit 4e99493aa5
8 changed files with 1 additions and 73 deletions

Binary file not shown.

View File

@ -28,8 +28,5 @@ class Test1 {
"string", "string",
baos, baos,
old); old);
we.showStat();
we.print();
} }
} }

View File

@ -38,8 +38,5 @@ class Test2 {
"", "",
baos, baos,
old); old);
we.showStat();
we.print();
} }
} }

View File

@ -13,18 +13,6 @@ class Test3 {
} }
} }
we.prefix("jshell> class Incr implements Immutator<Integer,Integer> {");
we.prefix(" ...> public Integer invoke(Integer t1) {");
we.prefix(" ...> return t1 + 1;");
we.prefix(" ...> }");
we.prefix(" ...> }");
we.prefix("jshell> class Length implements Immutator<Integer,String> {");
we.prefix(" ...> public Integer invoke(String t1) {");
we.prefix(" ...> return t1.length();");
we.prefix(" ...> }");
we.prefix(" ...> }");
we.expect("new Incr().invoke(4)", we.expect("new Incr().invoke(4)",
new Incr().invoke(4).toString(), new Incr().invoke(4).toString(),
"5"); "5");
@ -50,8 +38,5 @@ class Test3 {
we.expect("new Improbable<>().invoke(new Improbable<>().invoke(1))", we.expect("new Improbable<>().invoke(new Improbable<>().invoke(1))",
new Improbable<>().invoke(new Improbable<Integer>().invoke(1)).toString(), new Improbable<>().invoke(new Improbable<Integer>().invoke(1)).toString(),
"<<1>>"); "<<1>>");
we.showStat();
we.print();
} }
} }

View File

@ -13,18 +13,6 @@ class Test4 {
} }
} }
we.prefix("jshell> class Incr implements Immutator<Integer,Integer> {");
we.prefix(" ...> public Integer invoke(Integer t1) {");
we.prefix(" ...> return t1 + 1;");
we.prefix(" ...> }");
we.prefix(" ...> }");
we.prefix("jshell> class Length implements Immutator<Integer,String> {");
we.prefix(" ...> public Integer invoke(String t1) {");
we.prefix(" ...> return t1.length();");
we.prefix(" ...> }");
we.prefix(" ...> }");
we.expect("Probably.just(4).transform(new Incr())", we.expect("Probably.just(4).transform(new Incr())",
Probably.just(4).transform(new Incr()).toString(), Probably.just(4).transform(new Incr()).toString(),
"<5>"); "<5>");
@ -47,8 +35,5 @@ class Test4 {
we.expect("Probably.<String>just(null).transform(new Length()).transform(new Incr())", we.expect("Probably.<String>just(null).transform(new Length()).transform(new Incr())",
Probably.<String>just(null).transform(new Length()).transform(new Incr()).toString(), Probably.<String>just(null).transform(new Length()).transform(new Incr()).toString(),
"<>"); "<>");
we.showStat();
we.print();
} }
} }

View File

@ -13,18 +13,6 @@ class Test5 {
} }
} }
we.prefix("jshell> class Incr implements Immutator<Integer,Integer> {");
we.prefix(" ...> public Integer invoke(Integer t1) {");
we.prefix(" ...> return t1 + 1;");
we.prefix(" ...> }");
we.prefix(" ...> }");
we.prefix("jshell> class Length implements Immutator<Integer,String> {");
we.prefix(" ...> public Integer invoke(String t1) {");
we.prefix(" ...> return t1.length();");
we.prefix(" ...> }");
we.prefix(" ...> }");
we.expect("Probably.just(17).check(new IsModEq(3,2)) // 17 % 3 is equal to 2", we.expect("Probably.just(17).check(new IsModEq(3,2)) // 17 % 3 is equal to 2",
Probably.just(17).check(new IsModEq(3,2)).toString(), Probably.just(17).check(new IsModEq(3,2)).toString(),
"<17>"); "<17>");
@ -41,8 +29,5 @@ class Test5 {
we.expect("Probably.<Integer>just(null).check(new IsModEq(0,2))", we.expect("Probably.<Integer>just(null).check(new IsModEq(0,2))",
Probably.<Integer>just(null).check(new IsModEq(0,2)).toString(), Probably.<Integer>just(null).check(new IsModEq(0,2)).toString(),
"<>"); "<>");
we.showStat();
we.print();
} }
} }

View File

@ -18,21 +18,6 @@ class Test6 {
Probably<Immutator<Integer,Integer>> noIncr = Probably.none(); Probably<Immutator<Integer,Integer>> noIncr = Probably.none();
Probably<Immutator<Integer,String>> noLength = Probably.none(); Probably<Immutator<Integer,String>> noLength = Probably.none();
we.prefix("jshell> class Incr implements Immutator<Integer,Integer> {");
we.prefix(" ...> public Integer invoke(Integer t1) {");
we.prefix(" ...> return t1 + 1;");
we.prefix(" ...> }");
we.prefix("jshell> class Length implements Immutator<Integer,String> {");
we.prefix(" ...> public Integer invoke(String t1) {");
we.prefix(" ...> return t1.length();");
we.prefix(" ...> }");
we.prefix("jshell> Probably<Immutator<Integer,Integer>> justIncr = Probably.just(new Incr());");
we.prefix("jshell> Probably<Immutator<Integer,String>> justLength = Probably.just(new Length());");
we.prefix("jshell> Probably<Immutator<Integer,Integer>> noIncr = Probably.none();");
we.prefix("jshell> Probably<Immutator<Integer,String>> noLength = Probably.none();");
we.expect("Probably.just(17).<Integer>apply(justIncr)", we.expect("Probably.just(17).<Integer>apply(justIncr)",
Probably.just(17).apply(justIncr).toString(), Probably.just(17).apply(justIncr).toString(),
"<18>"); "<18>");
@ -58,8 +43,5 @@ class Test6 {
we.expect("Probably.<String>none().<Integer>apply(noLength)", we.expect("Probably.<String>none().<Integer>apply(noLength)",
Probably.<String>none().apply(noLength).toString(), Probably.<String>none().apply(noLength).toString(),
"<>"); "<>");
we.showStat();
we.print();
} }
} }

View File

@ -54,8 +54,5 @@ class TestProbably {
we.expect("Probably.none() == Probably.just(null)", we.expect("Probably.none() == Probably.just(null)",
Probably.none() == Probably.just(null), Probably.none() == Probably.just(null),
true); true);
// we.showStat();
// we.print();
} }
} }