Skip to content

Commit

Permalink
fix: defensive coding in ListToBit
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-tleavitt committed Aug 22, 2024
1 parent f58ef2e commit bf98cfe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
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 possible 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

0 comments on commit bf98cfe

Please sign in to comment.