Skip to content

fix: defensive coding in ListToBit #55

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

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.4] - Unreleased

### Fixed
- #54: Defend against possible configuration-dependent SQL exceptions in mapping INT to MAC/CLS coverage

## [4.0.3] - 2024-08-19

### Fixed
Expand Down
4 changes: 3 additions & 1 deletion cls/TestCoverage/Procedures.cls
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ ClassMethod ListToBit(pSource As %List) As %Binary [ SqlName = LIST_TO_BIT, SqlP
Set tResult = ""
Set tPointer = 0
While $ListNext(pSource,tPointer,tBitPosition) {
Set $Bit(tResult,tBitPosition) = 1
If $Data(tBitPosition)#2 && (tBitPosition '= "") {
Set $Bit(tResult,tBitPosition) = 1
}
}
Quit tResult
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class UnitTest.TestCoverage.Unit.Procedures Extends %UnitTest.TestCase
{

Method TestListToBit()
{
Set compare = ""
For i=1:1:3 {
Set $Bit(compare,i) = 1
}
Do $$$AssertEquals(##class(TestCoverage.Procedures).ListToBit($lb(1,2,3,,"")),compare)
}

}
2 changes: 1 addition & 1 deletion module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Export generator="Cache" version="25">
<Document name="TestCoverage.ZPM"><Module>
<Name>TestCoverage</Name>
<Version>4.0.3</Version>
<Version>4.0.4</Version>
<Description>Run your typical ObjectScript %UnitTest tests and see which lines of your code are executed. Includes Cobertura-style reporting for use in continuous integration tools.</Description>
<Packaging>module</Packaging>
<Resource Name="TestCoverage.PKG" Directory="cls" />
Expand Down
Loading