All files / io / _test_common.ts

100.00% Branches 1/1
100.00% Lines 21/21
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
 
 
x2
x2
x2
x2
x2
x2
x2
x2
x2
x2
x2
x2
x2
 
 
x2
 
x2
x6
x6
x406
x406
x6
x6
























// Copyright 2018-2025 the Deno authors. MIT license.

export const MIN_READ_BUFFER_SIZE = 16;
export const bufsizes = [
  0,
  MIN_READ_BUFFER_SIZE,
  23,
  32,
  46,
  64,
  93,
  128,
  1024,
  4096,
];

// N controls how many iterations of certain checks are performed.
const N = 100;

export function init(): Uint8Array {
  const testBytes = new Uint8Array(N);
  for (let i = 0; i < N; i++) {
    testBytes[i] = "a".charCodeAt(0) + (i % 26);
  }
  return testBytes;
}