@tanishiking/aho-corasick
Version:
TypeScript implementation of the Aho-Corasick algorithm for efficient string matching
28 lines (27 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var interval_1 = require("./interval");
describe('Interval', function () {
describe('euqals', function () {
test('identity', function () {
var x = new interval_1.Interval(0, 1);
expect(x.equals(x)).toBeTruthy();
});
test('intervals that have same start and end should be equal', function () {
var x = new interval_1.Interval(0, 1);
var y = new interval_1.Interval(0, 1);
expect(x.equals(y)).toBeTruthy();
});
test('intervals that have different start and end should not be equal', function () {
var x = new interval_1.Interval(0, 1);
var y = new interval_1.Interval(0, 2);
expect(x.equals(y)).toBeFalsy();
});
});
describe('size', function () {
test('should be end - start + 1', function () {
var y = new interval_1.Interval(0, 2);
expect(y.size()).toBe(3);
});
});
});