Skip to content

Instantly share code, notes, and snippets.

@hotzen
Created December 9, 2017 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hotzen/0a179ba36ce98eac17a3a5cccbc8c186 to your computer and use it in GitHub Desktop.
Save hotzen/0a179ba36ce98eac17a3a5cccbc8c186 to your computer and use it in GitHub Desktop.
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