Skip to content

Branches can be reported when they are unconditional #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SteveGilham opened this issue May 3, 2018 · 2 comments
Closed

Branches can be reported when they are unconditional #83

SteveGilham opened this issue May 3, 2018 · 2 comments
Labels
bug Something isn't working stale tenet-coverage Issue related to possible incorrect coverage

Comments

@SteveGilham
Copy link

In passing, I noticed that in the code in issue #82, the method Normal that was tested reported a branch (1 out of 1 covered). This turns out to be a point where the IL has an unconditional jump (and thus no decision point in the control flow) that leads to the next instruction.

83

The IL for the method is

.method public hidebysig static 
	int32 Normal () cil managed 
{
	// Method begins at RVA 0x208c
	// Code size 19 (0x13)
	.maxstack 1
	.locals init (
		[0] valuetype [netstandard]System.DateTime,
		[1] int32
	)

	// (no C# code)
	IL_0000: nop
	// return DateTime.Now.Hour;
	IL_0001: call valuetype [netstandard]System.DateTime [netstandard]System.DateTime::get_Now()
	IL_0006: stloc.0
	// (no C# code)
	IL_0007: ldloca.s 0
	IL_0009: call instance int32 [netstandard]System.DateTime::get_Hour()
	IL_000e: stloc.1
	IL_000f: br.s IL_0011

	IL_0011: ldloc.1
	IL_0012: ret
} // end of method Class1::Normal

The full XML report for the method is as follows

            <Method cyclomaticComplexity="0" nPathComplexity="0" sequenceCoverage="1" branchCoverage="1" isConstructor="False" isGetter="False" isSetter="False" isStatic="True">
              <Summary numSequencePoints="3" visitedSequencePoints="3" numBranchPoints="1" visitedBranchPoints="1" sequenceCoverage="1" branchCoverage="1" maxCyclomaticComplexity="0" minCyclomaticComplexity="0" visitedClasses="0" numClasses="0" visitedMethods="1" numMethods="1" />
              <MetadataToken />
              <Name>System.Int32 ClassLibrary1.Class1::Normal()</Name>
              <FileRef uid="1" />
              <SequencePoints>
                <SequencePoint vc="1" upsid="31" ordinal="0" sl="31" sc="1" el="31" ec="2" bec="0" bev="0" fileid="1" />
                <SequencePoint vc="1" upsid="32" ordinal="1" sl="32" sc="1" el="32" ec="2" bec="0" bev="0" fileid="1" />
                <SequencePoint vc="1" upsid="33" ordinal="2" sl="33" sc="1" el="33" ec="2" bec="0" bev="0" fileid="1" />
              </SequencePoints>
              <BranchPoints>
                <BranchPoint vc="1" upsid="33" ordinal="0" path="" offset="0" offsetend="0" sl="33" fileid="1" />
              </BranchPoints>
              <MethodPoint vc="3" upsid="0" p8:type="SequencePoint" ordinal="1" offset="1" sc="0" sl="31" ec="1" el="33" bec="0" bev="0" fileid="1" xmlns:p8="xsi" />
            </Method>
@SteveGilham
Copy link
Author

SteveGilham commented May 3, 2018

I also notice in passing that the start-column and end-column attributes (sc and ec) for the method are not what one would expect (the expected values being like 9,10; 13,38 and 9,10 respectively)

@MarcoRossignoli MarcoRossignoli added bug Something isn't working tenet-coverage Issue related to possible incorrect coverage labels Sep 12, 2019
@MarcoRossignoli MarcoRossignoli added the up-for-grabs Good issue for contributors label Sep 26, 2019
@MarcoRossignoli MarcoRossignoli removed the up-for-grabs Good issue for contributors label Feb 21, 2021
@Bertk Bertk added the stale label Jan 22, 2024
@Bertk
Copy link
Collaborator

Bertk commented Jan 22, 2024

The issue might be out-dated because new releases are available.

Please reopen the issue if the bug still exists and can be reproduced with latest preview from coverlet nightly build.

see Consume nightly build

@Bertk Bertk closed this as completed Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale tenet-coverage Issue related to possible incorrect coverage
Projects
None yet
Development

No branches or pull requests

3 participants