large.js 690 B

12345678910111213141516171819202122232425262728
  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, Base64;
  8. if (this['window'] !== this) {
  9. assert = require("assert");
  10. Base64 = require('../base64.js').Base64;
  11. }
  12. var is = function (a, e, m) {
  13. return function () {
  14. assert.equal(a, e, m)
  15. }
  16. };
  17. var seed = function () {
  18. var a, i;
  19. for (a = [], i = 0; i < 256; i++) {
  20. a.push(String.fromCharCode(i));
  21. }
  22. return a.join('');
  23. }();
  24. describe('Base64', function () {
  25. for (var i = 0, str = seed; i < 16; str += str, i++) {
  26. it(str.length, is(Base64.decode(Base64.encode(str)), str));
  27. }
  28. });