Skip to content

Commit

Permalink
Test read after reset
Browse files Browse the repository at this point in the history
  • Loading branch information
cinderblock committed Jan 24, 2023
1 parent d9c215c commit 7473c43
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/usb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,35 @@ describe("Basic Communication with Hardware", () => {
);
}
});

test("Read flash to stdout after reset", async () => {
{
const run = runDfuTargeted(["reset"]);
const exitCode = await run.exitCode;
const { stdout, stderr } = run;

expect(exitCode).toBe(0);
expect(stdout).toBe("");
expect(stderr).toBe("");
}
{
const run = runDfuTargeted(["read"]);
const exitCode = await run.exitCode;
const { stdout, stderr } = run;

const bytes = 0x1000;
const dump = 0x80;
const offset = 0;

expect(exitCode).toBe(0);
expect(stdout).toBe(`:00000001FF${EOL}`);
expect(stderr).toBe('' +
`Reading 0x${bytes.toString(16)} bytes...${EOL}` +
`Success${EOL}` +
`Memory is blank, returning a single blank page.${EOL}` +
`Use --force to return the entire memory regardless.${EOL}` +
`Dumping 0x${dump.toString(16)} bytes from address offset 0x${offset.toString(16)}.${EOL}`
);
}
});
});

0 comments on commit 7473c43

Please sign in to comment.