package com.freetymekiyan.algorithms.level.medium;

import org.testng.Assert;
import org.testng.annotations.Test;

public class AsteroidsTest {

    private static int[] input1 = {5, 10, -5}, output1 = {5, 10};
    private static int[] input2 = {8, -8}, output2 = {};
    private static int[] input3 = {10, 2, -5}, output3 = {10};
    private static int[] input4 = {-2, -1, 1, 2}, output4 = {-2, -1, 1, 2};
    private static int[] input5 = {2, 1, -1, -2}, output5 = {};
    private static int[] input6 = {1, 2, 3, 4, -10}, output6 = {-10};
    private static int[] input7 = {-2, -2, 1, -2}, output7 = {-2, -2, -2};

    private static int[][] inputs = new int[][]{input1, input2, input3, input4, input5, input6, input7};
    private static int[][] outputs = new int[][]{output1, output2, output3, output4, output5, output6, output7};

    @Test
    public void testAsteroidCollisionExamples() {
        Asteroids solution = new Asteroids();
        for (int i = 0; i < inputs.length; i++) {
            int[] output = solution.asteroidCollision(inputs[i]);
            Assert.assertEquals(output, outputs[i]);
        }
    }
}

@@ -138,16 +138,37 @@
 Test %7B%0A%0A
+    // One collision%0A
     priv
@@ -184,21 +184,21 @@
 c int%5B%5D 
-input
+INPUT
 1 = %7B5, 
@@ -206,22 +206,22 @@
 0, -5%7D, 
-output
+OUTPUT
 1 = %7B5, 
@@ -221,24 +221,51 @@
  = %7B5, 10%7D;%0A
+    // Same size collision%0A
     private 
@@ -277,21 +277,21 @@
 c int%5B%5D 
-input
+INPUT
 2 = %7B8, 
@@ -299,22 +299,22 @@
 8%7D, 
-output
+OUTPUT
 2 = %7B%7D;%0A
     
@@ -305,24 +305,45 @@
 TPUT2 = %7B%7D;%0A
+    // Two collision%0A
     private 
@@ -355,21 +355,21 @@
 c int%5B%5D 
-input
+INPUT
 3 = %7B10,
@@ -377,22 +377,22 @@
 2, -5%7D, 
-output
+OUTPUT
 3 = %7B10%7D
@@ -389,24 +389,65 @@
 UT3 = %7B10%7D;%0A
+    // No collision, different direction%0A
     private 
@@ -459,21 +459,21 @@
 c int%5B%5D 
-input
+INPUT
 4 = %7B-2,
@@ -484,22 +484,22 @@
  1, 2%7D, 
-output
+OUTPUT
 4 = %7B-2,
@@ -510,16 +510,48 @@
  1, 2%7D;%0A
+    // Two same size collisions%0A
     priv
@@ -567,21 +567,21 @@
 c int%5B%5D 
-input
+INPUT
 5 = %7B2, 
@@ -596,22 +596,22 @@
 2%7D, 
-output
+OUTPUT
 5 = %7B%7D;%0A
     
@@ -602,24 +602,51 @@
 TPUT5 = %7B%7D;%0A
+    // Collide all the way%0A
     private 
@@ -658,21 +658,21 @@
 c int%5B%5D 
-input
+INPUT
 6 = %7B1, 
@@ -686,22 +686,22 @@
 , -10%7D, 
-output
+OUTPUT
 6 = %7B-10
@@ -699,24 +699,85 @@
 T6 = %7B-10%7D;%0A
+    // One collision with left moving asteroids in the front%0A
     private 
@@ -789,21 +789,21 @@
 c int%5B%5D 
-input
+INPUT
 7 = %7B-2,
@@ -815,22 +815,22 @@
 1, -2%7D, 
-output
+OUTPUT
 7 = %7B-2,
@@ -867,22 +867,22 @@
 int%5B%5D%5B%5D 
-inputs
+INPUTS
  = new i
@@ -892,61 +892,61 @@
 %5D%5B%5D%7B
-input1, input2, input3, input4, input5, input6, input
+INPUT1, INPUT2, INPUT3, INPUT4, INPUT5, INPUT6, INPUT
 7%7D;%0A
@@ -972,23 +972,23 @@
 int%5B%5D%5B%5D 
-outputs
+OUTPUTS
  = new i
@@ -998,68 +998,68 @@
 %5D%5B%5D%7B
-output1, output2, output3, output4, output5, output6, output
+OUTPUT1, OUTPUT2, OUTPUT3, OUTPUT4, OUTPUT5, OUTPUT6, OUTPUT
 7%7D;%0A
@@ -1193,22 +1193,22 @@
  0; i %3C 
-inputs
+INPUTS
 .length;
@@ -1273,14 +1273,14 @@
 ion(
-inputs
+INPUTS
 %5Bi%5D)
@@ -1325,15 +1325,15 @@
 ut, 
-outputs
+OUTPUTS
 %5Bi%5D)

add comments to test cases