molstar
Version:
A comprehensive macromolecular library.
47 lines • 1.66 kB
JavaScript
/**
* Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
*/
Object.defineProperty(exports, "__esModule", { value: true });
var linked_index_1 = require("../linked-index");
describe('linked-index', function () {
it('initial state', function () {
var index = (0, linked_index_1.LinkedIndex)(2);
expect(index.head).toBe(0);
expect(index.has(0)).toBe(true);
expect(index.has(1)).toBe(true);
});
it('singleton', function () {
var index = (0, linked_index_1.LinkedIndex)(1);
expect(index.head).toBe(0);
expect(index.has(0)).toBe(true);
index.remove(0);
expect(index.head).toBe(-1);
expect(index.has(0)).toBe(false);
});
it('remove 0', function () {
var index = (0, linked_index_1.LinkedIndex)(2);
index.remove(0);
expect(index.head).toBe(1);
expect(index.has(0)).toBe(false);
expect(index.has(1)).toBe(true);
});
it('remove 1', function () {
var index = (0, linked_index_1.LinkedIndex)(2);
index.remove(1);
expect(index.head).toBe(0);
expect(index.has(0)).toBe(true);
expect(index.has(1)).toBe(false);
});
it('remove 01', function () {
var index = (0, linked_index_1.LinkedIndex)(2);
index.remove(0);
index.remove(1);
expect(index.head).toBe(-1);
expect(index.has(0)).toBe(false);
expect(index.has(1)).toBe(false);
});
});
//# sourceMappingURL=linked-index.spec.js.map
;