|
- # E02-S03: run the name-table test in x128 and require its dump to equal the
- # host-computed build/names-test/expected.bin byte for byte.
- [CmdletBinding()]
- param([int]$Port = 6533, [int]$TimeoutSeconds = 180)
-
- $ErrorActionPreference = "Stop"
- $project = Split-Path $PSScriptRoot -Parent
- Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
- & (Join-Path $PSScriptRoot "build-names-test.ps1")
-
- $out = Join-Path $project "build\names-test"
- $disk = Join-Path $out "names-test.d81"
- $screenshot = Join-Path $out "names-test-vicii.png"
- $expected = [IO.File]::ReadAllBytes((Join-Path $out "expected.bin"))
-
- $session = Start-Nova128X128 -Autostart $disk -Drive8Image $disk -Port $Port -Screenshot $screenshot
- try {
- $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
- $dump = Read-Nova128Memory $session ($mb[8] + 256 * $mb[9]) ($mb[10] + 256 * $mb[11])
- } finally {
- Stop-Nova128X128 $session
- }
- [IO.File]::WriteAllBytes((Join-Path $out "names-dump.bin"), $dump)
-
- if ($mb[3] -ne 0xA5) { throw ("C128 reported FAIL (code `${0:X2})" -f $mb[4]) }
- $limit = [Math]::Min($dump.Length, $expected.Length)
- $first = 0
- while ($first -lt $limit -and $dump[$first] -eq $expected[$first]) { $first++ }
- if ($first -lt $limit -or $dump.Length -ne $expected.Length) {
- $from = [Math]::Max(0, $first - 8)
- $show = { param($b) ($b[$from..([Math]::Min($b.Length - 1, $first + 8))] | ForEach-Object { $_.ToString("X2") }) -join ' ' }
- throw ("dump differs at byte {0} (C128 {1} bytes, expected {2}):`n expected {3}`n C128 {4}" -f
- $first, $dump.Length, $expected.Length, (& $show $expected), (& $show $dump))
- }
- $summary = Get-Content -Raw (Join-Path $out "expected-summary.json") | ConvertFrom-Json
- foreach ($s in $summary) {
- Write-Host (" {0,-11} {1,3} names, {2} table-full errors" -f $s.Fixture, $s.Names, $s.FullErrors)
- }
- Write-Host ("verified name table: {0}-byte dump matches the host model exactly, guards intact" -f $dump.Length)
- Write-Host "screenshot: $screenshot"
|