Format code

This commit is contained in:
Michal Moskal 2016-07-01 14:46:05 +01:00
parent ecbb970983
commit 8413b61397

View File

@ -724,11 +724,11 @@ function switchB(e: En) {
return r;
}
function bufferIs(b:Buffer, a:number[]) {
function bufferIs(b: Buffer, a: number[]) {
assert(b.length == a.length, "bis-len")
for (let i = 0; i < a.length; ++i) {
if (a[i] != b[i]) {
assert(false, `bufferIs: buf[${i}]:${b[i]} != ${a[i]}`)
assert(false, `bufferIs: buf[${ i }]:${ b[i] } != ${ a[i] }`)
}
}
}
@ -742,33 +742,33 @@ function testBuffer() {
assert(b[100000] == 0, "bufM");
b[0] = 42;
bufferIs(b, [42, 0, 0]);
bufferIs(b,[42, 0, 0]);
b[2] = 41;
bufferIs(b, [42, 0, 41]);
bufferIs(b,[42, 0, 41]);
b.rotate(1)
bufferIs(b, [0, 41, 42]);
bufferIs(b,[0, 41, 42]);
b.rotate(-2)
bufferIs(b, [41, 42, 0]);
bufferIs(b,[41, 42, 0]);
b.shift(1)
bufferIs(b, [42, 0, 0]);
bufferIs(b,[42, 0, 0]);
b.rotate(9)
bufferIs(b, [42, 0, 0]);
bufferIs(b,[42, 0, 0]);
b.rotate(-9)
bufferIs(b, [42, 0, 0]);
bufferIs(b,[42, 0, 0]);
b.fill(4);
bufferIs(b, [4, 4, 4]);
bufferIs(b,[4, 4, 4]);
b.fill(12, 1, 1);
bufferIs(b, [4, 12, 4]);
bufferIs(b,[4, 12, 4]);
b.fill(13, 1, -1);
bufferIs(b, [4, 13, 13]);
bufferIs(b,[4, 13, 13]);
b.fill(100, -1, -1);
bufferIs(b, [4, 13, 13]);
bufferIs(b,[4, 13, 13]);
b.shift(-1)
bufferIs(b, [0, 4, 13]);
bufferIs(b,[0, 4, 13]);
}