Skip to content

Commit

Permalink
test(codec): increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
homura committed Jun 20, 2024
1 parent 1820e0f commit b5d0c0e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions packages/codec/tests/bytes-like.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,19 @@ test("compare BytesLike", (t) => {
});

test("indexOf BytesLike", (t) => {
t.is(2, indexOf([1, 2, 3, 4, 5], [3, 4]));
t.is(3, indexOf([1, 2, 3, 4, 5], [4, 5]));
t.is(-1, indexOf([1, 2, 3, 4, 5], [6, 7]));
t.is(0, indexOf([1, 2, 3, 4, 5], []));
t.is(-1, indexOf([], [1, 2]));
t.is(0, indexOf([1, 2, 1, 2, 1, 2], [1, 2]));
t.is(1, indexOf([1, 2, 1, 2, 1, 2], [2, 1]));
t.is(0, indexOf([1, 2, 1, 2, 1, 2], [1, 2, 1]));
t.is(1, indexOf([1, 2, 1, 2, 1, 2], [2, 1, 2]));
t.is(2, indexOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [3, 4, 5, 6]));
t.is(indexOf([1, 2, 3, 4, 5], [3, 4]), 2);
t.is(indexOf([1, 2, 3, 4, 5], []), 0);
t.is(indexOf([1, 2, 3], [1, 2, 3, 4]), -1);
t.is(indexOf([1, 2, 3, 4, 5], [6, 7]), -1);
t.is(indexOf([1, 2, 3, 4, 5], [1, 2]), 0);
t.is(indexOf([1, 2, 3, 4, 5], [4, 5]), 3);
t.is(indexOf([1, 2, 3], [1, 2, 3]), 0);
t.is(indexOf([1, 2, 3, 4, 5], [3]), 2);
t.is(indexOf([1, 2, 1, 2, 3], [1, 2, 3]), 2);
t.is(indexOf([1, 2, 3, 1, 2, 3, 4], [1, 2, 3, 4]), 3);

t.is(indexOf([1, 2, 1, 2, 3], [1, 2, 3]), 2);
t.is(indexOf([1, 2, 1, 2, 1, 3, 4], [1, 2, 3]), -1);

t.is(indexOf([1, 1, 2, 3, 5, 8], [1, 1, 2, 3]), 0);
});

0 comments on commit b5d0c0e

Please sign in to comment.