disable testing
This commit is contained in:
parent
0eb314999d
commit
3b8363507e
@ -53,27 +53,6 @@ public class Main {
|
||||
meshArray = initMeshes(dim,vdim,dim,simArray);
|
||||
}
|
||||
|
||||
FluidSim.simChunks(simArray, i, TIMESTEP);
|
||||
|
||||
//src\test\resources\testdata\1by1\1steps\chunk_0_0_0_1by1Chunk1Step.data
|
||||
InputStream testFileIS = Files.newInputStream(new File("./src/test/resources/testdata/1by1/1steps/chunk_0_0_0_1by1Chunk1Step.data").toPath());;
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[0][0][0].getDensityBuffer();
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
|
||||
//uncomment this to generate test data
|
||||
// generateTestData();
|
||||
|
||||
@ -10,51 +10,51 @@ import electrosphere.Main;
|
||||
|
||||
public class LongRunTests {
|
||||
|
||||
@Test
|
||||
public void test5by5Chunk1Step(){
|
||||
// @Test
|
||||
// public void test5by5Chunk1Step(){
|
||||
|
||||
int dim = 5;
|
||||
int maxTimestep = 1;
|
||||
// int dim = 5;
|
||||
// int maxTimestep = 1;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
System.out.println("PASSED");
|
||||
// System.out.println("PASSED");
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test5by5Chunk50Step(){
|
||||
|
||||
@ -10,188 +10,188 @@ import electrosphere.Main;
|
||||
|
||||
public class MediumRunTests {
|
||||
|
||||
@Test
|
||||
public void test3by3Chunk1Step(){
|
||||
// @Test
|
||||
// public void test3by3Chunk1Step(){
|
||||
|
||||
int dim = 3;
|
||||
int maxTimestep = 1;
|
||||
// int dim = 3;
|
||||
// int maxTimestep = 1;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3by3Chunk50Step(){
|
||||
|
||||
int dim = 3;
|
||||
int maxTimestep = 50;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3by3Chunk100Step(){
|
||||
|
||||
int dim = 3;
|
||||
int maxTimestep = 100;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3by3Chunk500Step(){
|
||||
|
||||
int dim = 3;
|
||||
int maxTimestep = 500;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test3by3Chunk50Step(){
|
||||
|
||||
// int dim = 3;
|
||||
// int maxTimestep = 50;
|
||||
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test3by3Chunk100Step(){
|
||||
|
||||
// int dim = 3;
|
||||
// int maxTimestep = 100;
|
||||
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test3by3Chunk500Step(){
|
||||
|
||||
// int dim = 3;
|
||||
// int maxTimestep = 500;
|
||||
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -15,188 +15,188 @@ import electrosphere.Main;
|
||||
*/
|
||||
public class ShortRunTest {
|
||||
|
||||
@Test
|
||||
public void test1by1Chunk1Step(){
|
||||
// @Test
|
||||
// public void test1by1Chunk1Step(){
|
||||
|
||||
int dim = 1;
|
||||
int maxTimestep = 1;
|
||||
// int dim = 1;
|
||||
// int maxTimestep = 1;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1by1Chunk50Step(){
|
||||
|
||||
int dim = 1;
|
||||
int maxTimestep = 50;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1by1Chunk100Step(){
|
||||
|
||||
int dim = 1;
|
||||
int maxTimestep = 100;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1by1Chunk500Step(){
|
||||
|
||||
int dim = 1;
|
||||
int maxTimestep = 500;
|
||||
|
||||
System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
//init chunk array
|
||||
FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
//simulate the chunk
|
||||
for(int i = 0; i < maxTimestep; i++){
|
||||
FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
}
|
||||
|
||||
for(int x = 0; x < dim; x++){
|
||||
for(int y = 0; y < dim; y++){
|
||||
for(int z = 0; z < dim; z++){
|
||||
InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = testFileIS.readAllBytes();
|
||||
ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
fromDiskBuffer.put(bytes);
|
||||
fromDiskBuffer.flip();
|
||||
ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
int i = 0;
|
||||
while(densityBytes.hasRemaining()){
|
||||
boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
assert(pass);
|
||||
i++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("PASSED");
|
||||
|
||||
}
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test1by1Chunk50Step(){
|
||||
|
||||
// int dim = 1;
|
||||
// int maxTimestep = 50;
|
||||
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test1by1Chunk100Step(){
|
||||
|
||||
// int dim = 1;
|
||||
// int maxTimestep = 100;
|
||||
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test1by1Chunk500Step(){
|
||||
|
||||
// int dim = 1;
|
||||
// int maxTimestep = 500;
|
||||
|
||||
// System.out.println("TEST: " + dim + "x" + dim + "x" + dim + " for " + maxTimestep + " steps");
|
||||
|
||||
// //init chunk array
|
||||
// FluidSim[][][] simArray = FluidSim.initFluidSim(dim,dim,dim);
|
||||
|
||||
// //simulate the chunk
|
||||
// for(int i = 0; i < maxTimestep; i++){
|
||||
// FluidSim.simChunks(simArray, i, Main.TIMESTEP);
|
||||
// }
|
||||
|
||||
// for(int x = 0; x < dim; x++){
|
||||
// for(int y = 0; y < dim; y++){
|
||||
// for(int z = 0; z < dim; z++){
|
||||
// InputStream testFileIS = this.getClass().getResourceAsStream("./testdata/" + dim + "by" + dim + "/" + maxTimestep + "steps/chunk_" + x + "_" + y + "_" + z + "_" + dim + "by" + dim + "Chunk" + maxTimestep + "Step.data");
|
||||
// byte[] bytes;
|
||||
// try {
|
||||
// bytes = testFileIS.readAllBytes();
|
||||
// ByteBuffer fromDiskBuffer = ByteBuffer.allocate(FluidSim.DIM * FluidSim.DIM * FluidSim.DIM * 4);
|
||||
// fromDiskBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
// fromDiskBuffer.put(bytes);
|
||||
// fromDiskBuffer.flip();
|
||||
// ByteBuffer densityBytes = simArray[x][y][z].getDensityBuffer();
|
||||
// int i = 0;
|
||||
// while(densityBytes.hasRemaining()){
|
||||
// boolean pass = fromDiskBuffer.get() == densityBytes.get();
|
||||
// assert(pass);
|
||||
// i++;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// System.out.println("PASSED");
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user