Skip to content

Instantly share code, notes, and snippets.

@notyy
Created October 28, 2011 09:35
Show Gist options
  • Save notyy/1321966 to your computer and use it in GitHub Desktop.
Save notyy/1321966 to your computer and use it in GitHub Desktop.
change to func
def assertArray(b1: Array[Byte], b2: Array[Byte]) {
if (b1 == null && b2 == null) return;
else if (b1 != null && b2 != null) {
if (b1.length != b2.length) throw new AssertionError("b1.length != b2.length")
else {
for (i <- b1.indices) {
if (b1(i) != b2(i)) throw new AssertionError("b1(%d) != b2(%d)".format(i, i))
}
}
} else {
throw new AssertionError("b1 is null while b2 is not, vice versa")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment