feat: change up organisation

This commit is contained in:
2023-04-24 11:02:37 +08:00
parent 13f372ec5a
commit dd56398b7d
378 changed files with 4653 additions and 107 deletions

View File

@@ -0,0 +1,48 @@
class Test6 {
public static void main(String[] args) {
CS2030STest we = new CS2030STest();
class Incr implements Immutator<Integer, Integer> {
public Integer invoke(Integer t1) {
return t1 + 1;
}
}
class Length implements Immutator<Integer, String> {
public Integer invoke(String t1) {
return t1.length();
}
}
Probably<Immutator<Integer, Integer>> justIncr = Probably.just(new Incr());
Probably<Immutator<Integer, String>> justLength = Probably.just(new Length());
Probably<Immutator<Integer, Integer>> noIncr = Probably.none();
Probably<Immutator<Integer, String>> noLength = Probably.none();
we.expect("Probably.just(17).<Integer>apply(justIncr)",
Probably.just(17).apply(justIncr).toString(),
"<18>");
we.expect("Probably.<Integer>none().<Integer>apply(justIncr)",
Probably.<Integer>none().apply(justIncr).toString(),
"<>");
we.expect("Probably.just(17).<Integer>apply(noIncr)",
Probably.just(17).apply(noIncr).toString(),
"<>");
we.expect("Probably.<Integer>none().<Integer>apply(noIncr)",
Probably.<Integer>none().apply(noIncr).toString(),
"<>");
we.expect("Probably.just(\"string\").<Integer>apply(justLength)",
Probably.just("string").apply(justLength).toString(),
"<6>");
we.expect("Probably.<String>none().<Integer>apply(justLength)",
Probably.<String>none().apply(justLength).toString(),
"<>");
we.expect("Probably.just(\"string\").<Integer>apply(noLength)",
Probably.just("string").apply(noLength).toString(),
"<>");
we.expect("Probably.<String>none().<Integer>apply(noLength)",
Probably.<String>none().apply(noLength).toString(),
"<>");
}
}