2024-07-30 11:01:26 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace SimAVRPHP\Tests;
|
|
|
|
|
|
|
|
use SimAVRPHP\AVR;
|
|
|
|
|
|
|
|
use Psr\Log\NullLogger;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
2024-08-01 06:20:42 +00:00
|
|
|
use PHPUnit\Framework\Attributes\UsesClass;
|
2024-07-30 11:01:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
#[CoversClass(AVR::class)]
|
2024-08-01 06:20:42 +00:00
|
|
|
|
|
|
|
#[UsesClass(\SimAVRPHP\Opcode\Instruction::class)]
|
|
|
|
#[UsesClass(\SimAVRPHP\Opcode\NOP::class)]
|
|
|
|
#[UsesClass(\SimAVRPHP\ProgramCounter::class)]
|
|
|
|
#[UsesClass(\SimAVRPHP\Registers::class)]
|
2024-07-30 11:01:26 +00:00
|
|
|
class AVRTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testStepNOP(): void
|
|
|
|
{
|
|
|
|
$avr = new AVR(new NullLogger);
|
|
|
|
$avr->setMemory("\00\00\00\00");
|
2024-08-01 06:20:42 +00:00
|
|
|
$this->assertEquals(0, $avr->pc->get());
|
2024-07-30 11:01:26 +00:00
|
|
|
$avr->step();
|
2024-08-01 06:20:42 +00:00
|
|
|
$this->assertEquals(2, $avr->pc->get());
|
2024-07-30 11:01:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-08-01 06:20:42 +00:00
|
|
|
Risky test fixed.
|