本文整理汇总了TypeScript中vs/editor/common/viewLayout/whitespaceComputer.WhitespaceComputer.findInsertionIndex方法的典型用法代码示例。如果您正苦于以下问题:TypeScript WhitespaceComputer.findInsertionIndex方法的具体用法?TypeScript WhitespaceComputer.findInsertionIndex怎么用?TypeScript WhitespaceComputer.findInsertionIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/viewLayout/whitespaceComputer.WhitespaceComputer
的用法示例。
在下文中一共展示了WhitespaceComputer.findInsertionIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('WhitespaceComputer findInsertionIndex', () => {
var makeArray = (size: number, fillValue: number) => {
var r: number[] = [];
for (var i = 0; i < size; i++) {
r[i] = fillValue;
}
return r;
};
var arr: number[];
var ordinals: number[];
arr = [];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 0);
arr = [1];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
arr = [1, 3];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 3, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 4, ordinals, 0), 2);
arr = [1, 3, 5];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 3, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 4, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 5, ordinals, 0), 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 6, ordinals, 0), 3);
arr = [1, 3, 5];
ordinals = makeArray(arr.length, 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 3, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 4, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 5, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 6, ordinals, 0), 3);
arr = [1, 3, 5, 7];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 3, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 4, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 5, ordinals, 0), 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 6, ordinals, 0), 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 7, ordinals, 0), 4);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 8, ordinals, 0), 4);
arr = [1, 3, 5, 7, 9];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 3, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 4, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 5, ordinals, 0), 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 6, ordinals, 0), 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 7, ordinals, 0), 4);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 8, ordinals, 0), 4);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 9, ordinals, 0), 5);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 10, ordinals, 0), 5);
arr = [1, 3, 5, 7, 9, 11];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 3, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 4, ordinals, 0), 2);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 5, ordinals, 0), 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 6, ordinals, 0), 3);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 7, ordinals, 0), 4);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 8, ordinals, 0), 4);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 9, ordinals, 0), 5);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 10, ordinals, 0), 5);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 11, ordinals, 0), 6);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 12, ordinals, 0), 6);
arr = [1, 3, 5, 7, 9, 11, 13];
ordinals = makeArray(arr.length, 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 0, ordinals, 0), 0);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 1, ordinals, 0), 1);
assert.equal(WhitespaceComputer.findInsertionIndex(arr, 2, ordinals, 0), 1);
//.........这里部分代码省略.........