mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-11 00:38:40 +00:00
Assert contents of local variables in tests (#26)
This commit is contained in:
@@ -19,11 +19,13 @@ module TestCases =
|
||||
FileName = "Threads.cs"
|
||||
ExpectedReturnCode = 3
|
||||
NativeImpls = MockEnv.make ()
|
||||
LocalVariablesOfMain = []
|
||||
}
|
||||
{
|
||||
FileName = "BasicException.cs"
|
||||
ExpectedReturnCode = 10
|
||||
NativeImpls = MockEnv.make ()
|
||||
LocalVariablesOfMain = []
|
||||
}
|
||||
{
|
||||
FileName = "BasicLock.cs"
|
||||
@@ -34,11 +36,13 @@ module TestCases =
|
||||
{ mock with
|
||||
System_Threading_Monitor = System_Threading_Monitor.passThru
|
||||
}
|
||||
LocalVariablesOfMain = []
|
||||
}
|
||||
{
|
||||
FileName = "WriteLine.cs"
|
||||
ExpectedReturnCode = 1
|
||||
NativeImpls = MockEnv.make ()
|
||||
LocalVariablesOfMain = []
|
||||
}
|
||||
]
|
||||
|
||||
@@ -48,11 +52,23 @@ module TestCases =
|
||||
FileName = "NoOp.cs"
|
||||
ExpectedReturnCode = 1
|
||||
NativeImpls = MockEnv.make ()
|
||||
LocalVariablesOfMain = [ CliType.Numeric (CliNumericType.Int32 1) ]
|
||||
}
|
||||
{
|
||||
FileName = "TriangleNumber.cs"
|
||||
ExpectedReturnCode = 10
|
||||
NativeImpls = MockEnv.make ()
|
||||
LocalVariablesOfMain =
|
||||
[
|
||||
// answer
|
||||
CliType.Numeric (CliNumericType.Int32 10)
|
||||
// i
|
||||
CliType.Numeric (CliNumericType.Int32 5)
|
||||
// End-loop condition
|
||||
CliType.OfBool false
|
||||
// Ret
|
||||
CliType.Numeric (CliNumericType.Int32 10)
|
||||
]
|
||||
}
|
||||
{
|
||||
FileName = "InstaQuit.cs"
|
||||
@@ -75,6 +91,7 @@ module TestCases =
|
||||
ExecutionResult.Terminated (state, thread)
|
||||
}
|
||||
}
|
||||
LocalVariablesOfMain = []
|
||||
}
|
||||
]
|
||||
|
||||
@@ -103,6 +120,12 @@ module TestCases =
|
||||
|
||||
exitCode |> shouldEqual case.ExpectedReturnCode
|
||||
|
||||
let finalVariables =
|
||||
terminalState.ThreadState.[terminatingThread].MethodState.LocalVariables
|
||||
|> Seq.toList
|
||||
|
||||
finalVariables |> shouldEqual case.LocalVariablesOfMain
|
||||
|
||||
with _ ->
|
||||
for message in messages () do
|
||||
System.Console.Error.WriteLine $"{message}"
|
||||
|
Reference in New Issue
Block a user