diff --git a/VSharp.API/VSharp.cs b/VSharp.API/VSharp.cs index 1f6aeea35..1d7d8d69e 100644 --- a/VSharp.API/VSharp.cs +++ b/VSharp.API/VSharp.cs @@ -81,9 +81,9 @@ public void GenerateReport(TextWriter writer) { writer.WriteLine("Total time: {0:00}:{1:00}:{2:00}.{3}.", TestGenerationTime.Hours, TestGenerationTime.Minutes, TestGenerationTime.Seconds, TestGenerationTime.Milliseconds); - writer.WriteLine("Approximate coverage: {0}", GeneratedTestInfos.LastOrDefault().Coverage); + writer.WriteLine($"Approximate coverage: {GeneratedTestInfos.LastOrDefault().Coverage}"); if (Coverage >= 0) - writer.WriteLine("Precise coverage: {0}", Coverage); + writer.WriteLine($"Precise coverage: {Coverage}"); var count = IncompleteBranches.Count(); if (count > 0) { diff --git a/VSharp.Explorer/Statistics.fs b/VSharp.Explorer/Statistics.fs index f2fc87709..034052ebc 100644 --- a/VSharp.Explorer/Statistics.fs +++ b/VSharp.Explorer/Statistics.fs @@ -163,6 +163,7 @@ type public SVMStatistics(entryMethods : Method seq, generalizeGenericsCoverage Logger.traceWithTag Logger.stateTraceTag $"{stepsCount} FORWARD: {s.internalId}" let setCoveredIfNeeded (loc : codeLocation) = + // 'Call' instructions are considered covered only after return, because 'call' can throw exception if s.StackSize <= stackSize && loc.offset = loc.BasicBlock.FinalOffset then s.AddLocationToHistory loc @@ -202,10 +203,6 @@ type public SVMStatistics(entryMethods : Method seq, generalizeGenericsCoverage if currentMethod.InCoverageZone && not isCovered then visitedBlocksNotCoveredByTests.TryAdd(s, Set.empty) |> ignore Interlocked.Exchange(ref isVisitedBlocksNotCoveredByTestsRelevant, 0) |> ignore - (* - Call instructions are considered covered only after return - (because call can throw exception) - *) setCoveredIfNeeded currentLoc | Some currentLoc -> setCoveredIfNeeded currentLoc | None -> () diff --git a/VSharp.IL/MethodBody.fs b/VSharp.IL/MethodBody.fs index d40ff4611..7286bb7c8 100644 --- a/VSharp.IL/MethodBody.fs +++ b/VSharp.IL/MethodBody.fs @@ -101,8 +101,8 @@ type MethodWithBody internal (m : MethodBase) = | None -> None) let instructions = lazy( - match rawBody.Value with - | Some rawBody -> ILRewriter.instructionsOfMethod rawBody actualMethod + match methodBody.Value with + | Some methodBody -> ILRewriter.instructionsOfMethod methodBody actualMethod | None -> internalfailf $"Getting instructions of method {m} without body (extern or abstract)") let invocationFlags = lazy ( diff --git a/VSharp.Test/IntegrationTests.cs b/VSharp.Test/IntegrationTests.cs index f3004b894..f60c291c5 100644 --- a/VSharp.Test/IntegrationTests.cs +++ b/VSharp.Test/IntegrationTests.cs @@ -505,7 +505,7 @@ private TestResult Explore(TestExecutionContext context) else { context.CurrentResult.SetResult( - _expectedCoverage is not null + _expectedCoverage > 0 ? ResultState.Failure : ResultState.Success );