Skip to content

Commit 2d0617a

Browse files
MchKosticyndvvrd
authored andcommitted
[fix] hot fixes
- fixed test runner for one file - fixed test rendering for compact array representation
1 parent 025b60b commit 2d0617a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

VSharp.TestRunner/TestRunnerTool.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.IO;
45
using System.Linq;
56
using System.Reflection;
@@ -62,9 +63,9 @@ private static bool ReproduceTest(FileInfo fileInfo, SuitType suitType, bool che
6263
var debugAssertFailed = message != null && message.Contains("Debug.Assert failed");
6364
bool shouldInvoke = suitType switch
6465
{
65-
SuitType.TestsOnly => !test.IsError,
66-
SuitType.ErrorsOnly => test.IsError,
67-
SuitType.TestsAndErrors => !debugAssertFailed,
66+
SuitType.TestsOnly => !test.IsError || fileMode,
67+
SuitType.ErrorsOnly => test.IsError || fileMode,
68+
SuitType.TestsAndErrors => !debugAssertFailed || fileMode,
6869
_ => false
6970
};
7071
if (shouldInvoke)
@@ -79,6 +80,7 @@ private static bool ReproduceTest(FileInfo fileInfo, SuitType suitType, bool che
7980
}
8081
if (checkResult && !test.IsError && !CompareObjects(test.Expected, result))
8182
{
83+
Debug.Assert(shouldInvoke);
8284
// TODO: use NUnit?
8385
Console.ForegroundColor = ConsoleColor.Red;
8486
Console.Error.WriteLine("Test {0} failed! Expected {1}, but got {2}", fileInfo.Name,
@@ -124,7 +126,7 @@ private static bool ReproduceTest(FileInfo fileInfo, SuitType suitType, bool che
124126
public static bool ReproduceTest(FileInfo file, bool checkResult)
125127
{
126128
AppDomain.CurrentDomain.AssemblyResolve += TryLoadAssemblyFrom;
127-
return ReproduceTest(file, SuitType.TestsAndErrors, checkResult);
129+
return ReproduceTest(file, SuitType.TestsAndErrors, checkResult, true);
128130
}
129131

130132
public static bool ReproduceTests(DirectoryInfo testsDir, SuitType suitType = SuitType.TestsAndErrors)

VSharp.Utils/MemoryGraph.fs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ and MemoryGraph(repr : memoryRepr, mocker : ITypeMockSerializer, createCompactRe
168168
arr.SetValue(value, indices))
169169
arr :> obj
170170
| _ when createCompactRepr ->
171-
{array = arr; defaultValue = repr.defaultValue; indices = repr.indices; values = repr.values}
171+
let values = Array.map decodeValue repr.values
172+
let defaultValue = decodeValue repr.defaultValue
173+
Array.fill arr defaultValue
174+
Array.iter2 (fun (i : int[]) v -> arr.SetValue(decodeValue v, i)) repr.indices repr.values
175+
{array = arr; defaultValue = repr.defaultValue; indices = repr.indices; values = values}
172176
| _ ->
173177
let defaultValue = decodeValue repr.defaultValue
174178
Array.fill arr defaultValue

0 commit comments

Comments
 (0)