large.js 660B

1234567891011121314151617181920212223242526
  1. /*
  2. * $Id: large.js,v 0.3 2012/08/23 19:14:37 dankogai Exp dankogai $
  3. *
  4. * use mocha to test me
  5. * http://visionmedia.github.com/mocha/
  6. */
  7. var assert = assert || require("assert");
  8. var Base64 = Base64 || require('../base64.js').Base64;
  9. var is = function (a, e, m) {
  10. return function () {
  11. assert.equal(a, e, m)
  12. }
  13. };
  14. var seed = function () {
  15. var a, i;
  16. for (a = [], i = 0; i < 256; i++) {
  17. a.push(String.fromCharCode(i));
  18. }
  19. return a.join('');
  20. }();
  21. describe('Base64', function () {
  22. for (var i = 0, str = seed; i < 16; str += str, i++) {
  23. it(''+str.length, is(Base64.decode(Base64.encode(str)), str));
  24. }
  25. });