
public class ArrayUtilityTest {
	public static void main(String[] args) {
		// testMerge();
		testSplit();
		// myTestSplit();
		myTestMerge();
	}

	public static void myTestSplit() {
		int[] myArray = { 1, 8, 3, 1, 5, 3, 7, 5, 3 };
		// add your code and some testcases the test split() similar to testSplit()
		ArrayUtility.show(ArrayUtility.split(myArray, 1));
		System.out.println("Expected:\n[1, 8, 3, 1, 5, 3, 7, 5, 3]\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 2));
		System.out.println("Expected: Array size 9 cannot be splitted into 2 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 3));
		System.out.println("Expected:\n[1, 1, 7]\n[8, 5, 5]\n[3, 3, 3]\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 4));
		System.out.println("Expected: Array size 9 cannot be splitted into 4 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 5));
		System.out.println("Expected: Array size 9 cannot be splitted into 5 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 6));
		System.out.println("Expected: Array size 9 cannot be splitted into 6 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 7));
		System.out.println("Expected: Array size 9 cannot be splitted into 7 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 8));
		System.out.println("Expected: Array size 9 cannot be splitted into 8 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 10));
		System.out.println("Expected: n cannot be greater than array's size, 9\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, 0));
		System.out.println("Expected: n must be >= 0\n----------");
		ArrayUtility.show(ArrayUtility.split(myArray, -1));
		System.out.println("Expected: n must be >= 0\n----------");


	}

	public static void myTestMerge() {
		// add your code and some testcases the test merge() similar to testMerge()
		int[][] myArray = { { 6, 13, 56 }, { 92, 55 }, { 12, 32, 13, 92 }, { 10 } };
		ArrayUtility.show(ArrayUtility.merge(myArray));
		System.out.println("[6, 13, 56, 92, 55, 12, 32, 13, 92, 10]] - Expected");
		int[][] myArray2 = {{145},{134,423,42},{33,44,13}};
		ArrayUtility.show(ArrayUtility.merge(myArray2));
		System.out.println("[145, 134, 423, 42, 33, 44, 13] - Expected");
	}

	// do no modify this method
	private static void testSplit() {
		int[] c = { 1, 2, 3, 4, 5, 6 };
		ArrayUtility.show(ArrayUtility.split(c, 1));
		System.out.println("Expected:\n[1, 2, 3, 4, 5, 6]\n----------");
		ArrayUtility.show(ArrayUtility.split(c, 2));
		System.out.println("Expected:\n[1, 2, 3]\n[4, 5, 6]\n----------");
		ArrayUtility.show(ArrayUtility.split(c, 3));
		System.out.println("Expected:\n[1, 2]\n[3, 4]\n[5, 6]\n----------");
		ArrayUtility.show(ArrayUtility.split(c, 4));
		System.out.println("Expected: Array size 6 cannot be splitted into 4 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(c, 5));
		System.out.println("Expected: Array size 6 cannot be splitted into 5 parts\n----------");
		ArrayUtility.show(ArrayUtility.split(c, 6));
		System.out.println("Expected:\n[1]\n[2]\n[3]\n[4]\n[5]\n[6]\n----------");
		ArrayUtility.show(ArrayUtility.split(c, 0));
		System.out.println("Expected: n must be >= 0\n----------");
		ArrayUtility.show(ArrayUtility.split(c, -1));
		System.out.println("Expected: n must be >= 0\n----------");
		ArrayUtility.show(ArrayUtility.split(c, 7));
		System.out.println("Expected: n cannot be greater than array's size, 6\n----------");
	}

	// do not modify this method
	private static void testMerge() {
		int[][] a = { { 1, 2, 3 }, { 4, 5 }, { 6, 7, 8, 9 }, { 10 } };
		ArrayUtility.show(ArrayUtility.merge(a));
		System.out.println("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - Expected");
		int[][] b = { { 1, 2, 3, 4 }, { 4, 5, 6, 7 }, { 7, 8, 9, 10 }, { 10, 11, 12, 13 } };
		ArrayUtility.show(ArrayUtility.merge(b));
		System.out.println("[1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13] - Expected");
	}

}
