Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
7
7_team_pic-puzzle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Justin
7_team_pic-puzzle
Commits
34d2d5d4
Commit
34d2d5d4
authored
9 years ago
by
Justin
Browse files
Options
Downloads
Patches
Plain Diff
Made coding style more uniform
parent
445ad987
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PicPuzzle/src/PicPuzzle/NonogramTest.java
+35
-53
35 additions, 53 deletions
PicPuzzle/src/PicPuzzle/NonogramTest.java
with
35 additions
and
53 deletions
PicPuzzle/src/PicPuzzle/
Junit
Test.java
→
PicPuzzle/src/PicPuzzle/
Nonogram
Test.java
+
35
−
53
View file @
34d2d5d4
...
...
@@ -4,15 +4,13 @@ import static org.junit.Assert.*;
import
java.io.File
;
import
java.io.IOException
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
public
class
Junit
Test
{
public
class
Nonogram
Test
{
private
int
Height
1
=
8
;
private
static
final
int
HEIGHT
1
=
8
;
private
int
W
idth
1
=
8
;
private
static
final
int
W
IDTH
1
=
8
;
private
boolean
[][]
testImageData1
={
{
false
,
false
,
true
,
true
,
true
,
true
,
false
,
false
},
...
...
@@ -25,9 +23,9 @@ public class JunitTest {
{
false
,
false
,
true
,
true
,
true
,
true
,
false
,
false
},
};
private
int
Height
2
=
8
;
private
static
final
int
HEIGHT
2
=
8
;
private
int
W
idth
2
=
8
;
private
static
final
int
W
IDTH
2
=
8
;
private
boolean
[][]
testImageData2
={
{
true
,
true
,
true
,
true
,
true
,
true
,
true
,
true
},
...
...
@@ -40,9 +38,9 @@ public class JunitTest {
{
true
,
true
,
true
,
true
,
true
,
true
,
true
,
true
},
};
private
int
Height
3
=
8
;
private
static
final
int
HEIGHT
3
=
8
;
private
int
W
idth
3
=
8
;
private
static
final
int
W
IDTH
3
=
8
;
private
boolean
[][]
testImageData3
={
{
false
,
false
,
false
,
true
,
true
,
false
,
false
,
false
},
...
...
@@ -55,87 +53,73 @@ public class JunitTest {
{
false
,
false
,
false
,
true
,
true
,
false
,
false
,
false
},
};
@Before
public
void
setUp
()
throws
Exception
{
}
@After
public
void
tearDown
()
throws
Exception
{
}
@Test
public
void
testNonogram
()
throws
IOException
{
Nonogram
test
=
new
Nonogram
(
new
File
(
"test.png"
)
);
Nonogram
test
=
new
Nonogram
(
new
File
(
"test.png"
)
);
assertEquals
(
H
eight
1
,
test
.
getHeight
());
assertEquals
(
W
idth
1
,
test
.
getWidth
());
assertEquals
(
H
EIGHT
1
,
test
.
getHeight
());
assertEquals
(
W
IDTH
1
,
test
.
getWidth
());
for
(
int
y
=
0
;
y
<
test
.
getHeight
();
y
++)
{
for
(
int
x
=
0
;
x
<
test
.
getWidth
();
x
++)
{
assertEquals
(
test
.
getPixel
(
y
,
x
),
testImageData1
[
y
][
x
]);
}
assertEquals
(
test
.
getPixel
(
y
,
x
),
testImageData1
[
y
][
x
]);
}
}
Nonogram
test2
=
new
Nonogram
(
new
File
(
"square.png"
)
);
assertEquals
(
H
eight
2
,
test2
.
getHeight
());
assertEquals
(
W
idth
2
,
test2
.
getWidth
());
assertEquals
(
H
EIGHT
2
,
test2
.
getHeight
());
assertEquals
(
W
IDTH
2
,
test2
.
getWidth
());
for
(
int
y
=
0
;
y
<
test2
.
getHeight
();
y
++)
{
for
(
int
x
=
0
;
x
<
test2
.
getWidth
();
x
++)
{
assertEquals
(
test2
.
getPixel
(
y
,
x
),
testImageData2
[
y
][
x
]);
}
assertEquals
(
test2
.
getPixel
(
y
,
x
),
testImageData2
[
y
][
x
]);
}
}
Nonogram
test3
=
new
Nonogram
(
new
File
(
"cross.png"
)
);
assertEquals
(
H
eight
3
,
test3
.
getHeight
());
assertEquals
(
W
idth
3
,
test3
.
getWidth
());
assertEquals
(
H
EIGHT
3
,
test3
.
getHeight
());
assertEquals
(
W
IDTH
3
,
test3
.
getWidth
());
for
(
int
y
=
0
;
y
<
test3
.
getHeight
();
y
++)
{
for
(
int
x
=
0
;
x
<
test3
.
getWidth
();
x
++)
{
assertEquals
(
test3
.
getPixel
(
y
,
x
),
testImageData3
[
y
][
x
]);
}
assertEquals
(
test3
.
getPixel
(
y
,
x
),
testImageData3
[
y
][
x
]);
}
}
Nonogram
test4
=
new
Nonogram
(
new
File
(
"test.bmp"
)
);
assertEquals
(
H
eight
1
,
test4
.
getHeight
());
assertEquals
(
W
idth
1
,
test4
.
getWidth
());
assertEquals
(
H
EIGHT
1
,
test4
.
getHeight
());
assertEquals
(
W
IDTH
1
,
test4
.
getWidth
());
for
(
int
y
=
0
;
y
<
test4
.
getHeight
();
y
++)
{
for
(
int
x
=
0
;
x
<
test4
.
getWidth
();
x
++)
{
assertEquals
(
test4
.
getPixel
(
y
,
x
),
testImageData1
[
y
][
x
]);
}
assertEquals
(
test4
.
getPixel
(
y
,
x
),
testImageData1
[
y
][
x
]);
}
}
Nonogram
test5
=
new
Nonogram
(
new
File
(
"square.bmp"
)
);
assertEquals
(
H
eight
2
,
test5
.
getHeight
());
assertEquals
(
W
idth
2
,
test5
.
getWidth
());
assertEquals
(
H
EIGHT
2
,
test5
.
getHeight
());
assertEquals
(
W
IDTH
2
,
test5
.
getWidth
());
for
(
int
y
=
0
;
y
<
test5
.
getHeight
();
y
++)
{
for
(
int
x
=
0
;
x
<
test5
.
getWidth
();
x
++)
{
assertEquals
(
test5
.
getPixel
(
y
,
x
),
testImageData2
[
y
][
x
]);
}
assertEquals
(
test5
.
getPixel
(
y
,
x
),
testImageData2
[
y
][
x
]);
}
}
Nonogram
test6
=
new
Nonogram
(
new
File
(
"cross.bmp"
)
);
assertEquals
(
H
eight
3
,
test6
.
getHeight
());
assertEquals
(
W
idth
3
,
test6
.
getWidth
());
assertEquals
(
H
EIGHT
3
,
test6
.
getHeight
());
assertEquals
(
W
IDTH
3
,
test6
.
getWidth
());
for
(
int
y
=
0
;
y
<
test6
.
getHeight
();
y
++)
{
for
(
int
x
=
0
;
x
<
test6
.
getWidth
();
x
++)
{
assertEquals
(
test6
.
getPixel
(
y
,
x
),
testImageData3
[
y
][
x
]);
}
assertEquals
(
test6
.
getPixel
(
y
,
x
),
testImageData3
[
y
][
x
]);
}
}
...
...
@@ -144,14 +128,12 @@ public class JunitTest {
@Test
(
expected
=
NullPointerException
.
class
)
public
void
testException
()
throws
IOException
{
Nonogram
test7
=
new
Nonogram
(
new
File
(
"empty.bmp"
)
);
new
Nonogram
(
new
File
(
"empty.bmp"
)
);
}
@Test
(
expected
=
IOException
.
class
)
public
void
testException2
()
throws
IOException
{
Nonogram
test8
=
new
Nonogram
(
new
File
(
"blue.bmp"
)
);
new
Nonogram
(
new
File
(
"blue.bmp"
)
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment