-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
86 lines (67 loc) · 1.92 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
describeRealm('Builtin: HashMap', function (options) {
let realm;
let backing;
let T;
before(() => {
realm = options.realm;
backing = realm.backing;
T = realm.T;
});
describe('Empty hash map', function () {
let map;
it('should create a new hash map', function () {
map = new T.HashMap();
});
it('should have a size of zero', function () {
map.size.should.equal(0);
});
it('should set a string key + value', function () {
map.set('hello', 'world');
});
it('should get a string key + value', function () {
map.get('hello').should.equal('world');
});
it('should set a numeric key', function () {
map.set(123, 'abc');
});
it('should get a numeric key', function () {
map.get(123).should.equal('abc');
});
it('should set a boolean key / value', function () {
map.set(true, false);
});
it('should get a boolean key', function () {
map.get(true).should.equal(false);
});
it('should have the right size', function () {
map.size.should.equal(3);
});
});
describe('Hashmap from map', function () {
let map;
it('should create a new hash map', function () {
map = new T.HashMap(new Map([['hello', 'world']]));
});
it('should have a size of 1', function () {
map.size.should.equal(1);
});
it('should get a string key + value', function () {
map.get('hello').should.equal('world');
});
it('should set a numeric key', function () {
map.set(123, 'abc');
});
it('should get a numeric key', function () {
map.get(123).should.equal('abc');
});
it('should set a boolean key / value', function () {
map.set(true, false);
});
it('should get a boolean key', function () {
map.get(true).should.equal(false);
});
it('should have the right size', function () {
map.size.should.equal(3);
});
});
});