[CmdletBinding()] param( [string]$ZipPath = (Join-Path $PSScriptRoot '..\downloads\dbyte-v12.0.0-windows-x64.zip') ) $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest $ExpectedSize = 3196504 $ExpectedZipSha256 = '83f9de1e1116ebfe0fc0a4b24338909ffab39142d4171b0b9364a51727d5e4d2' $ExpectedHelloSha256 = '5ddb354b4ffd4b8b7bca73a4819207a047eb2b9121d76f1859f7ccc7b4d31132' $ExpectedHelloOutput = 'Hello, DByte!' function Require([bool]$Condition, [string]$Message) { if (-not $Condition) { throw $Message } } function Run-Exact([string]$Exe, [string[]]$Args, [string]$Expected, [string]$Label) { $out = & $Exe @Args 2>&1 $code = $LASTEXITCODE $text = (($out -join "`n").Replace("`r",'')).Trim() Require ($code -eq 0) "$Label exit=$code output=$text" Require ($text -eq $Expected) "$Label output mismatch expected='$Expected' actual='$text'" } $ZipPath = [IO.Path]::GetFullPath($ZipPath) Require (Test-Path -LiteralPath $ZipPath) "ZIP not found: $ZipPath" Require ((Get-Item -LiteralPath $ZipPath).Length -eq $ExpectedSize) 'Release ZIP byte-size mismatch' $zipHash = (Get-FileHash -Algorithm SHA256 -LiteralPath $ZipPath).Hash.ToLowerInvariant() Require ($zipHash -eq $ExpectedZipSha256) "Release ZIP SHA256 mismatch: $zipHash" $temp = Join-Path ([IO.Path]::GetTempPath()) ('dbyte-v12-proof-' + [Guid]::NewGuid().ToString('N')) New-Item -ItemType Directory -Path $temp | Out-Null try { Expand-Archive -LiteralPath $ZipPath -DestinationPath $temp $dbyte = Join-Path $temp 'dbyte.exe' $dbytec = Join-Path $temp 'dbytec.exe' $hello = Join-Path $temp 'examples\hello.dby' Require (Test-Path -LiteralPath $dbyte) 'dbyte.exe missing from release' Require (Test-Path -LiteralPath $dbytec) 'dbytec.exe missing from release' Require (Test-Path -LiteralPath $hello) 'examples/hello.dby missing from release' $helloHash = (Get-FileHash -Algorithm SHA256 -LiteralPath $hello).Hash.ToLowerInvariant() Require ($helloHash -eq $ExpectedHelloSha256) "hello.dby SHA256 mismatch: $helloHash" $source = ([IO.File]::ReadAllText($hello).Replace("`r`n","`n")).TrimEnd("`n") Require ($source -eq 'print("Hello, DByte!")') 'hello.dby source content mismatch' $version = (& $dbyte --version 2>&1 | Out-String).Trim() Require ($LASTEXITCODE -eq 0) "dbyte --version failed: $version" Require ($version -match '12\.0\.0') "Unexpected compiler version: $version" Push-Location $temp try { Run-Exact $dbyte @('run','examples\hello.dby') $ExpectedHelloOutput 'tree hello' Run-Exact $dbyte @('run','--vm','examples\hello.dby') $ExpectedHelloOutput 'VM hello' } finally { Pop-Location } Write-Output 'DBYTE V12 RELEASE PROOF: PASS' Write-Output "ZIP SHA256: $zipHash" Write-Output "HELLO SHA256: $helloHash" Write-Output "VERSION: $version" Write-Output 'TREE OUTPUT: Hello, DByte!' Write-Output 'VM OUTPUT: Hello, DByte!' } finally { Remove-Item -LiteralPath $temp -Recurse -Force -ErrorAction SilentlyContinue }