Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4fd7698

Browse files
committed
Updated SimpleNoise test to use org.juint.Assert instead of jupiter
1 parentba90059 commit4fd7698

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed
Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,49 @@
11
packagesrc.test.java.com.generation;
22

3-
importstaticorg.junit.jupiter.api.Assertions.*;
4-
53
importjava.awt.Color;
64
importjava.awt.image.BufferedImage;
75
importjava.io.IOException;
86
importjava.io.InputStream;
97

108
importjavax.imageio.ImageIO;
119

12-
importorg.junit.jupiter.api.Test;
10+
importorg.junit.Assert;
11+
importorg.junit.Test;
1312

1413
importsrc.main.java.com.generation.SimplexNoise;
1514

1615
publicclassSimplexNoiseTest {
1716

18-
@Test
19-
publicvoidtestGenerateHeightMap() {
20-
21-
finalintWIDTH =256;
22-
finalintHEIGHT =256;
23-
finalintX =0;
24-
finalintY =0;
25-
finalStringRESOURCE_NAME ="src/test/java/com/generation/expected-result.png";
26-
27-
float[][]heightmap =newSimplexNoise(50,0.3F,1111111111111111L).generateHeightMap(X,Y,WIDTH,HEIGHT);
28-
BufferedImageimage =null;
29-
30-
try(InputStreamin =this.getClass().getClassLoader().getResourceAsStream(RESOURCE_NAME)) {
31-
32-
image =ImageIO.read(in);
33-
34-
assertEquals(WIDTH,image.getWidth());
35-
assertEquals(HEIGHT,image.getHeight());
36-
37-
}catch(IOException |IllegalArgumentExceptionexception) {
38-
39-
fail(exception);
40-
}
41-
42-
for(intx =0;x <WIDTH;x++) {
43-
44-
for(inty =0;y <HEIGHT;y++) {
45-
46-
assertEquals(newColor(image.getRGB(x,y)).getRed(), (int)(heightmap[x][y] *255));
47-
}
48-
}
49-
}
17+
@Test
18+
publicvoidtestGenerateHeightMap() {
19+
20+
finalintWIDTH =256;
21+
finalintHEIGHT =256;
22+
finalintX =0;
23+
finalintY =0;
24+
finalStringRESOURCE_NAME ="src/test/java/com/generation/expected-result.png";
25+
26+
float[][]heightmap =newSimplexNoise(50,0.3F,1111111111111111L).generateHeightMap(X,Y,WIDTH,HEIGHT);
27+
BufferedImageimage =null;
28+
29+
try(InputStreamin =this.getClass().getClassLoader().getResourceAsStream(RESOURCE_NAME)) {
30+
31+
image =ImageIO.read(in);
32+
33+
Assert.assertEquals(WIDTH,image.getWidth());
34+
Assert.assertEquals(HEIGHT,image.getHeight());
35+
36+
}catch(IOException |IllegalArgumentExceptionexception) {
37+
38+
Assert.fail(exception.toString());
39+
}
40+
41+
for(intx =0;x <WIDTH;x++) {
42+
43+
for(inty =0;y <HEIGHT;y++) {
44+
45+
Assert.assertEquals(newColor(image.getRGB(x,y)).getRed(), (int)(heightmap[x][y] *255));
46+
}
47+
}
48+
}
5049
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp