MCPcopy
hub / github.com/jestjs/jest / assertCommonItems

Function assertCommonItems

packages/diff-sequences/src/__tests__/index.test.ts:141–155  ·  view source on GitHub ↗
(
  a: Array<unknown> | string,
  b: Array<unknown> | string,
  nCommon: number,
  aCommon: number,
  bCommon: number,
)

Source from the content-addressed store, hash-verified

139};
140
141const assertCommonItems = (
142 a: Array<unknown> | string,
143 b: Array<unknown> | string,
144 nCommon: number,
145 aCommon: number,
146 bCommon: number,
147) => {
148 for (; nCommon !== 0; nCommon -= 1, aCommon += 1, bCommon += 1) {
149 if (a[aCommon] !== b[bCommon]) {
150 throw new Error(
151 `output item is not common for aCommon=${aCommon} and bCommon=${bCommon}`,
152 );
153 }
154 }
155};
156
157// Given lengths of sequences and input function to compare items at indexes,
158// return number of differences according to baseline greedy forward algorithm.

Callers 1

findCommonItemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected