Created
December 9, 2017 14:38
-
-
Save hotzen/0a179ba36ce98eac17a3a5cccbc8c186 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("boxBlurKernel should return the correct value on an interior pixel " + | |
"of a 3x3 image with radius 1") { | |
val src = new Img(3, 3) | |
src(0, 0) = 0; src(1, 0) = 1; src(2, 0) = 2 | |
src(0, 1) = 3; src(1, 1) = 4; src(2, 1) = 5 | |
src(0, 2) = 6; src(1, 2) = 7; src(2, 2) = 8 | |
def check(x: Int, y: Int, expected: Int) = | |
assertResult(expected, s"boxBlurKernel($x, $y, 1)")( boxBlurKernel(src, x, y, 1) ) | |
check(0, 0, 2) | |
check(1, 0, 2) | |
check(2, 0, 3) | |
check(0, 1, 3) | |
check(1, 1, 4) | |
check(2, 1, 4) | |
check(0, 2, 0) | |
check(1, 2, 0) | |
check(2, 2, 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment