First cut of ALICE test vectors

This commit is contained in:
Matt Corallo 2014-07-23 01:49:13 -04:00
parent a8908646aa
commit 287b55120d
3 changed files with 50 additions and 41 deletions

View file

@ -127,11 +127,11 @@ function getStringable(thing) {
thing.__proto__ == StaticWordArrayProto)));
}
function isEqual(a, b) {
function isEqual(a, b, mayBeShort) {
// TODO: Special-case arraybuffers, etc
a = getString(a);
b = getString(b);
var maxLength = Math.min(a.length, b.length);
var maxLength = mayBeShort ? Math.min(a.length, b.length) : Math.max(a.length, b.length);
if (maxLength < 5)
throw new Error("a/b compare too short");
return a.substring(0, Math.min(maxLength, a.length)) == b.substring(0, Math.min(maxLength, b.length));