public void HumidityTests() { // Use the Assert class to test conditions. int x = 40; int z = 40; World testWorld = World.generateNewWorld(x, z, false); Tile[,] worldArray = World.getWorld().getWorldArray(); Humidity[,] array = new Humidity[x, z]; double[,] example = new double[x, z]; for (int i = 0; i < x; i++) { for (int j = 0; j < z; j++) { array[i, j] = worldArray[i, j].getHumidity(); for (int k = 0; k < array[i, j].getSegments().Length; k++) { if (k == 4) { example[i, j] = array[i, j].getSegments()[k]; } assertBetween(array[i, j].getSegments()[k], 0.0, 12.0); assertHasBeenRoundedToXDecimals(array[i, j].getSegments()[k], 2); } } } ArrayPrinter.print(example, "Sample Humidity Map:"); // VerifyWorld(); }
public void GenerateWorldLayer() { // Use the Assert class to test conditions. int x = 50; int z = 40; UnityEngine.Debug.Log("World Size: " + World.X + ", " + World.Z); Stopwatch sw = Stopwatch.StartNew(); sw.Start(); double[,] layer = World.getWorld().generateWorldLayer(-20.0, 40.0, 2.0, 2.5, true); sw.Stop(); UnityEngine.Debug.Log("Layer generation of size " + World.X + ", " + World.Z + " took " + sw.Elapsed + " secs."); verifyLayer(layer); ArrayPrinter.print(layer, "Test Layer: "); }
public void ElevationMapTest() { // Use the Assert class to test conditions. int x = 40; int z = 40; World testWorld = World.generateNewWorld(x, z, false); Tile[,] worldArray = World.getWorld().getWorldArray(); double[,] array = new double[x, z]; for (int i = 0; i < x; i++) { for (int j = 0; j < z; j++) { array[i, j] = worldArray[i, j].getElevation(); assertBetween(array[i, j], -100.0, 100.0); assertHasBeenRoundedToXDecimals(array[i, j], 2); } } ArrayPrinter.print(array, "Elevation Map:"); }
public void MidpointTest() { // Use the Assert class to test conditions. int x = 40; int z = 40; World testWorld = World.generateNewWorld(x, z, false); Tile[,] worldArray = World.getWorld().getWorldArray(); double[,] array = new double[x, z]; for (int i = 0; i < x; i++) { for (int j = 0; j < z; j++) { array[i, j] = worldArray[i, j].getMidpoint(); assertBetween(array[i, j], 45.0, 75.0); assertHasBeenRoundedToXDecimals(array[i, j], 1); } } ArrayPrinter.print(array, "Midpoint Map:"); // VerifyWorld(); }
public void LowTempTest() { // Use the Assert class to test conditions. int x = 40; int z = 40; World testWorld = World.generateNewWorld(x, z, false); Tile[,] worldArray = World.getWorld().getWorldArray(); int[,] array = new int[x, z]; for (int i = 0; i < x; i++) { for (int j = 0; j < z; j++) { array[i, j] = worldArray[i, j].getLowTemp(); assertBetween(array[i, j], -20, 70); Assert.LessOrEqual(array[i, j].ToString().Length, 3); } } ArrayPrinter.print(array, "Low Temp Map:"); // VerifyWorld(); }