diff --git a/AltCover.Async/AltCover.Async.csproj b/AltCover.Async/AltCover.Async.csproj
deleted file mode 100644
index 5dcd7b23e..000000000
--- a/AltCover.Async/AltCover.Async.csproj
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
- AltCover.Async
- False
- net46
- false
- false
- false
-
-
- 11.0
- True
-
-
-
-
-
- TRACE;DEBUG;CODE_ANALYSIS
- CS1591
-
-
- TRACE
- CS1591
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AltCover.Async/AltCover.Async.fsproj b/AltCover.Async/AltCover.Async.fsproj
new file mode 100644
index 000000000..0d8e7e6e7
--- /dev/null
+++ b/AltCover.Async/AltCover.Async.fsproj
@@ -0,0 +1,31 @@
+
+
+
+ net46
+ AltCover.Async
+ AltCover.Recorder
+ false
+ false
+ false
+ --keyfile:$(InfrastructureKey)
+
+
+
+ TRACE
+
+
+
+
+ TRACE;DEBUG;CODE_ANALYSIS
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AltCover.Async/Instance.cs b/AltCover.Async/Instance.cs
deleted file mode 100644
index 3177ac51d..000000000
--- a/AltCover.Async/Instance.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System.Collections.Generic;
-using System;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Runtime.Versioning;
-using System.Diagnostics.CodeAnalysis;
-
-[assembly: CLSCompliant(true)]
-[assembly: ComVisible(false)]
-
-namespace AltCover.Recorder;
-
-public static class Instance
-{
- //internal static IEnumerable Modules
- //{
- // get { return new string[] { "a", "b", "c", "d" }; }
- //}
-
- public static class I
- {
- internal static class CallTrack
- {
- [SuppressMessage("Microsoft.Performance",
- "CA1823:AvoidUnusedPrivateFields",
- Justification = "Template code only")]
- private static readonly TargetFrameworkAttribute attr =
- new TargetFrameworkAttribute(".NETFramework,Version=v4.6");
-
- private static readonly AsyncLocal> __value = new AsyncLocal>();
-
- private static AsyncLocal> Value
- {
- [SuppressMessage("Microsoft.Performance",
- "CA1811:AvoidUncalledPrivateCode",
- Justification = "Template code only")]
- get { return __value; }
- }
-
- // no race conditions here
- [SuppressMessage("Gendarme.Rules.Performance",
- "AvoidUncalledPrivateCodeRule",
- Justification = "Template code only")]
- [SuppressMessage("Microsoft.Performance",
- "CA1811:AvoidUncalledPrivateCode",
- Justification = "Template code only")]
- [SuppressMessage("Gendarme.Rules.Performance",
- "AvoidRepetitiveCallsToPropertiesRule",
- Justification = "Initialization")]
- private static Stack Instance()
- {
- if (Value.Value == null)
- Value.Value = new Stack();
-
- return Value.Value;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/AltCover.Base/AltCover.Base.csproj b/AltCover.Base/AltCover.Base.csproj
deleted file mode 100644
index 273f0def2..000000000
--- a/AltCover.Base/AltCover.Base.csproj
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
- netstandard2.0
- AltCover
- AltCover.Base
- RUNNER;LITEVERSION
-
-
-
- TRACE;DEBUG;CODE_ANALYSIS;$(GlobalDefineConstants)
-
-
- TRACE;$(GlobalDefineConstants)
-
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
-
- ..\ThirdParty\cecil\Mono.Cecil.dll
-
-
- ..\ThirdParty\cecil\Mono.Cecil.Rocks.dll
-
-
- ..\ThirdParty\cecil\Mono.Cecil.Mdb.dll
-
-
- ..\ThirdParty\cecil\Mono.Cecil.Pdb.dll
-
-
-
-
-
-
- ..\ThirdParty\Manatee.Json.dll
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AltCover.Base/AssemblyInfo.cs b/AltCover.Base/AssemblyInfo.cs
deleted file mode 100644
index e2e03c6fd..000000000
--- a/AltCover.Base/AssemblyInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: InternalsVisibleTo("AltCover.Engine, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
-[assembly: InternalsVisibleTo("AltCover.PowerShell, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
-[assembly: InternalsVisibleTo("AltCover.Toolkit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
-[assembly: InternalsVisibleTo("AltCover, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
-#if DEBUG
-// Self-test signing key
-[assembly: InternalsVisibleTo("AltCover.Engine, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
-[assembly: InternalsVisibleTo("AltCover.PowerShell, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
-[assembly: InternalsVisibleTo("AltCover.Toolkit, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
-[assembly: InternalsVisibleTo("AltCover, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
-#endif
-[assembly: CLSCompliant(true)]
-[assembly: ComVisible(false)]
-[assembly: System.Resources.NeutralResourcesLanguage("en-GB")]
\ No newline at end of file
diff --git a/AltCover.DataCollector/DataCollector.cs b/AltCover.DataCollector/DataCollector.cs
index 09bfa0e6e..3e38efd5c 100644
--- a/AltCover.DataCollector/DataCollector.cs
+++ b/AltCover.DataCollector/DataCollector.cs
@@ -67,7 +67,7 @@ private void Supervise()
RecorderInstance.ToList().ForEach(
i =>
{
- var supervision = i.GetField("supervision",
+ var supervision = i.GetProperty("supervision",
BindingFlags.Static | BindingFlags.NonPublic);
if (supervision == null)
{
diff --git a/AltCover.Engine/AltCover.Engine.fsproj b/AltCover.Engine/AltCover.Engine.fsproj
index 978b48a99..cd9da9389 100644
--- a/AltCover.Engine/AltCover.Engine.fsproj
+++ b/AltCover.Engine/AltCover.Engine.fsproj
@@ -12,6 +12,7 @@
TRACE;$(GlobalDefineConstants)
+
@@ -25,7 +26,7 @@
-
+
@@ -66,10 +67,10 @@
Recorder.snk
-
+
AltCover.Recorder.net20.dll
-
+
AltCover.Async.net46.dll
@@ -120,10 +121,6 @@
-
-
-
-
diff --git a/AltCover.Engine/Instrument.fs b/AltCover.Engine/Instrument.fs
index c21713196..17685ed7b 100644
--- a/AltCover.Engine/Instrument.fs
+++ b/AltCover.Engine/Instrument.fs
@@ -1209,7 +1209,7 @@ module internal Instrument =
let value =
calltrack.Properties
- |> Seq.find (fun m -> m.Name == "Value")
+ |> Seq.find (fun m -> m.Name == "value")
let getValue = value.GetMethod
@@ -1222,7 +1222,7 @@ module internal Instrument =
GetValue = getValue
Instance =
calltrack.Methods
- |> Seq.find (fun m -> m.Name == "Instance")
+ |> Seq.find (fun m -> m.Name == "instance")
Field = field
FieldType = field.FieldType :?> GenericInstanceType
Maker =
@@ -1336,7 +1336,7 @@ module internal Instrument =
let getterDef =
recorder.MainModule.GetTypes()
|> Seq.collect _.Methods
- |> Seq.filter (fun m -> m.Name == "get_Modules")
+ |> Seq.filter (fun m -> m.Name == "get_modules")
|> Seq.head
let body = getterDef.Body
@@ -1363,13 +1363,15 @@ module internal Instrument =
[ worker.Create(OpCodes.Dup)
worker.Create(OpCodes.Ldc_I4, i)
worker.Create(OpCodes.Ldstr, k)
- worker.Create(OpCodes.Stelem_Ref) ]
+ worker.Create(OpCodes.Stelem_Any, stringtype) ]
bulkInsertBefore worker head addElement true
|> ignore)
- let ret = [ worker.Create OpCodes.Ret ]
- bulkInsertBefore worker head ret true |> ignore
+ let store =
+ [ worker.Create(OpCodes.Stsfld, head.Operand :?> FieldReference) ]
+
+ bulkInsertBefore worker head store true |> ignore
let recorderFileName =
(extractName state.RecordingAssembly) + ".dll"
diff --git a/AltCover.Engine/PostProcess.fs b/AltCover.Engine/PostProcess.fs
index f6d02eeca..3d9d4c6a5 100644
--- a/AltCover.Engine/PostProcess.fs
+++ b/AltCover.Engine/PostProcess.fs
@@ -181,7 +181,7 @@ module internal PostProcess =
|> Seq.head
let vc =
- (lookUpVisitsByToken token dict).Total
+ (lookUpVisitsByToken token dict).Total()
mp
|> Seq.iter (fun m ->
@@ -226,7 +226,7 @@ module internal PostProcess =
tracks.[index].Tracks
|> Seq.map (fun t ->
match t with
- | :? Time as tx -> sprintf "%d" tx.Value
+ | Time tx -> sprintf "%d" tx
| _ -> String.Empty) // never happens
|> Seq.filter (fun s -> s.Length > 0)
diff --git a/AltCover.Engine/Runner.fs b/AltCover.Engine/Runner.fs
index 1d5dc1ce4..4632c595f 100644
--- a/AltCover.Engine/Runner.fs
+++ b/AltCover.Engine/Runner.fs
@@ -1026,12 +1026,12 @@ module internal Runner =
id,
strike,
match enum tag with
- | Tag.Time -> (Time <| formatter.ReadInt64()) :> Track
- | Tag.Call -> (Call <| formatter.ReadInt32()) :> Track
+ | Tag.Time -> Time <| formatter.ReadInt64()
+ | Tag.Call -> Call <| formatter.ReadInt32()
| Tag.Both ->
let time = formatter.ReadInt64()
let call = formatter.ReadInt32()
- Both(Pair.Create(time, call))
+ Both { Time = time; Call = call }
| Tag.Table ->
let t =
Dictionary>()
@@ -1057,7 +1057,7 @@ module internal Runner =
if p |> t.[m].ContainsKey |> not then
t.[m].Add(p, PointVisit.Create())
- let mutable pv = t.[m].[p]
+ let pv = t.[m].[p]
pv.Count <- pv.Count + n
// []
@@ -1075,7 +1075,7 @@ module internal Runner =
pv.Tracks.Add(
let time = formatter.ReadInt64()
let call = formatter.ReadInt32()
- Both(Pair.Create(time, call))
+ Both { Time = time; Call = call }
)
tracking ()
@@ -1090,7 +1090,7 @@ module internal Runner =
``module`` ()
Table t
- | _ -> Null()
+ | _ -> Null
)
with :? EndOfStreamException ->
None
@@ -1104,7 +1104,8 @@ module internal Runner =
key |> String.IsNullOrWhiteSpace |> not
|| ((String.IsNullOrEmpty key)
&& hitPointId = 0
- && visit.GetType() = typeof)
+ && visit.GetType().ToString()
+ == "AltCover.Track+Table")
then
if
hits.ContainsKey key |> not
@@ -1112,7 +1113,7 @@ module internal Runner =
then
hits.Add(key, Dictionary())
- Counter.AddVisit(hits, key, hitPointId, visit)
+ Counter.addVisit hits key hitPointId visit
else
0L
@@ -1189,11 +1190,11 @@ module internal Runner =
let internal extractTracks tracks =
tracks
- |> Seq.map (fun (t: Track) ->
+ |> Seq.map (fun t ->
match t with
- | :? Time as x -> (Some x.Value, None)
- | :? Both as b -> (Some b.Value.Time, Some b.Value.Call)
- | :? Call as y -> (None, Some y.Value)
+ | Time x -> (Some x, None)
+ | Both b -> (Some b.Time, Some b.Call)
+ | Call y -> (None, Some y)
| _ -> (None, None))
|> Seq.toList
|> List.unzip
@@ -1225,7 +1226,7 @@ module internal Runner =
entrypoint.Tracks
|> Seq.iter (fun t ->
match t with
- | :? Time as tx -> tx.Value |> NativeJson.fromTracking |> m.Entry.Add
+ | Time tx -> tx |> NativeJson.fromTracking |> m.Entry.Add
| _ -> ())
let e3, exits = hits.TryGetValue Track.Exit
@@ -1238,7 +1239,7 @@ module internal Runner =
exitpoint.Tracks
|> Seq.iter (fun t ->
match t with
- | :? Time as tx -> tx.Value |> NativeJson.fromTracking |> m.Exit.Add
+ | Time tx -> tx |> NativeJson.fromTracking |> m.Exit.Add
| _ -> ())
let fillTracks tracks calls =
@@ -1278,7 +1279,7 @@ module internal Runner =
let calls = calls' |> Seq.choose id
{ sp with
- VC = (int <| count.Total) + Math.Max(0, sp.VC)
+ VC = (int <| count.Total()) + Math.Max(0, sp.VC)
Tracks = fillTracks sp.Tracks calls
Times = fillTimes sp.Times times }
else
@@ -1302,7 +1303,7 @@ module internal Runner =
let calls = calls' |> Seq.choose id
{ bp with
- Hits = (int <| count.Total) + Math.Max(0, bp.Hits)
+ Hits = (int <| count.Total()) + Math.Max(0, bp.Hits)
Tracks = fillTracks bp.Tracks calls
Times = fillTimes bp.Times times }
else
@@ -1391,15 +1392,14 @@ module internal Runner =
| _ -> new MemoryStream() :> Stream
let result =
- AltCover.Counter.DoFlushStream(
- (postProcess hits format),
- pointProcess,
- true,
- hits,
- format,
- file,
+ AltCover.Counter.doFlushStream
+ (postProcess hits format)
+ pointProcess
+ true
+ hits
+ format
+ file
outputFile
- )
match arg with
| None -> ()
diff --git a/AltCover.Monitor/Monitor.cs b/AltCover.Monitor/Monitor.cs
index bbf4bc0e9..47a815638 100644
--- a/AltCover.Monitor/Monitor.cs
+++ b/AltCover.Monitor/Monitor.cs
@@ -222,16 +222,16 @@ public static bool TryGetVisitTotals(out PointCount totals)
var found = false;
foreach (var t in counter)
{
- var temp = (Int64)t.GetField("branchVisits",
+ var temp = (Int64)t.GetProperty("branchVisits",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Public |
- System.Reflection.BindingFlags.Static).GetValue(null);
+ System.Reflection.BindingFlags.Static).GetValue(null, Type.EmptyTypes);
totals.Branch = (int)temp;
- temp = (Int64)t.GetField("totalVisits",
+ temp = (Int64)t.GetProperty("totalVisits",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Public |
- System.Reflection.BindingFlags.Static).GetValue(null);
+ System.Reflection.BindingFlags.Static).GetValue(null, Type.EmptyTypes);
totals.Code = (int)temp - totals.Branch;
found = true;
diff --git a/AltCover.Recorder.Tests/Adapter.fs b/AltCover.Recorder.Tests/Adapter.fs
new file mode 100644
index 000000000..eb3e7a9c1
--- /dev/null
+++ b/AltCover.Recorder.Tests/Adapter.fs
@@ -0,0 +1,197 @@
+namespace AltCover.Recorder
+
+open System.Collections.Generic
+
+#if DEBUG
+[]
+module Adapter =
+ let DoPause () = Instance.I.doPause
+ let DoResume () = Instance.I.doResume
+ let DoUnload () = Instance.I.doUnload
+ let DoExit () = Instance.I.doExit
+
+ let VisitsClear () =
+ Instance.I.clear ()
+ Counter.branchVisits <- 0L
+ Counter.totalVisits <- 0L
+
+ let SamplesClear () =
+ Instance.I.samples <- Instance.I.makeSamples ()
+
+ let private reset () =
+ Instance.I.isRunner <- false
+ VisitsClear()
+ SamplesClear()
+
+ let ModuleReset (m: string array) =
+ Instance.modules <- m
+ reset ()
+
+ let HardReset () =
+ Instance.modules <- [| System.String.Empty |]
+ reset ()
+
+ let internal prepareName name =
+ if name |> Instance.I.visits.ContainsKey |> not then
+ let entry = Dictionary()
+ Instance.I.visits.Add(name, entry)
+
+ let internal init (n, l) =
+ let tmp =
+ { PointVisit.Create() with Count = n }
+
+ tmp.Tracks.AddRange l
+ tmp
+
+ let VisitsAdd (name, line, number) =
+ prepareName name
+ let v = init (number, [])
+ Instance.I.visits.[name].Add(line, v)
+
+ let VisitsAddTrack (name, line, number) =
+ prepareName name
+ let v1 = init (number, [ Call 17; Call 42 ])
+ Instance.I.visits.[name].Add(line, v1)
+
+ let v2 =
+ init (
+ (number + 1L),
+ [ Time 17L
+ Both { Time = 42L; Call = 23 } ]
+ )
+
+ Instance.I.visits.[name].Add(line + 1, v2)
+
+ let VisitsSeq () = Instance.I.visits |> Seq.cast
+
+ let VisitsEntrySeq key =
+ Instance.I.visits.[key] |> Seq.cast
+
+ let VisitCount (key, key2) = (Instance.I.visits.[key].[key2]).Count
+ let Lock = Instance.I.visits :> obj
+
+ let VisitImplNone (moduleId, hitPointId) =
+ Instance.I.visitImpl moduleId hitPointId Track.Null
+
+ let VisitImplMethod (moduleId, hitPointId, mId) =
+ Instance.I.visitImpl moduleId hitPointId (Call mId)
+ //let internal VisitImpl (a, b, c) =
+ // Instance.I.visitImpl a b c
+
+ let internal addSample (moduleId, hitPointId, context) =
+ Instance.I.takeSample Sampling.Single moduleId hitPointId context
+
+ let internal addSampleUnconditional (moduleId, hitPointId, context) =
+ Instance.I.takeSample Sampling.All moduleId hitPointId context
+
+ let internal newBoth (time, call) = Both { Time = time; Call = call }
+
+ let internal asCall track = Call track
+ let internal time at = Time at
+
+ let internal untime at =
+ let r = List()
+
+ match at with
+ | Time t -> r.Add(t)
+ | _ -> ()
+
+ r
+
+ let internal asNull () = Null
+ let internal table t = Table t
+
+ let internal untable t =
+ let r = List()
+
+ match t with
+ | (n, p, Table d) ->
+ r.Add(n)
+ r.Add(p)
+ r.Add(d)
+ | _ -> ()
+
+ r
+
+ let internal doFlush (visits, format, report, output) =
+ let output' =
+ if System.String.IsNullOrEmpty output then
+ None
+ else
+ Some output
+
+ Counter.doFlushFile ignore (fun _ _ -> ()) true visits format report output'
+
+ let internal updateReport (counts, format, coverageFile, outputFile) =
+ Counter.I.updateReport
+ ignore
+ (fun _ _ -> ())
+ true
+ counts
+ format
+ coverageFile
+ outputFile
+
+ let internal payloadSelector x = Instance.I.payloadSelector (fun _ -> x)
+
+ let internal payloadControl (x, y) =
+ Instance.I.payloadControl (fun _ -> x) (fun _ -> y)
+
+ let internal payloadSelection (x, y, z) =
+ Instance.I.payloadSelection (fun _ -> x) (fun _ -> y) (fun _ -> z)
+
+ let internal makeNullTrace name =
+ { Tracer = name
+ Stream = null
+ Formatter = null
+ Runner = false
+ Definitive = false }
+
+ let internal makeStreamTrace s1 =
+ { Tracer = null
+ Stream = new System.IO.MemoryStream()
+ Formatter = new System.IO.BinaryWriter(s1)
+ Runner = true
+ Definitive = false }
+
+ let internal invokeIssue71Wrapper<'T when 'T :> System.Exception>
+ ((unique: string), (called: bool array))
+ =
+ let constructor =
+ typeof<'T>
+ .GetConstructor([| typeof |])
+
+ let pitcher =
+ fun _ _ _ _ ->
+ constructor.Invoke([| unique |]) :?> System.Exception
+ |> raise
+
+ let catcher =
+ fun _ _ _ (x: System.Exception) ->
+ called.[0] <- true
+
+ called.[1] <-
+ match x with
+ | :? System.ArgumentNullException as ane -> ane.ParamName = unique
+ | _ -> x.Message = unique
+
+ Instance.I.issue71Wrapper () () () () catcher pitcher
+
+ let internal invokeCurriedIssue71Wrapper<'T when 'T :> System.Exception>
+ (unique: string)
+ =
+ let constructor =
+ typeof<'T>
+ .GetConstructor([| typeof |])
+
+ let pitcher =
+ fun _ _ _ _ ->
+ constructor.Invoke([| unique |]) :?> System.Exception
+ |> raise
+
+ Instance.I.curriedIssue71Wrapper "a" "b" "c" "d" pitcher
+
+ let internal tracePush (a, b, c) = Instance.I.trace.Push a b c
+//let LogException (a, b, c, d) = Instance.I.logException a b c d
+//let FindIndexFromUspid (a,b) = Counter.I.findIndexFromUspid a b
+#endif
\ No newline at end of file
diff --git a/AltCover.Recorder.Tests/AltCover.Recorder.Tests.fsproj b/AltCover.Recorder.Tests/AltCover.Recorder.Tests.fsproj
index 3a8a34a7d..fa936df94 100644
--- a/AltCover.Recorder.Tests/AltCover.Recorder.Tests.fsproj
+++ b/AltCover.Recorder.Tests/AltCover.Recorder.Tests.fsproj
@@ -1,7 +1,7 @@
- net8.0;net472
+ net8.0;net472;net20
false
AltCover.Recorder.Tests
false
@@ -23,11 +23,10 @@
AssemblyVersion.fs
-
+
-
@@ -58,13 +57,19 @@
-
+
-
+
+
contentfiles
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AltCover.Recorder.Tests/Base.Tests.fs b/AltCover.Recorder.Tests/Base.Tests.fs
deleted file mode 100644
index f33032591..000000000
--- a/AltCover.Recorder.Tests/Base.Tests.fs
+++ /dev/null
@@ -1,102 +0,0 @@
-#if RUNNER_TESTS
-namespace Tests
-#else
-#if !NET472
-#if NET20
-namespace Tests.Recorder.Clr2
-#else
-namespace Tests.Recorder.Core
-#endif
-#else
-namespace Tests.Recorder.Clr4
-#endif
-#endif
-
-open System
-
-#if RUNNER_TESTS
-open AltCover
-#else
-open AltCover.Recorder
-open NUnit.Framework
-#endif
-
-module BaseTests =
- []
- let ExerciseBoth () =
- let b = Both(Pair.Create(0L, 0))
- let b1 = Both(Pair.Create(0L, 0))
- let b2 = Both(Pair.Create(1L, 2))
- Assert.That(b1.Equals(b))
- Assert.That(not <| b2.Equals(b))
- Assert.That(not <| b2.Equals(String.Empty))
- Assert.That(not <| b2.Value.Equals(String.Empty))
- Assert.That(b.GetHashCode(), Is.EqualTo <| b1.GetHashCode())
- Assert.That(b.ToString(), Is.EqualTo("AltCover.Both : AltCover.Pair(Time=0, Call=0)"))
-
- []
- let ExerciseCall () =
- let b = Call(0)
- let b1 = Call(0)
- let b2 = Call(2)
- Assert.That(b1.Equals(b))
- Assert.That(not <| b2.Equals(b))
- Assert.That(not <| b2.Equals(String.Empty))
- Assert.That(b.GetHashCode(), Is.EqualTo <| b1.GetHashCode())
- Assert.That(b.ToString(), Is.EqualTo("AltCover.Call : 0"))
-
- []
- let ExerciseTime () =
- let b = Time(0l)
- let b1 = Time(0l)
- let b2 = Time(2l)
- Assert.That(b1.Equals(b))
- Assert.That(not <| b2.Equals(b))
- Assert.That(not <| b2.Equals(String.Empty))
- Assert.That(b.GetHashCode(), Is.EqualTo <| b1.GetHashCode())
- Assert.That(b.ToString(), Is.EqualTo("AltCover.Time : 0"))
-
- []
- let ExerciseNull () =
- let b = Null()
- let b1 = Null()
- Assert.That(b1.Equals(b))
- Assert.That(not <| b.Equals(String.Empty))
- Assert.That(b.GetHashCode(), Is.EqualTo <| b1.GetHashCode())
- Assert.That(b.ToString(), Is.EqualTo("AltCover.Null"))
-
- []
- let ExercisePointVisit () =
- let p = PointVisit.Create()
- let p1 = PointVisit.Create()
- Assert.That(p1.Equals(p))
- Assert.That(not <| p.Equals(String.Empty))
- Assert.That(p.GetHashCode(), Is.EqualTo <| p1.GetHashCode())
- Assert.That(p.ToString(), Is.EqualTo("AltCover.PointVisit : Count = 0 Tracks = ''"))
- p.Track(Null())
- p1.Track(Null())
- Assert.That(p1.Equals(p))
- Assert.That(p.GetHashCode(), Is.EqualTo <| p1.GetHashCode())
-
- Assert.That(
- p.ToString(),
- Is.EqualTo("AltCover.PointVisit : Count = 0 Tracks = 'AltCover.Null'")
- )
-
- p.Step()
- Assert.That(p1.Equals(p) |> not)
- p1.Step()
- Assert.That(p1.Equals(p))
- Assert.That(p.GetHashCode(), Is.EqualTo <| p1.GetHashCode())
- p.Track(Both(Pair.Create(1L, 2)))
- Assert.That(p1.Equals(p) |> not)
-
- Assert.That(
- p.ToString(),
- Is.EqualTo(
- "AltCover.PointVisit : Count = 1 Tracks = 'AltCover.Null; AltCover.Both : AltCover.Pair(Time=1, Call=2)'"
- )
- )
-
- p1.Track(Time(2l))
- Assert.That(p1.Equals(p) |> not)
\ No newline at end of file
diff --git a/AltCover.Recorder.Tests/Recorder.Tests.fs b/AltCover.Recorder.Tests/Recorder.Tests.fs
index 78d49a1e9..9bfeb4657 100644
--- a/AltCover.Recorder.Tests/Recorder.Tests.fs
+++ b/AltCover.Recorder.Tests/Recorder.Tests.fs
@@ -16,6 +16,7 @@ open System.IO
open System.IO.Compression
open System.Reflection
open System.Runtime.CompilerServices
+open System.Threading
open System.Xml
open AltCover.Recorder
@@ -35,42 +36,31 @@ module AltCoverTests =
// printfn "%s %s" tag
//#endif
-#if RECORDER2
let resource =
- "AltCover.Recorder2.Tests.SimpleCoverage.xml"
+ Assembly
+ .GetExecutingAssembly()
+ .GetManifestResourceNames()
+ |> Seq.find (fun n -> n.EndsWith("SimpleCoverage.xml", StringComparison.Ordinal))
- let resource2 =
- "AltCover.Recorder2.Tests.Sample1WithModifiedOpenCover.xml"
+ let private updateReport a b =
+ Adapter.updateReport (a, ReportFormat.NCover, b, b)
+ |> ignore
- let resource3 =
- "AltCover.Recorder2.Tests.Sample2NCoverage.xml"
-#else
- let resource =
- "AltCover.Recorder.Tests.SimpleCoverage.xml"
+ let private pointVisitInit a b = Adapter.init (a, b)
let resource2 =
- "AltCover.Recorder.Tests.Sample1WithModifiedOpenCover.xml"
+ Assembly
+ .GetExecutingAssembly()
+ .GetManifestResourceNames()
+ |> Seq.find (fun n ->
+ n.EndsWith("Sample1WithModifiedOpenCover.xml", StringComparison.Ordinal))
let resource3 =
- "AltCover.Recorder.Tests.Sample2NCoverage.xml"
-#endif
-
- let internal updateReport0 (counts, format, coverageFile, outputFile) =
- Counter.I.UpdateReport(
- ignore,
- (fun _ _ -> ()),
- true,
- counts,
- format,
- coverageFile,
- outputFile
- )
-
- let private updateReport a b =
- updateReport0 (a, ReportFormat.NCover, b, b)
- |> ignore
-
- let private pointVisitInit a b = AltCoverCoreTests.init (a, b)
+ Assembly
+ .GetExecutingAssembly()
+ .GetManifestResourceNames()
+ |> Seq.find (fun n ->
+ n.EndsWith("Sample2NCoverage.xml", StringComparison.Ordinal))
[]
let ShouldCoverTrivalClass () =
@@ -86,7 +76,7 @@ module AltCoverTests =
let ShouldFailXmlDataForNativeJson () =
Assert.Throws(fun () ->
ReportFormat.NativeJson
- |> Counter.I.XmlByFormat
+ |> Counter.I.xmlByFormat
|> ignore)
|> ignore
@@ -97,9 +87,9 @@ module AltCoverTests =
[]
let DefaultAccessorsBehaveAsExpected () =
let v1 = DateTime.UtcNow.Ticks
- let probe = Instance.I.Clock()
+ let probe = Instance.I.clock ()
let v2 = DateTime.UtcNow.Ticks
- Assert.True(Instance.I.Granularity() = 0L)
+ Assert.True(Instance.I.granularity () = 0L)
Assert.True(probe >= v1)
Assert.True(probe <= v2)
@@ -107,132 +97,113 @@ module AltCoverTests =
let ShouldBeLinkingTheCorrectCopyOfThisCode () =
getMyMethodName "=>"
- let tracer = Tracer.Create String.Empty
+ let tracer =
+ Adapter.makeNullTrace String.Empty
// whitelist test not recorder.g
let n =
tracer.GetType().Assembly.GetName().Name
-
+#if RECORDERMODERN
+ Assert.That(n, Is.EqualTo "AltCover.RecorderModern")
+#else
Assert.That(n, Is.EqualTo "AltCover.Recorder")
-
+#endif
getMyMethodName "<="
- let internal addSample (moduleId, hitPointId, context) =
- Instance.I.TakeSample(Sampling.Single, moduleId, hitPointId, context)
-
- let internal addSampleUnconditional (moduleId, hitPointId, context) =
- Instance.I.TakeSample(Sampling.All, moduleId, hitPointId, context)
-
[]
let OnlyNewIdPairShouldBeSampled () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
+ lock Adapter.Lock (fun () ->
try
- AltCoverCoreTests.ModuleReset [| "module"; "newmodule" |]
- let n = Null() :> Track
+ Adapter.ModuleReset [| "module"; "newmodule" |]
- Assert.True(addSample ("module", 23, n), "Test 1")
- Assert.True(addSample ("module", 24, n), "Test 2")
- Assert.True(addSample ("newmodule", 23, n), "Test 3")
- Assert.True(addSample ("module", 23, n) |> not, "Test 4")
- Assert.True(addSampleUnconditional ("module", 23, n), "Test 5")
- Assert.True(addSample ("module", 23, Call 1), "Test 6")
- Assert.True(addSample ("module", 23, Time 0L), "Test 7")
- Assert.True(addSample ("module", 23, Time 1L), "Test 7a")
- Assert.True(addSample ("module", 23, Time 0L) |> not, "Test 7b")
+ Assert.True(Adapter.addSample ("module", 23, Null), "Test 1")
+ Assert.True(Adapter.addSample ("module", 24, Null), "Test 2")
+ Assert.True(Adapter.addSample ("newmodule", 23, Null), "Test 3")
+ Assert.True(Adapter.addSample ("module", 23, Null) |> not, "Test 4")
+ Assert.True(Adapter.addSampleUnconditional ("module", 23, Null), "Test 5")
+ Assert.True(Adapter.addSample ("module", 23, Call 1), "Test 6")
+ Assert.True(Adapter.addSample ("module", 23, Time 0L), "Test 7")
- Assert.True(addSample ("module", 24, new Both(Pair.Create(0, 1))), "Test 8")
+ Assert.True(
+ Adapter.addSample ("module", 24, Both { Call = 1; Time = 0L }),
+ "Test 8"
+ )
- Assert.True(addSample ("module", 25, new Both(Pair.Create(0, 1))), "Test 9")
+ Assert.True(
+ Adapter.addSample ("module", 25, Both { Call = 1; Time = 0L }),
+ "Test 9"
+ )
- Assert.True(addSample ("module", 25, Call 1) |> not, "Test 10")
- Assert.True(addSample ("module", 25, Call 1) |> not, "Test 11")
- Assert.True(addSample ("module", 25, n) |> not, "Test 12")
+ Assert.True(Adapter.addSample ("module", 25, Call 1) |> not, "Test 10")
+ Assert.True(Adapter.addSample ("module", 25, Call 1) |> not, "Test 11")
+ Assert.True(Adapter.addSample ("module", 25, Null) |> not, "Test 12")
// out of band example
- Assert.True(addSample ("nonesuch", 25, n) |> not, "Test 12a")
+ Assert.True(Adapter.addSample ("nonesuch", 25, Null) |> not, "Test 12a")
Assert.Throws(fun () ->
- addSample ("module", 23, Table null) |> ignore)
+ Adapter.addSample ("module", 23, Table null)
+ |> ignore)
|> ignore
finally
- AltCoverCoreTests.HardReset())
+ Adapter.HardReset())
getMyMethodName "<="
- let VisitsEntrySeq key =
- Instance.I.visits.[key]
- |> Seq.cast>
-
- let VisitCount (key, key2) = (Instance.I.visits.[key].[key2]).Count
-
[]
let RealIdShouldIncrementCount () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
- let save = Instance.I.Trace
+ lock Adapter.Lock (fun () ->
+ let save = Instance.I.trace
try
let key = " "
- AltCoverCoreTests.ModuleReset [| key |]
- Instance.I.Trace <- Tracer.Create null
+ Adapter.ModuleReset [| key |]
+ Instance.I.trace <- Adapter.makeNullTrace null
- Instance.I.Recording <- false
- Instance.Visit("key", 17)
- Instance.I.Recording <- true
+ Instance.I.recording <- false
+ Instance.Visit "key" 17
+ Instance.I.recording <- true
Instance.CoverageFormat <- ReportFormat.NCover
- Instance.Visit(key, -23)
+ Instance.Visit key -23
Instance.CoverageFormat <-
ReportFormat.OpenCover
||| ReportFormat.WithTracking
- Instance.Visit(key, -23)
+ Instance.Visit key -23
+
+ let vs = Adapter.VisitsSeq()
+ Assert.True(vs |> Seq.length = 3, sprintf "Adapter.VisitsSeq() = %A" vs)
- let vs = AltCoverCoreTests.VisitsSeq()
+ let vesk = Adapter.VisitsEntrySeq key
Assert.True(
- vs |> Seq.length = 3,
- sprintf "AltCoverCoreTests.VisitsSeq() = %A" vs
+ vesk |> Seq.length = 1,
+ sprintf "Adapter.VisitsEntrySeq %A = %A" key vesk
)
- let vesk = VisitsEntrySeq key
-
- Assert.True(vesk |> Seq.length = 1, sprintf "VisitsEntrySeq %A = %A" key vesk)
-
- Assert.That(VisitCount(key, -23), Is.EqualTo 2L)
+ Assert.True(Adapter.VisitCount(key, -23) = 2L)
Assert.That(Counter.totalVisits, Is.EqualTo 1L)
Assert.That(Counter.branchVisits, Is.EqualTo 1L)
finally
Instance.CoverageFormat <- ReportFormat.NCover
- Instance.I.Recording <- true
- AltCoverCoreTests.HardReset()
- Instance.I.Trace <- save)
+ Instance.I.recording <- true
+ Adapter.HardReset()
+ Instance.I.trace <- save)
getMyMethodName "<="
- let internal payloadSelector x = Instance.I.PayloadSelector(fun _ -> x)
-
- let internal payloadControl (x, y) =
- Instance.I.PayloadControl((fun _ -> x), (fun _ -> y))
-
- let internal payloadSelection (x, y, z) =
- Instance.I.PayloadSelection((fun _ -> x), (fun _ -> y), (fun _ -> z))
-
- let internal untime (at: Track) =
- match at with
- | :? Time as t -> Some t.Value
- | _ -> None
-
[]
let JunkUspidGivesNegativeIndex () =
let key = " "
let index =
- Counter.I.FindIndexFromUspid(0, key)
+ Counter.I.findIndexFromUspid 0 key
Assert.True(index < 0)
@@ -245,56 +216,59 @@ module AltCoverTests =
ReportFormat.OpenCover
||| ReportFormat.WithTracking
- Assert.False(Instance.I.CallerId.HasValue)
- Assert.That(payloadSelector false, Is.EqualTo <| Null())
- Assert.That(payloadSelector true, Is.EqualTo <| Null())
+ Assert.True(Instance.I.callerId () |> Option.isNone)
+ Assert.True(Adapter.payloadSelector false = Adapter.asNull ())
+ Assert.True(Adapter.payloadSelector true = Adapter.asNull ())
Instance.Push 4321
- Assert.That(payloadSelector false, Is.EqualTo <| Null())
- Assert.That(payloadSelector true, Is.EqualTo <| (Call 4321))
+ Assert.True(Adapter.payloadSelector false = Adapter.asNull ())
+ Assert.True(Adapter.payloadSelector true = (Adapter.asCall 4321))
try
Instance.Push 6789
// 0x1234123412341234 == 1311693406324658740
let result =
- payloadSelection (1311693406324658740L, 1000L, true)
+ Adapter.payloadSelection (1311693406324658740L, 1000L, true)
let expected =
- AltCoverCoreTests.newBoth (1311693406324658000L, 6789)
+ Adapter.newBoth (1311693406324658000L, 6789)
Assert.True((result = expected))
finally
Instance.Pop()
- Assert.That(payloadSelector true, Is.EqualTo(Call 4321))
+ Assert.True((Adapter.payloadSelector true = (Adapter.asCall 4321)))
finally
Instance.Pop()
Instance.CoverageFormat <- ReportFormat.NCover
let result2 =
- payloadSelection (1311693406324658740L, 1000L, true)
+ Adapter.payloadSelection (1311693406324658740L, 1000L, true)
- let expected2 = Time 1311693406324658000L
+ let expected2 =
+ Adapter.time 1311693406324658000L
Assert.True((result2 = expected2))
let v1 = DateTime.UtcNow.Ticks
- let probed = payloadControl (1000L, true)
+ let probed =
+ Adapter.payloadControl (1000L, true)
let v2 = DateTime.UtcNow.Ticks
- Assert.True(Null() |> untime |> Option.isNone)
+ Assert.True(Adapter.asNull () |> Adapter.untime |> Seq.isEmpty)
- let probe = (untime probed).Value
+ let [ probe ] =
+ Adapter.untime probed |> Seq.toList
Assert.True(probe % 1000L = 0L)
Assert.True(probe <= v2)
Assert.True(probe >= (1000L * (v1 / 1000L)))
- Assert.True(Instance.I.CallerId.HasValue |> not)
+ Assert.True(Instance.I.callerId () |> Option.isNone)
Instance.Pop()
- Assert.True(Instance.I.CallerId.HasValue |> not)
+ Assert.True(Instance.I.callerId () |> Option.isNone)
[]
let PayloadWithEntryExitGeneratedIsAsExpected () =
- AltCoverCoreTests.ModuleReset [||]
+ Adapter.ModuleReset [||]
try
Instance.I.isRunner <- true
@@ -303,55 +277,58 @@ module AltCoverTests =
ReportFormat.OpenCover
||| ReportFormat.WithTracking
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
- Assert.True(Instance.I.CallerId.HasValue |> not)
- Assert.That(payloadSelector false, Is.EqualTo <| Null())
- Assert.That(payloadSelector true, Is.EqualTo <| Null())
+ Assert.True(Instance.I.callerId () |> Option.isNone)
+ Assert.True(Adapter.payloadSelector false = Adapter.asNull ())
+ Assert.True(Adapter.payloadSelector true = Adapter.asNull ())
Instance.Push 4321
- Assert.That(payloadSelector false, Is.EqualTo <| Null())
- Assert.That(payloadSelector true, Is.EqualTo(Call 4321))
+ Assert.True(Adapter.payloadSelector false = Adapter.asNull ())
+ Assert.True(Adapter.payloadSelector true = (Adapter.asCall 4321))
try
Instance.Push 6789
// 0x1234123412341234 == 1311693406324658740
let result =
- payloadSelection (1311693406324658740L, 1000L, true)
+ Adapter.payloadSelection (1311693406324658740L, 1000L, true)
let expected =
- AltCoverCoreTests.newBoth (1311693406324658000L, 6789)
+ Adapter.newBoth (1311693406324658000L, 6789)
Assert.True((result = expected))
finally
Instance.Pop()
- Assert.That(payloadSelector true, Is.EqualTo(Call 4321))
+ Assert.True((Adapter.payloadSelector true = (Adapter.asCall 4321)))
finally
Instance.Pop()
Instance.I.isRunner <- false
Instance.CoverageFormat <- ReportFormat.NCover
let result2 =
- payloadSelection (1311693406324658740L, 1000L, true)
+ Adapter.payloadSelection (1311693406324658740L, 1000L, true)
- let expected2 = Time 1311693406324658000L
+ let expected2 =
+ Adapter.time 1311693406324658000L
Assert.True((result2 = expected2))
let v1 = DateTime.UtcNow.Ticks
- let probed = payloadControl (1000L, true)
+ let probed =
+ Adapter.payloadControl (1000L, true)
let v2 = DateTime.UtcNow.Ticks
- Assert.True(Null() |> untime |> Option.isNone)
+ Assert.True(Adapter.asNull () |> Adapter.untime |> Seq.isEmpty)
- let probe = (untime probed).Value
+ let [ probe ] =
+ Adapter.untime probed |> Seq.toList
Assert.True(probe % 1000L = 0L)
Assert.True(probe <= v2)
Assert.True(probe >= (1000L * (v1 / 1000L)))
- Assert.True(Instance.I.CallerId.HasValue |> not)
+ Assert.True(Instance.I.callerId () |> Option.isNone)
Instance.Pop()
- Assert.True(Instance.I.CallerId.HasValue |> not)
+ Assert.True(Instance.I.callerId () |> Option.isNone)
Assert.That(Instance.I.visits.Keys, Is.EquivalentTo [ Track.Entry; Track.Exit ])
@@ -383,38 +360,38 @@ module AltCoverTests =
Assert.That(d.Tracks |> Seq.length, Is.EqualTo 1)
let a2 =
- (a.Tracks |> Seq.head |> untime).Value
+ a.Tracks |> Seq.head |> Adapter.untime |> Seq.head
let b2 =
- (b.Tracks |> Seq.head |> untime).Value
+ b.Tracks |> Seq.head |> Adapter.untime |> Seq.head
Assert.That(b2 >= a2)
let c2 =
- (c.Tracks |> Seq.head |> untime).Value
+ c.Tracks |> Seq.head |> Adapter.untime |> Seq.head
Assert.That(c2 >= b2)
let d2 =
- (d.Tracks |> Seq.head |> untime).Value
+ d.Tracks |> Seq.head |> Adapter.untime |> Seq.head
Assert.That(d2 >= c2, sprintf "%A >= %A" d2 c2)
- AltCoverCoreTests.HardReset()
+ Adapter.HardReset()
[]
let RealIdShouldIncrementCountSynchronously () =
getMyMethodName "=>"
lock Instance.I.visits (fun () ->
- let save = Instance.I.Trace
+ let save = Instance.I.trace
let key = " "
- AltCoverCoreTests.ModuleReset [| key |]
+ Adapter.ModuleReset [| key |]
try
- Instance.I.Trace <- Tracer.Create null
+ Instance.I.trace <- Adapter.makeNullTrace null
- Instance.I.VisitSelection(Null(), key, 23)
+ Instance.I.visitSelection (Adapter.asNull ()) key 23
Assert.That(
Instance.I.visits.Keys,
@@ -431,8 +408,8 @@ module AltCoverTests =
Assert.That(Instance.I.visits.[key].[23].Count, Is.EqualTo 1)
Assert.That(Instance.I.visits.[key].[23].Tracks, Is.Empty)
finally
- AltCoverCoreTests.HardReset()
- Instance.I.Trace <- save)
+ Adapter.HardReset()
+ Instance.I.trace <- save)
getMyMethodName "<="
@@ -442,51 +419,6 @@ module AltCoverTests =
Assert.That(all.Contains x)
all.Remove x |> ignore)
- let internal invokeCurriedIssue71Wrapper<'T when 'T :> System.Exception>
- (unique: string)
- =
- let constructor =
- typeof<'T>
- .GetConstructor([| typeof |])
-
- let pitcher =
- fun _ _ _ _ ->
- constructor.Invoke([| unique |]) :?> System.Exception
- |> raise
-
- Instance.I.CurriedIssue71Wrapper(
- "a",
- "b",
- "c",
- "d",
- pitcher
- )
- |> ignore
-
- let internal invokeIssue71Wrapper<'T when 'T :> System.Exception>
- ((unique: string), (called: bool array))
- =
- let constructor =
- typeof<'T>
- .GetConstructor([| typeof |])
-
- let pitcher =
- fun _ _ _ _ ->
- constructor.Invoke([| unique |]) :?> System.Exception
- |> raise
-
- let catcher =
- fun _ _ _ (x: System.Exception) ->
- called.[0] <- true
-
- called.[1] <-
- match x with
- | :? System.ArgumentNullException as ane -> ane.ParamName = unique
- | _ -> x.Message = unique
-
- Instance.I.Issue71Wrapper((), (), (), (), catcher, pitcher)
- |> ignore
-
[]
let StripWorks () =
let b1 = [ "1" ]
@@ -509,7 +441,7 @@ module AltCoverTests =
let before =
Directory.GetFiles(where, "*.exn")
- Instance.I.LogException("a", "b", "c", "ex")
+ Instance.I.logException "a" "b" "c" "ex"
let after =
Directory.GetFiles(where, "*.exn")
@@ -526,9 +458,9 @@ module AltCoverTests =
lines
|> Seq.take 4
|> Seq.zip
- [ "ModuleId = a"
- "hitPointId = b"
- "context = c"
+ [ "ModuleId = \"a\""
+ "hitPointId = \"b\""
+ "context = \"c\""
"exception = ex" ]
|> Seq.iter (fun (a, b) -> Assert.That(a, Is.EqualTo b))
@@ -550,7 +482,7 @@ module AltCoverTests =
let unique =
System.Guid.NewGuid().ToString()
- invokeCurriedIssue71Wrapper unique
+ Adapter.invokeCurriedIssue71Wrapper unique
let after =
Directory.GetFiles(where, "*.exn")
@@ -567,9 +499,9 @@ module AltCoverTests =
lines
|> Seq.take 4
|> Seq.zip
- [ "ModuleId = b"
- "hitPointId = c"
- "context = d"
+ [ "ModuleId = \"b\""
+ "hitPointId = \"c\""
+ "context = \"d\""
"exception = System.NullReferenceException: "
+ unique ]
|> Seq.iter (fun (a, b) -> Assert.That(b, Is.EqualTo a))
@@ -586,7 +518,7 @@ module AltCoverTests =
let unique =
System.Guid.NewGuid().ToString()
- invokeIssue71Wrapper (unique, pair)
+ Adapter.invokeIssue71Wrapper (unique, pair)
Assert.That(pair |> Seq.head, Is.True)
Assert.That(pair |> Seq.last, Is.True)
@@ -597,7 +529,7 @@ module AltCoverTests =
let unique =
System.Guid.NewGuid().ToString()
- invokeIssue71Wrapper (unique, pair)
+ Adapter.invokeIssue71Wrapper (unique, pair)
Assert.That(pair |> Seq.head, Is.True)
Assert.That(pair |> Seq.last, Is.True)
@@ -608,7 +540,7 @@ module AltCoverTests =
let unique =
System.Guid.NewGuid().ToString()
- invokeIssue71Wrapper (unique, pair)
+ Adapter.invokeIssue71Wrapper (unique, pair)
Assert.That(pair |> Seq.head, Is.True)
Assert.That(pair |> Seq.last, Is.True)
@@ -621,7 +553,7 @@ module AltCoverTests =
let exn =
Assert.Throws(fun () ->
- invokeIssue71Wrapper (unique, pair))
+ Adapter.invokeIssue71Wrapper (unique, pair))
Assert.That(pair |> Seq.head, Is.False)
Assert.That(pair |> Seq.last, Is.False)
@@ -646,7 +578,7 @@ module AltCoverTests =
let before =
Directory.GetFiles(where, "*.exn")
- Instance.I.VisitImpl(key, 23, Null())
+ Instance.I.visitImpl key 23 (Adapter.asNull ())
let after =
Directory.GetFiles(where, "*.exn")
@@ -664,11 +596,11 @@ module AltCoverTests =
lines
|> Seq.take 4
|> Seq.zip
- [ "ModuleId = "
+ [ "ModuleId = \" \""
"hitPointId = 23"
- "context = AltCover.Null"
+ "context = Null"
"exception = System.NullReferenceException: Object reference not set to an instance of an object." ]
- |> Seq.iter (fun (a, b) -> Assert.That(a, Is.EqualTo(b)))
+ |> Seq.iter (fun (a, b) -> Assert.True((a = b)))
let third =
Directory.GetFiles(where, "*.exn")
@@ -688,16 +620,16 @@ module AltCoverTests =
lock Instance.I.visits (fun () ->
try
let key = " "
- AltCoverCoreTests.ModuleReset [| key; "key" |]
- Instance.I.VisitImpl(key, 23, Null())
- Instance.I.VisitImpl("key", 42, Null())
+ Adapter.ModuleReset [| key; "key" |]
+ Instance.I.visitImpl key 23 (Adapter.asNull ())
+ Instance.I.visitImpl "key" 42 (Adapter.asNull ())
Assert.That(
Instance.I.visits.Keys,
Is.EquivalentTo [ key; "key"; Track.Entry; Track.Exit ]
)
finally
- AltCoverCoreTests.HardReset())
+ Adapter.HardReset())
getMyMethodName "<="
@@ -708,9 +640,9 @@ module AltCoverTests =
lock Instance.I.visits (fun () ->
try
let key = " "
- AltCoverCoreTests.ModuleReset [| key |]
- Instance.I.VisitImpl(key, 23, Null())
- Instance.I.VisitImpl(key, 42, Null())
+ Adapter.ModuleReset [| key |]
+ Instance.I.visitImpl key 23 (Adapter.asNull ())
+ Instance.I.visitImpl key 42 (Adapter.asNull ())
Assert.That(
Instance.I.visits.Keys,
@@ -719,7 +651,7 @@ module AltCoverTests =
Assert.That(Instance.I.visits.[key].Count, Is.EqualTo 2)
finally
- AltCoverCoreTests.HardReset())
+ Adapter.HardReset())
getMyMethodName "<="
@@ -729,15 +661,15 @@ module AltCoverTests =
lock Instance.I.visits (fun () ->
let key = " "
- AltCoverCoreTests.ModuleReset [| key |]
+ Adapter.ModuleReset [| key |]
try
- Instance.I.VisitImpl(key, 23, Null())
- Instance.I.VisitImpl(key, 23, Null())
+ Instance.I.visitImpl key 23 (Adapter.asNull ())
+ Instance.I.visitImpl key 23 (Adapter.asNull ())
Assert.That(Instance.I.visits.[key].[23].Count, Is.EqualTo 2)
Assert.That(Instance.I.visits.[key].[23].Tracks, Is.Empty)
finally
- AltCoverCoreTests.HardReset())
+ Adapter.HardReset())
getMyMethodName "<="
@@ -747,17 +679,18 @@ module AltCoverTests =
lock Instance.I.visits (fun () ->
let key = " "
- AltCoverCoreTests.ModuleReset [| key |]
+ Adapter.ModuleReset [| key |]
try
- let payload = Time DateTime.UtcNow.Ticks
+ let payload =
+ Adapter.time DateTime.UtcNow.Ticks
- Instance.I.VisitImpl(key, 23, Null())
- Instance.I.VisitImpl(key, 23, payload)
+ Instance.I.visitImpl key 23 (Adapter.asNull ())
+ Instance.I.visitImpl key 23 payload
Assert.That(Instance.I.visits.[key].[23].Count, Is.EqualTo 1)
Assert.That(Instance.I.visits.[key].[23].Tracks, Is.EquivalentTo [ payload ])
finally
- AltCoverCoreTests.HardReset())
+ Adapter.HardReset())
getMyMethodName "<="
@@ -1209,12 +1142,13 @@ module AltCoverTests =
let after = XmlDocument()
after.Load worker
- let join (x: string seq) = String.Join(" ", x)
+ let join (x: string array) = String.Join(" ", x)
Assert.That(
after.SelectNodes("//seqpnt")
|> Seq.cast
|> Seq.map (fun x -> x.GetAttribute("visitcount"))
+ |> Seq.toArray
|> join,
Is.EqualTo "0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 2 1 1 1"
@@ -1255,7 +1189,7 @@ module AltCoverTests =
item.Add("7C-CD-66-29-A3-6C-6D-5F-A7-65-71-0E-22-7D-B2-61-B5-1F-65-9A", payload)
- updateReport0 (item, ReportFormat.OpenCover, worker, worker)
+ Adapter.updateReport (item, ReportFormat.OpenCover, worker, worker)
|> ignore
worker.Position <- 0L
@@ -1292,17 +1226,17 @@ module AltCoverTests =
let EmptyFlushLeavesNoTrace () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
+ lock Adapter.Lock (fun () ->
let saved = Console.Out
try
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
use stdout = new StringWriter()
Console.SetOut stdout
Instance.FlushFinish()
Assert.That(stdout.ToString(), Is.Empty)
finally
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
Console.SetOut saved)
getMyMethodName "<="
@@ -1342,21 +1276,11 @@ module AltCoverTests =
trywithrelease (fun () ->
InvalidOperationException() |> raise)
- let internal makeStreamTrace s1 =
- let mutable t = Tracer.Create(null)
- // fsharplint:disable-next-line RedundantNewKeyword
- t.Stream <- new System.IO.MemoryStream()
- // fsharplint:disable-next-line RedundantNewKeyword
- t.Formatter <- new System.IO.BinaryWriter(s1)
- t.Runner <- true
- t.Definitive <- false
- t
-
[]
let PauseLeavesExpectedTraces () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
+ lock Adapter.Lock (fun () ->
trywithrelease (fun () ->
let saved = Console.Out
let here = Directory.GetCurrentDirectory()
@@ -1368,17 +1292,17 @@ module AltCoverTests =
let unique =
Path.Combine(where, Guid.NewGuid().ToString())
- let save = Instance.I.Trace
+ let save = Instance.I.trace
use s = new MemoryStream()
let s1 =
new Compression.DeflateStream(s, CompressionMode.Compress)
- Instance.I.Trace <- makeStreamTrace s1
+ Instance.I.trace <- Adapter.makeStreamTrace s1
try
Instance.I.isRunner <- true
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
use stdout = new StringWriter()
Console.SetOut stdout
@@ -1406,16 +1330,16 @@ module AltCoverTests =
[ 0..9 ]
|> Seq.iter (fun i ->
- AltCoverCoreTests.VisitsAdd(
+ Adapter.VisitsAdd(
"f6e3edb3-fb20-44b3-817d-f69d1a22fc2f",
i,
(int64 (i + 1))
))
- let nullObj: obj = null
- Instance.I.doPause.Invoke(nullObj, null)
+ Adapter.DoPause().Invoke(null, null)
- AltCoverCoreTests.VisitsSeq()
+ Adapter.VisitsSeq()
+ |> Seq.cast>>
|> Seq.iter (fun v ->
Assert.That(v.Value, Is.Empty, sprintf "Unexpected write %A" v))
@@ -1445,9 +1369,9 @@ module AltCoverTests =
"-1" ]
)
finally
- Instance.I.Trace <- save
+ Instance.I.trace <- save
AltCoverCoreTests.maybeDeleteFile Instance.ReportFilePath
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
Instance.I.isRunner <- false
Console.SetOut saved
Directory.SetCurrentDirectory(here)
@@ -1459,7 +1383,7 @@ module AltCoverTests =
let ResumeLeavesExpectedTraces () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
+ lock Adapter.Lock (fun () ->
trywithrelease (fun () ->
let saved = Console.Out
let here = Directory.GetCurrentDirectory()
@@ -1471,7 +1395,7 @@ module AltCoverTests =
let unique =
Path.Combine(where, Guid.NewGuid().ToString())
- let save = Instance.I.Trace
+ let save = Instance.I.trace
let tag = unique + ".xml.acv"
do
@@ -1482,8 +1406,8 @@ module AltCoverTests =
let key =
"f6e3edb3-fb20-44b3-817d-f69d1a22fc2f"
- AltCoverCoreTests.ModuleReset [| key |]
- Instance.I.Trace <- Tracer.Create(tag)
+ Adapter.ModuleReset [| key |]
+ Instance.I.trace <- Tracer.Create(tag)
use stdout = new StringWriter()
Console.SetOut stdout
@@ -1510,17 +1434,17 @@ module AltCoverTests =
()
[ 0..9 ]
- |> Seq.iter (fun i -> AltCoverCoreTests.VisitsAdd(key, i, (int64 (i + 1))))
+ |> Seq.iter (fun i -> Adapter.VisitsAdd(key, i, (int64 (i + 1))))
- let nullObj: obj = null
- Instance.I.doResume.Invoke(nullObj, null)
+ Adapter.DoResume().Invoke(null, null)
- AltCoverCoreTests.VisitsSeq()
+ Adapter.VisitsSeq()
+ |> Seq.cast>>
|> Seq.iter (fun v ->
Assert.That(v.Value, Is.Empty, sprintf "Visits should be cleared %A" v))
Assert.That(
- Object.ReferenceEquals(Instance.I.Trace, save),
+ Object.ReferenceEquals(Instance.I.trace, save),
Is.False,
"trace should be replaced"
)
@@ -1551,10 +1475,10 @@ module AltCoverTests =
"-1" ]
)
finally
- AltCoverCoreTests.HardReset()
- Instance.I.Trace <- save
+ Adapter.HardReset()
+ Instance.I.trace <- save
AltCoverCoreTests.maybeDeleteFile Instance.ReportFilePath
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
Console.SetOut saved
Directory.SetCurrentDirectory(here)
File.Delete tag
@@ -1566,7 +1490,7 @@ module AltCoverTests =
let FlushLeavesExpectedTraces () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
+ lock Adapter.Lock (fun () ->
Instance.I.isRunner <- false
trywithrelease (fun () ->
@@ -1580,11 +1504,11 @@ module AltCoverTests =
let unique =
Path.Combine(where, Guid.NewGuid().ToString())
- let save = Instance.I.Trace
- Instance.I.Trace <- Tracer.Create null
+ let save = Instance.I.trace
+ Instance.I.trace <- Adapter.makeNullTrace null
try
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
use stdout = new StringWriter()
Console.SetOut stdout
Directory.CreateDirectory(unique) |> ignore
@@ -1611,14 +1535,13 @@ module AltCoverTests =
[ 0..9 ]
|> Seq.iter (fun i ->
- AltCoverCoreTests.VisitsAdd(
+ Adapter.VisitsAdd(
"f6e3edb3-fb20-44b3-817d-f69d1a22fc2f",
i,
(int64 (i + 1))
))
- let nullObj: obj = null
- Instance.I.doExit.Invoke(nullObj, null)
+ Adapter.DoExit().Invoke(null, null)
let head =
"Coverage statistics flushing took "
@@ -1660,9 +1583,9 @@ module AltCoverTests =
"1" ]
)
finally
- Instance.I.Trace <- save
+ Instance.I.trace <- save
AltCoverCoreTests.maybeDeleteFile Instance.ReportFilePath
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
Console.SetOut saved
Directory.SetCurrentDirectory(here)
AltCoverCoreTests.maybeIOException (fun () -> Directory.Delete(unique))))
@@ -1673,7 +1596,7 @@ module AltCoverTests =
let SupervisedFlushLeavesExpectedTraces () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
+ lock Adapter.Lock (fun () ->
trywithrelease (fun () ->
let saved = Console.Out
let here = Directory.GetCurrentDirectory()
@@ -1685,13 +1608,13 @@ module AltCoverTests =
let unique =
Path.Combine(where, Guid.NewGuid().ToString())
- let save = Instance.I.Trace
- Instance.I.Trace <- Tracer.Create null
+ let save = Instance.I.trace
+ Instance.I.trace <- Adapter.makeNullTrace null
Instance.supervision <- true
try
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
use stdout = new StringWriter()
Console.SetOut stdout
Directory.CreateDirectory(unique) |> ignore
@@ -1718,14 +1641,13 @@ module AltCoverTests =
[ 0..9 ]
|> Seq.iter (fun i ->
- AltCoverCoreTests.VisitsAdd(
+ Adapter.VisitsAdd(
"f6e3edb3-fb20-44b3-817d-f69d1a22fc2f",
i,
(int64 (i + 1))
))
- let nullObj: obj = null
- Instance.I.doUnload.Invoke(nullObj, null)
+ Adapter.DoUnload().Invoke(null, null)
let head =
"Coverage statistics flushing took "
@@ -1760,25 +1682,16 @@ module AltCoverTests =
"-1" ]
)
finally
- Instance.I.Trace <- save
+ Instance.I.trace <- save
Instance.supervision <- false
AltCoverCoreTests.maybeDeleteFile Instance.ReportFilePath
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
Console.SetOut saved
Directory.SetCurrentDirectory(here)
AltCoverCoreTests.maybeIOException (fun () -> Directory.Delete(unique))))
getMyMethodName "<="
- let internal doFlush (visits, format, report, output) =
- let output' =
- if System.String.IsNullOrEmpty output then
- null
- else
- output
-
- Counter.DoFlushFile(ignore, (fun _ _ -> ()), true, visits, format, report, output')
-
[]
let FlushLeavesExpectedTracesWhenDiverted () =
let saved = Console.Out
@@ -1832,7 +1745,7 @@ module AltCoverTests =
visits.["f6e3edb3-fb20-44b3-817d-f69d1a22fc2f"] <- payload
- doFlush (visits, ReportFormat.NCover, reportFile, outputFile)
+ Adapter.doFlush (visits, ReportFormat.NCover, reportFile, outputFile)
|> ignore
use worker' =
@@ -1916,7 +1829,7 @@ module AltCoverTests =
visits.["f6e3edb3-fb20-44b3-817d-f69d1a22fc2f"] <- payload
- doFlush (visits, ReportFormat.NCover, reportFile, outputFile)
+ Adapter.doFlush (visits, ReportFormat.NCover, reportFile, outputFile)
|> ignore
use worker' =
@@ -1991,7 +1904,7 @@ module AltCoverTests =
visits.["f6e3edb3-fb20-44b3-817d-f69d1a22fc2f"] <- payload
- doFlush (
+ Adapter.doFlush (
visits,
ReportFormat.NCover ||| ReportFormat.Zipped,
reportFile,
@@ -2082,7 +1995,7 @@ module AltCoverTests =
visits.["f6e3edb3-fb20-44b3-817d-f69d1a22fc2f"] <- payload
- doFlush (
+ Adapter.doFlush (
visits,
ReportFormat.NCover ||| ReportFormat.Zipped,
reportFile,
@@ -2155,7 +2068,12 @@ module AltCoverTests =
visits.["f6e3edb3-fb20-44b3-817d-f69d1a22fc2f"] <- payload
- doFlush (visits, ReportFormat.NCover ||| ReportFormat.Zipped, reportFile, null)
+ Adapter.doFlush (
+ visits,
+ ReportFormat.NCover ||| ReportFormat.Zipped,
+ reportFile,
+ null
+ )
|> ignore
Assert.That(reportFile |> File.Exists |> not)
@@ -2172,7 +2090,7 @@ module AltCoverTests =
let ZipFlushLeavesExpectedTraces () =
getMyMethodName "=>"
- lock Instance.I.visits (fun () ->
+ lock Adapter.Lock (fun () ->
Instance.I.isRunner <- false
Instance.CoverageFormat <- ReportFormat.NCover ||| ReportFormat.Zipped
@@ -2187,11 +2105,11 @@ module AltCoverTests =
let unique =
Path.Combine(where, Guid.NewGuid().ToString())
- let save = Instance.I.Trace
- Instance.I.Trace <- Tracer.Create null
+ let save = Instance.I.trace
+ Instance.I.trace <- Adapter.makeNullTrace null
try
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
use stdout = new StringWriter()
Console.SetOut stdout
Directory.CreateDirectory(unique) |> ignore
@@ -2226,14 +2144,13 @@ module AltCoverTests =
[ 0..9 ]
|> Seq.iter (fun i ->
- AltCoverCoreTests.VisitsAdd(
+ Adapter.VisitsAdd(
"f6e3edb3-fb20-44b3-817d-f69d1a22fc2f",
i,
(int64 (i + 1))
))
- let nullObj: obj = null
- Instance.I.doExit.Invoke(nullObj, null)
+ Adapter.DoExit().Invoke(null, null)
let head =
"Coverage statistics flushing took "
@@ -2281,10 +2198,10 @@ module AltCoverTests =
"1" ]
)
finally
- Instance.I.Trace <- save
+ Instance.I.trace <- save
AltCoverCoreTests.maybeDeleteFile Instance.ReportFilePath
AltCoverCoreTests.maybeDeleteFile (Instance.ReportFilePath + ".zip")
- AltCoverCoreTests.VisitsClear()
+ Adapter.VisitsClear()
Console.SetOut saved
Directory.SetCurrentDirectory(here)
AltCoverCoreTests.maybeIOException (fun () -> Directory.Delete(unique))))
diff --git a/AltCover.Recorder.Tests/Tracer.Tests.fs b/AltCover.Recorder.Tests/Tracer.Tests.fs
index 97b572fa8..920a9c4e5 100644
--- a/AltCover.Recorder.Tests/Tracer.Tests.fs
+++ b/AltCover.Recorder.Tests/Tracer.Tests.fs
@@ -37,89 +37,6 @@ module AltCoverCoreTests =
g ()
reraise ()
- let internal init (n, l) =
- let tmp = PointVisit.Create()
- tmp.Count <- n
-
- tmp.Tracks.AddRange l
- tmp
-
- let internal newBoth (time, call) = Both(Pair.Create(time, call))
-
- let VisitsClear () =
- Instance.I.Clear()
- Counter.branchVisits <- 0L
- Counter.totalVisits <- 0L
-
- let SamplesClear () =
- Instance.I.samples <- Instance.I.MakeSamples()
-
- let private reset () =
- Instance.I.isRunner <- false
- VisitsClear()
- SamplesClear()
-
- let ModuleReset (m: string array) =
- Instance.Modules <- m
- reset ()
-
- let HardReset () =
- Instance.Modules <- [| System.String.Empty |]
- reset ()
-
- let VisitsSeq () =
- Instance.I.visits
- |> Seq.cast>>
-
- let VisitImplMethod (moduleId, hitPointId, mId) =
- Instance.I.VisitImpl(moduleId, hitPointId, (Call mId))
-
- let internal prepareName name =
- if name |> Instance.I.visits.ContainsKey |> not then
- let entry = Dictionary()
- Instance.I.visits.Add(name, entry)
-
- let VisitsAdd (name, line, number) =
- prepareName name
- let v = init (number, [])
- Instance.I.visits.[name].Add(line, v)
-
- let VisitsAddTrack (name, line, number) =
- prepareName name
- let v1 = init (number, [ Call 17; Call 42 ])
- Instance.I.visits.[name].Add(line, v1)
-
- let v2 =
- init (
- (number + 1L),
- [ Time(17L)
- Both(Pair.Create(42L, 23)) ]
- )
-
- Instance.I.visits.[name].Add(line + 1, v2)
-
- type Untable =
- | Name of string
- | Place of int
- | Token of Track
-
- let internal untable t =
- let r = List()
- //let r = System.Collections.ArrayList()
-
- let n, p, (t': Track) = t
-
- match t' with
- | :? Table as d ->
- r.Add(Untable.Name n) |> ignore
- r.Add(Untable.Place p) |> ignore
- r.Add(Untable.Token d) |> ignore
- | _ -> ()
-
- r
-
- //=======================================
-
[]
let ExcerciseItAll () =
let where =
@@ -189,7 +106,9 @@ module AltCoverCoreTests =
(id,
strike,
match enum tag with
- | Tag.Call -> (Call <| formatter.ReadInt32()) :> Track
+ //| Tag.Time -> Adapter.Time <| formatter.ReadInt64()
+ | Tag.Call -> Adapter.asCall <| formatter.ReadInt32()
+ //| Tag.Both -> Adapter.NewBoth((formatter.ReadInt64()), (formatter.ReadInt32()))
| Tag.Table ->
Assert.True((id = String.Empty))
Assert.True((strike = 0))
@@ -212,7 +131,7 @@ module AltCoverCoreTests =
if pts > 0 then
let p = formatter.ReadInt32()
let n = formatter.ReadInt64()
- let pv = init (n, [])
+ let pv = Adapter.init (n, [])
t.[m].Add(p, pv)
// []
@@ -221,14 +140,17 @@ module AltCoverCoreTests =
match enum track with
| Tag.Time ->
- pv.Tracks.Add(Time <| formatter.ReadInt64())
+ pv.Tracks.Add(Adapter.time <| formatter.ReadInt64())
tracking ()
| Tag.Call ->
- pv.Tracks.Add(Call <| formatter.ReadInt32())
+ pv.Tracks.Add(Adapter.asCall <| formatter.ReadInt32())
tracking ()
| Tag.Both ->
pv.Tracks.Add(
- newBoth ((formatter.ReadInt64()), (formatter.ReadInt32()))
+ Adapter.newBoth (
+ (formatter.ReadInt64()),
+ (formatter.ReadInt32())
+ )
)
tracking ()
@@ -242,8 +164,8 @@ module AltCoverCoreTests =
sequencePoint points
``module`` ()
- Table t
- | _ -> Null())
+ Adapter.table t
+ | _ -> Adapter.asNull ())
|> hits.Add
sink ())
@@ -253,7 +175,7 @@ module AltCoverCoreTests =
[]
let VisitShouldSignal () =
- let save = Instance.I.Trace
+ let save = Instance.I.trace
let where =
Assembly.GetExecutingAssembly().Location
@@ -265,7 +187,7 @@ module AltCoverCoreTests =
let tag = unique + ".acv"
let expected =
- [ ("name", 23, Null() :> Track) ]
+ [ ("name", 23, Adapter.asNull ()) ]
do
use stream = File.Create tag
@@ -275,16 +197,16 @@ module AltCoverCoreTests =
let mutable client = Tracer.Create tag
try
- HardReset()
- Instance.I.Trace <- client.OnStart()
- Assert.True(Instance.I.Trace.IsConnected, "connection failed")
+ Adapter.HardReset()
+ Instance.I.trace <- client.OnStart()
+ Assert.True(Instance.I.trace.IsConnected, "connection failed")
Instance.I.isRunner <- true
- Instance.I.VisitImpl("name", 23, Null())
+ Adapter.VisitImplNone("name", 23)
finally
- Instance.I.Trace.Close()
- Instance.I.Trace.Close()
- Instance.I.Trace.Close()
- Instance.I.Trace <- save
+ Instance.I.trace.Close()
+ Instance.I.trace.Close()
+ Instance.I.trace.Close()
+ Instance.I.trace <- save
use stream = // fsharplint:disable-next-line RedundantNewKeyword
new DeflateStream(File.OpenRead(unique + ".0.acv"), CompressionMode.Decompress)
@@ -292,23 +214,25 @@ module AltCoverCoreTests =
let results =
readResults stream |> Seq.toList
- VisitsSeq()
+ Adapter.VisitsSeq()
+ |> Seq.cast>>
|> Seq.iter (fun v ->
Assert.That(v.Value, Is.Empty, sprintf "Unexpected local write %A" v))
Assert.That(
- VisitsSeq() |> Seq.length,
+ Adapter.VisitsSeq() |> Seq.length,
Is.EqualTo 3,
- sprintf "unexpected local write %A" <| VisitsSeq()
+ sprintf "unexpected local write %A"
+ <| Adapter.VisitsSeq()
)
Assert.True((results = expected), sprintf "unexpected result %A" results)
finally
- HardReset()
+ Adapter.HardReset()
[]
let VisitShouldSignalTrack () =
- let save = Instance.I.Trace
+ let save = Instance.I.trace
let where =
Assembly.GetExecutingAssembly().Location
@@ -325,18 +249,18 @@ module AltCoverCoreTests =
t.["name"] <- Dictionary()
let expect23 =
- [ Call 17; Call 42 ] |> Seq.cast