Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80559 views
1
/* -*- Mode: js; js-indent-level: 2; -*- */
2
/*
3
* Copyright 2011 Mozilla Foundation and contributors
4
* Licensed under the New BSD license. See LICENSE or:
5
* http://opensource.org/licenses/BSD-3-Clause
6
*/
7
if (typeof define !== 'function') {
8
var define = require('amdefine')(module, require);
9
}
10
define(function (require, exports, module) {
11
12
var base64 = require('../../lib/source-map/base64');
13
14
exports['test out of range encoding'] = function (assert, util) {
15
assert.throws(function () {
16
base64.encode(-1);
17
});
18
assert.throws(function () {
19
base64.encode(64);
20
});
21
};
22
23
exports['test out of range decoding'] = function (assert, util) {
24
assert.throws(function () {
25
base64.decode('=');
26
});
27
};
28
29
exports['test normal encoding and decoding'] = function (assert, util) {
30
for (var i = 0; i < 64; i++) {
31
assert.equal(base64.decode(base64.encode(i)), i);
32
}
33
};
34
35
});
36
37