summaryrefslogtreecommitdiffstats
path: root/test/unit/classes
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/classes')
-rw-r--r--test/unit/classes/TestClassLambda.java67
-rw-r--r--test/unit/classes/TestClassLoop.java20
-rw-r--r--test/unit/classes/TestClassVar.java44
3 files changed, 131 insertions, 0 deletions
diff --git a/test/unit/classes/TestClassLambda.java b/test/unit/classes/TestClassLambda.java
new file mode 100644
index 0000000..a2b9d9a
--- /dev/null
+++ b/test/unit/classes/TestClassLambda.java
@@ -0,0 +1,67 @@
+package unit.classes;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.OptionalInt;
+import java.util.function.IntBinaryOperator;
+import java.util.function.Supplier;
+
+public class TestClassLambda {
+
+ public int field = 0;
+
+ public void testLambda() {
+
+ List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
+ int b = (int)Math.random();
+
+ list.forEach(n -> {int a = 2 * n; System.out.println(a + b + field);});
+ }
+
+ public void testLambda1() {
+
+ int a = (int)Math.random();
+
+ Runnable r = () -> { System.out.println("hello" + a); };
+
+ Runnable r1 = () -> { System.out.println("hello1" + a); };
+ }
+
+ public void testLambda2() {
+ reduce((left, right) -> Math.max(left, right));
+ }
+
+ public void testLambda3() { // IDEA-127301
+ reduce(Math::max);
+ }
+
+ public void testLambda4() {
+ reduce(TestClassLambda::localMax);
+ }
+
+ public void testLambda5() {
+ String x = "abcd";
+ function(x::toString);
+ }
+
+ public void testLambda6() {
+ List<String> list = new ArrayList<String>();
+ int bottom = list.size() * 2;
+ int top = list.size() * 5;
+ list.removeIf( s -> (bottom >= s.length() && s.length() <= top) );
+ }
+
+ public static OptionalInt reduce(IntBinaryOperator op) {
+ return null;
+ }
+
+ public static String function(Supplier<String> supplier) {
+ return supplier.get();
+ }
+
+ public static int localMax(int first, int second) {
+ return 0;
+ }
+
+}
diff --git a/test/unit/classes/TestClassLoop.java b/test/unit/classes/TestClassLoop.java
new file mode 100644
index 0000000..4275153
--- /dev/null
+++ b/test/unit/classes/TestClassLoop.java
@@ -0,0 +1,20 @@
+package test.input;
+
+public class TestLoop {
+
+ public static void main(String[] args) {
+
+ boolean a = true;
+ while(true) {
+ try {
+ if(!a) {
+ return;
+ }
+ } finally {
+ System.out.println("1");
+ }
+ }
+
+ }
+
+}
diff --git a/test/unit/classes/TestClassVar.java b/test/unit/classes/TestClassVar.java
new file mode 100644
index 0000000..fdba5c6
--- /dev/null
+++ b/test/unit/classes/TestClassVar.java
@@ -0,0 +1,44 @@
+package unit.classes;
+
+
+public class TestClassVar {
+
+ private boolean field_boolean = (Math.random() > 0);
+ public int field_int = 0;
+
+ public void testFieldSSAU() {
+
+ for(int i = 0; i < 10; i++) {
+
+ try {
+ System.out.println();
+ } finally {
+ if (field_boolean) {
+ System.out.println();
+ }
+ }
+
+ }
+ }
+
+ public Long testFieldSSAU1() { // IDEA-127466
+ return new Long(field_int++);
+ }
+
+ public void testComplexPropagation() {
+
+ int a = 0;
+
+ while (a < 10) {
+
+ int b = a;
+
+ for(; a < 10 && a == 0; a++) {}
+
+ if (b != a) {
+ System.out.println();
+ }
+ }
+ }
+
+}