Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

43 lines
2.1KB

  1. # E04-S04: run the control-flow fixture and check sizing, branch forms, and
  2. # the executed if/else/while/for/call/return results.
  3. [CmdletBinding()]
  4. param(
  5. [int]$Port = 6530,
  6. [int]$TimeoutSeconds = 90
  7. )
  8. $ErrorActionPreference = "Stop"
  9. $project = Split-Path $PSScriptRoot -Parent
  10. Import-Module (Join-Path $PSScriptRoot "lib\Nova128Test.psm1") -Force
  11. & (Join-Path $PSScriptRoot "build-control-test.ps1")
  12. $out = Join-Path $project "build\control-test"
  13. $prg = Join-Path $out "control-test.prg"
  14. $session = Start-Nova128X128 -Autostart $prg -Port $Port `
  15. -Screenshot (Join-Path $out "control-test-vicii.png")
  16. try {
  17. $mb = Wait-Nova128Mailbox $session -TimeoutSeconds $TimeoutSeconds
  18. } finally {
  19. Stop-Nova128X128 $session
  20. }
  21. Write-Host ('mailbox: ' + (($mb | ForEach-Object { $_.ToString('X2') }) -join ' '))
  22. Write-Host (("results: return={0} a={1} path={2} i={3} long={4:X2} bad={5} mismatches={6} forms={7:X2}" -f `
  23. $mb[8], $mb[9], $mb[10], $mb[11], $mb[12], $mb[13], $mb[14], $mb[15]))
  24. $failures = @()
  25. if ($mb[2] -ne 0x03) { $failures += "producer $($mb[2]) is not a generated program" }
  26. if ($mb[3] -ne 0xA5) { $failures += "fixture status is not PASS" }
  27. if ($mb[4] -ne 0 -or $mb[5] -ne 0) { $failures += "code is $($mb[4] + 256 * $mb[5])" }
  28. if ($mb[8] -ne 17) { $failures += "program result is $($mb[8]), expected 17" }
  29. if ($mb[9] -ne 5) { $failures += "while/a is $($mb[9]), expected 5" }
  30. if ($mb[10] -ne 10) { $failures += "if/else path is $($mb[10]), expected 10" }
  31. if ($mb[11] -ne 4) { $failures += "for/i is $($mb[11]), expected 4" }
  32. if ($mb[12] -ne 0x5A) { $failures += ('long branch result is {0:X2}, expected 5A' -f $mb[12]) }
  33. if ($mb[13] -ne 0) { $failures += "long branch ran the wrong path" }
  34. if ($mb[14] -ne 0) { $failures += "$($mb[14]) sizing label/length mismatches" }
  35. if ($mb[15] -ne 3) { $failures += ('branch forms are {0:X2}, expected 03 (short and long verified)' -f $mb[15]) }
  36. if ($failures) { throw ("control verification failed:`n " + ($failures -join "`n ")) }
  37. Write-Host "verified sizing pass, short/long branches, if/else, while, for, call, and return"

Powered by TurnKey Linux.