diagram-system / DIAGRAM SYSTEM / src / tests / StudentTests.java
StudentTests.java
Raw
package tests;

import static org.junit.Assert.*;

import java.util.Arrays;

import org.junit.Test;

import system.TwoDimArrayUtil;

public class StudentTests {
	
	
	

	@Test
	public void testAppendLeftRight() {
		
			char[][] LongerTestArray = {{'A','B','C','D'}, {'D', 'E','F','G','H'}, {'G', 'H', 'I', 'L'}} ;
			char[][] ShorterTestArray = { {'D', 'E', 'F','K'}, {'G'}} ;

			//char[][] ShorterTestArray = {{'A','B'}, {'D'}, {'G', 'H', 'I'},{'a'}};
			
			System.out.println(Arrays.deepToString(TwoDimArrayUtil.appendLeftRight(LongerTestArray, ShorterTestArray)));
			
	}
	
	@Test
	public void testRotateTopOneRow() {
		
			 
			char[][] testArray = {{'A','B','C', 'J'}, {'D', 'E', 'F', 'K'}, {'G', 'H', 'I', 'L'}} ;

			
			System.out.println("initial state of the array:" + Arrays.deepToString(testArray));
			
			TwoDimArrayUtil.rotateTopOneRow(testArray);
			
			System.out.println("final state:" + Arrays.deepToString(testArray));
	}
	
	public static String toString(char[][] inputArray) {

		String stringCreated = "";

		for (int firstIncrement = 0; firstIncrement < inputArray.length; firstIncrement++) {
			for (int secondIncrement = 0; secondIncrement < inputArray[firstIncrement].length; secondIncrement++) {
				stringCreated += inputArray[firstIncrement][secondIncrement];
			}
			stringCreated += "\n";
		}
		return stringCreated;
	}
	
	
}