aboutsummaryrefslogtreecommitdiff
path: root/src/peripherals/timer.spec.ts
diff options
context:
space:
mode:
authorUri Shaked2025-02-11 10:22:50 +0200
committerUri Shaked2025-02-11 10:22:50 +0200
commit05c5c7e9069e1ace3441c1f8f12e45b3d304748e (patch)
tree8047a1a96c544794300bd80ecfc4590315be7076 /src/peripherals/timer.spec.ts
parentci: update Node.js versions (diff)
downloadavr8js-05c5c7e9069e1ace3441c1f8f12e45b3d304748e.tar.gz
avr8js-05c5c7e9069e1ace3441c1f8f12e45b3d304748e.tar.bz2
avr8js-05c5c7e9069e1ace3441c1f8f12e45b3d304748e.zip
test: migrate tests from jest to vitest
Diffstat (limited to 'src/peripherals/timer.spec.ts')
-rw-r--r--src/peripherals/timer.spec.ts27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/peripherals/timer.spec.ts b/src/peripherals/timer.spec.ts
index 609908d..893fe32 100644
--- a/src/peripherals/timer.spec.ts
+++ b/src/peripherals/timer.spec.ts
@@ -1,3 +1,4 @@
+import { describe, expect, it, vi } from 'vitest';
import { CPU } from '../cpu/cpu';
import { asmProgram, TestProgramRunner } from '../utils/test-utils';
import { AVRIOPort, PinOverrideMode, portBConfig, portDConfig } from './gpio';
@@ -544,7 +545,7 @@ describe('timer', () => {
// Listen to Port B's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
cpu.writeData(TCCR0B, FOC0B);
@@ -580,7 +581,7 @@ describe('timer', () => {
// Listen to Port D's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
const runner = new TestProgramRunner(cpu);
@@ -633,7 +634,7 @@ describe('timer', () => {
// Listen to Port D's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
const runner = new TestProgramRunner(cpu);
@@ -679,7 +680,7 @@ describe('timer', () => {
// Listen to Port D's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
const runner = new TestProgramRunner(cpu);
@@ -753,7 +754,7 @@ describe('timer', () => {
// Listen to Port D's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
const nopCount = lines.filter((line) => line.bytes == nopOpCode).length;
const runner = new TestProgramRunner(cpu);
@@ -800,7 +801,7 @@ describe('timer', () => {
// Listen to Port D's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
const runner = new TestProgramRunner(cpu);
@@ -833,7 +834,7 @@ describe('timer', () => {
// Listen to Port D's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
const runner = new TestProgramRunner(cpu);
runner.runInstructions(instructionCount);
@@ -861,7 +862,7 @@ describe('timer', () => {
// Listen to Port D's internal callback
const portD = new AVRIOPort(cpu, portDConfig);
- const gpioCallback = jest.spyOn(portD, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portD, 'timerOverridePin');
const runner = new TestProgramRunner(cpu);
runner.runInstructions(instructionCount);
@@ -921,7 +922,7 @@ describe('timer', () => {
IN r17, 0x26 ; R17 = TCNT; // TCNT0 should read 0x0
IN r18, 0x26 ; R18 = TCNT; // TCNT0 should read 0x0
- LDI r16, 0x2 ; OCR0A = 0x2; // TCNT0 should read 0x0
+ LDI r16, 0x2 ; OCR0A = 0x2; // TCNT0 should read 0x1
OUT 0x27, r16 ; // TCNT0 should read 0x1
NOP ; // TCNT0 should read 0x2
IN r19, 0x26 ; R19 = TCNT; // TCNT0 should read 0x1
@@ -1118,7 +1119,7 @@ describe('timer', () => {
// Listen to Port B's internal callback
const portB = new AVRIOPort(cpu, portBConfig);
- const gpioCallback = jest.spyOn(portB, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portB, 'timerOverridePin');
const nopCount = lines.filter((line) => line.bytes == nopOpCode).length;
const runner = new TestProgramRunner(cpu);
@@ -1164,7 +1165,7 @@ describe('timer', () => {
// Listen to Port B's internal callback
const portB = new AVRIOPort(cpu, portBConfig);
- const gpioCallback = jest.spyOn(portB, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portB, 'timerOverridePin');
const nopCount = lines.filter((line) => line.bytes == nopOpCode).length;
const runner = new TestProgramRunner(cpu);
@@ -1192,7 +1193,7 @@ describe('timer', () => {
// Listen to Port B's internal callback
const portB = new AVRIOPort(cpu, portBConfig);
- const gpioCallback = jest.spyOn(portB, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portB, 'timerOverridePin');
cpu.writeData(TCCR1C, FOC1C);
@@ -1212,7 +1213,7 @@ describe('timer', () => {
// Listen to Port B's internal callback
const portB = new AVRIOPort(cpu, portBConfig);
- const gpioCallback = jest.spyOn(portB, 'timerOverridePin');
+ const gpioCallback = vi.spyOn(portB, 'timerOverridePin');
cpu.writeData(TCCR1C, FOC1C);