Add more test cases (#11)

This commit is contained in:
Patrick Stevens
2025-05-20 22:09:02 +01:00
committed by GitHub
parent bc389f1f23
commit 109b3a70fc
7 changed files with 223 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
namespace WoofWare.Pawprint.Test
open System
open System.Collections.Immutable
open System.IO
open FsUnitTyped
@@ -21,17 +22,23 @@ module TestHelloWorld =
let dotnetRuntimes =
DotnetRuntime.SelectForDll assy.Location |> ImmutableArray.CreateRange
use peImage = new MemoryStream (image)
try
use peImage = new MemoryStream (image)
let terminalState, terminatingThread =
Program.run loggerFactory peImage dotnetRuntimes []
let terminalState, terminatingThread =
Program.run loggerFactory peImage dotnetRuntimes []
let exitCode =
match terminalState.ThreadState.[terminatingThread].MethodState.EvaluationStack.Values with
| [] -> failwith "expected program to return 1, but it returned void"
| head :: _ ->
match head with
| EvalStackValue.Int32 i -> i
| _ -> failwith "TODO"
let exitCode =
match terminalState.ThreadState.[terminatingThread].MethodState.EvaluationStack.Values with
| [] -> failwith "expected program to return 1, but it returned void"
| head :: _ ->
match head with
| EvalStackValue.Int32 i -> i
| _ -> failwith "TODO"
exitCode |> shouldEqual 0
exitCode |> shouldEqual 0
with _ ->
for m in messages () do
Console.Error.WriteLine $"{m}"
reraise ()