Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Nov 17, 2023
1 parent 2dea504 commit ee8f8aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/util/src/is/riscv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import { isRiscV } from './index.js';

describe('isRiscV', (): void => {
it('is false on non-risc-v header', (): void => {
it('is false on non-risc-v/non-pvm header', (): void => {
expect(isRiscV(new Uint8Array([0, 97, 115, 109, 1, 2, 3]))).toEqual(false);
});

it('is false on partial-risc-v header', (): void => {
it('is false on partial-risc-v/pvm header', (): void => {
expect(isRiscV(new Uint8Array([0x7f, 0x45, 0x4c]))).toEqual(false);
});

it('is false on empty byte before risc-v header', (): void => {
it('is false on empty byte before risc-v/pvm header', (): void => {
expect(
isRiscV(
new Uint8Array([0x00, 0x7f, 0x45, 0x4c, 0x46, 0xff, 0x00, 0x42, 0x23])
Expand All @@ -27,4 +27,10 @@ describe('isRiscV', (): void => {
isRiscV(new Uint8Array([0x7f, 0x45, 0x4c, 0x46, 0xff, 0x00, 0x42, 0x23]))
).toEqual(true);
});

it('is true when a pvm header is found', (): void => {
expect(
isRiscV(new Uint8Array([0x50, 0x56, 0x4d, 0x00, 0xff, 0x00, 0x42, 0x23]))
).toEqual(true);
});
});

0 comments on commit ee8f8aa

Please sign in to comment.