Diffstat (limited to 'frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js b/frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js index b54996f..6de67c3 100644 --- a/frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js +++ b/frontend/gamma/tests/tests/Clipperz/PM/Toll.test.js @@ -1,120 +1,117 @@ /* Copyright 2008-2011 Clipperz Srl -This file is part of Clipperz's Javascript Crypto Library. -Javascript Crypto Library provides web developers with an extensive -and efficient set of cryptographic functions. The library aims to -obtain maximum execution speed while preserving modularity and -reusability. +This file is part of Clipperz Community Edition. +Clipperz Community Edition is an online password manager. For further information about its features and functionalities please -refer to http://www.clipperz.com +refer to http://www.clipperz.com. -* Javascript Crypto Library is free software: you can redistribute +* Clipperz Community Edition is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -* Javascript Crypto Library is distributed in the hope that it will +* Clipperz Community Edition is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public - License along with Javascript Crypto Library. If not, see + License along with Clipperz Community Edition. If not, see <http://www.gnu.org/licenses/>. */ Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); var tests = { //------------------------------------------------------------------------- /* 'simple_test': function() { var deferredResult; deferredResult = new Clipperz.Async.Deferred("simple_tests", {trace:false}); deferredResult.addCallback(function() { var tollTargetValue; var toll; var price; tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); tollTargetValue = Clipperz.Crypto.SHA.sha256(tollTargetValue); price = 1; tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price}); toll.pay(); price = 5; tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price}); toll.pay(); price = 6; tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price}); toll.pay(); price = 7; tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price}); toll.pay(); price = 7; tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32); toll = new Clipperz.PM.Toll({targetValue:tollTargetValue.toHexString(), cost:price}); toll.pay(); }); deferredResult.callback(); return deferredResult; }, */ //------------------------------------------------------------------------- 'deferredPay_test': function() { var deferredResult; var tollTargetValue; var toll_1, toll_5, toll_6, toll_7, toll_10, toll_16; // tollTargetValue = Clipperz.Crypto.SHA.sha256(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32)); deferredResult = new Clipperz.Async.Deferred("deferredPay_tests", {trace:false}); tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); toll_1 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:1}); deferredResult.addMethod(toll_1, 'deferredPay'); deferredResult.addCallback(function (aResult) { SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 1), "Payed a toll of cost 1"); }); deferredResult.addCallback(MochiKit.Async.wait, 1); tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); toll_5 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:5}); deferredResult.addMethod(toll_5, 'deferredPay'); deferredResult.addCallback(function (aResult) { SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 5), "Payed a toll of cost 5"); }); deferredResult.addCallback(MochiKit.Async.wait, 1); tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); toll_6 = new Clipperz.PM.Toll({targetValue:tollTargetValue, cost:6}); deferredResult.addMethod(toll_6, 'deferredPay'); deferredResult.addCallback(function (aResult) { SimpleTest.ok(Clipperz.PM.Toll.validate(aResult.targetValue, aResult.toll, 6), "Payed a toll of cost 6"); }); deferredResult.addCallback(MochiKit.Async.wait, 1); tollTargetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); |