2010-05-26 22:34:42 +00:00
|
|
|
function testCore(coreName, cb) {
|
|
|
|
var corePath = "../", testPath = "../test/", testFiles = [
|
|
|
|
corePath + coreName,
|
|
|
|
"test.js",
|
|
|
|
"aes_test.js",
|
|
|
|
"aes_vectors.js",
|
|
|
|
"ccm_test.js",
|
|
|
|
"ccm_vectors.js",
|
|
|
|
"ocb2_test.js",
|
|
|
|
"ocb2_vectors.js",
|
2010-10-16 20:42:01 +00:00
|
|
|
"cbc_test.js",
|
|
|
|
"cbc_vectors.js",
|
2010-05-26 22:34:42 +00:00
|
|
|
"sha256_test.js",
|
|
|
|
"sha256_vectors.js",
|
|
|
|
"sha256_test_brute_force.js",
|
2011-04-19 22:08:56 +00:00
|
|
|
"sha1_test.js",
|
|
|
|
"sha1_vectors.js",
|
2010-05-26 22:34:42 +00:00
|
|
|
"hmac_test.js",
|
|
|
|
"hmac_vectors.js",
|
2010-10-08 04:10:46 +00:00
|
|
|
"pbkdf2_test.js",
|
2011-04-19 22:08:56 +00:00
|
|
|
"bn_test.js",
|
|
|
|
"bn_vectors.js",
|
2011-04-21 00:50:23 +00:00
|
|
|
"srp_test.js",
|
|
|
|
"srp_vectors.js"
|
2010-05-26 22:34:42 +00:00
|
|
|
], i;
|
|
|
|
|
|
|
|
for (i=1; i<testFiles.length; i++) {
|
|
|
|
testFiles[i] = testPath + testFiles[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
browserUtil.loadScripts(testFiles, function() {
|
|
|
|
browserUtil.write("begin", coreName);
|
|
|
|
browserUtil.status("Testing...");
|
|
|
|
sjcl.test.run([], function () {
|
|
|
|
browserUtil.status("");
|
|
|
|
cb && cb();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
function (script, err) {
|
|
|
|
browserUtil.allPassed = false;
|
|
|
|
browserUtil.write("begin fail", coreName);
|
|
|
|
browserUtil.write("fail", "Failed to load "+script+": "+err);
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function testCores(coreNames, cb) {
|
|
|
|
browserUtil.cpsMap(function (n,x,y,cb) { testCore(n,cb); }, coreNames, true, function() {
|
|
|
|
if (browserUtil.allPassed) {
|
|
|
|
browserUtil.write("pass all", "All tests passed.");
|
|
|
|
} else {
|
|
|
|
browserUtil.write("fail all", "All tests complete, but some failed!");
|
|
|
|
}
|
|
|
|
cb && cb();
|
|
|
|
});
|
|
|
|
}
|