Skip to content

Commit

Permalink
Requires now 18.0 and comes as a Tatin package
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed Sep 21, 2020
1 parent 04ea4dc commit bd3d018
Show file tree
Hide file tree
Showing 15 changed files with 229 additions and 19 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.acre
.acre/
aplcore
Dist/
Development.dws
change_history/
.gitignore
8 changes: 5 additions & 3 deletions APLSource/EventCodes.aplc
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@

rVersion
:Access Public Shared
r({}⎕THIS)'2.0.0.15' '2020-03-22'
r({}⎕THIS)'3.0.0.16' '2020-09-21'

History
:Access Public Shared
* 2.0.0
* BREAKING CHANGE: File extension changed from .DYALOG to .APLC
* 3.0.0
* BREAKING CHANGES:
* Requires now Dyalog 18.0 or better
* Is delivered as a Tatin package
\\
For information regarding older versions see <https://github.com/aplteam/EventCodes/releases>
Expand Down
6 changes: 6 additions & 0 deletions APLSource/Initialize.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{r}Initialize;⎕TRAP
⎕TRAP0 'S'
r
{}⎕SE.UCMD'cd ',AcreConfig.ProjectFolder
⎕SE.aplteam.InitializeAPLTreeProject ⎕THIS
Done
4 changes: 4 additions & 0 deletions APLSource/TestCases/Prepare.aplf
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
Prepare
⎕IO1 ⎕ML1
T⎕NEW ##.Tester2 ⎕THIS
T.codeCoverage⎕NEW ##.CodeCoverage(,'#.',{,'.',}2⎕THIS.##)
T.codeCoverage.filename(1 ⎕NPARTS''),'TestResults/CodeCoverage'
Done
12 changes: 12 additions & 0 deletions APLSource/TestCases/RunTests.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RunTests;dcfFilename;htmlFilename;tno
Prepare
dcfFilename(,/¯1⎕NPARTS T.codeCoverage.filename),'.dcf'
:If ##.FilesAndDirs.IsFile dcfFilename
:AndIf ∆YesOrNo'CodeCovarge data file already exists; override?'
tnodcfFilename ⎕FTIE 0
dcfFilename ⎕FERASE tno
:EndIf
T.Run 1
htmlFilename##.CodeCoverage.ProcessDataAndCreateReport T.codeCoverage.filename
##.APLTreeUtils2.GoToWebPage'file://',htmlFilename
Done
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_30.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

listGetInstalledAPLs
:Repeat
version3' '##.APLTreeUtils.Splitlist
version3' '##.APLTreeUtils2.Splitlist
:If 0=errors∆GetErrorsFromHelpPage'http://help.dyalog.com/',version,'/Content/Language/System%20Functions/trap.htm'
list1list
:EndIf
Expand Down
15 changes: 7 additions & 8 deletions APLSource/TestCases/Test_ZZZ_998.aplf
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
RTest_ZZZ_998(stopFlag batchFlag);⎕IO;⎕ML;⎕TRAP;report;buff;xml;source
Checks on two text vectors: "⍝TODO⍝" and "⍝CHECK⍝"; never fails, just reports.
⎕IO0 ⎕ML3
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
RT._OK
report''

xml⎕XML'flat'##.APLTreeUtils.ReadUtf8File'publish.config'
source2xml[xml[;1]'container';]
xml⎕XML⎕NGET'publish.config'
source3xml[xml[;2]'container';]
buffT.FindSpecialString'⍝CHECK⍝'
buff(buff[;0]¨⎕XSI[0])buff remove caller
:If ~0buff
buff(buff[;1]¨⎕XSI[1])buff remove caller
:If 0buff
report,(' ⍝CHECK⍝ found:'),(' '),¨buff
:EndIf
buffT.FindSpecialString'⍝TODO⍝'
buff(buff[;0]¨⎕XSI[0])buff remove caller
:If ~0buff
buff(buff[;1]¨⎕XSI[1])buff remove caller
:If 0buff
report,(' ⍝TODO⍝ found:'),(' '),¨buff
:EndIf
:If 1=,report
:If 1=report
report,' Nothing found!'
:Else
'Checking for ⍝TODO⍝ and ⍝CHECK⍝ '{,'--- ',,' ','-'}80⎕PW-1
Expand Down
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_ZZZ_999.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
f1~/⎕Dd~'-'

publish.config must be in line with what "Version" returns of course:
xml⎕XML'flat'##.APLTreeUtils.ReadUtf8File'publish.config'
xml⎕XML⎕NGET'publish.config'
f2v(2+⎕IO)xml[xml[;1+⎕IO]'version';]
f2d(2+⎕IO)xml[xml[;1+⎕IO]'date';]

Expand Down
51 changes: 51 additions & 0 deletions APLSource/TestCases/∆YesOrNo.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
yesOrNo{default}∆YesOrNo question;isOkay;answer;add;dtb;answer2
Ask a simple question and allows just "Yes" or "No" as answers.
You may specify a default via the optional left argument which when specified
rules what happens when the user just presses <enter>.
`default` must be either 1 (yes) or 0 (no).
Note that this function does not work as expected when traced!
isOkay0
default{0<⎕NC : ''}'default'
isOkay0
:If ~0default
'Left argument must be a scalar'⎕SIGNAL 11/1,default
:AndIf ~default0 1
'The left argument. if specified, must be a Boolean or empty'⎕SIGNAL 11
:EndIf
:If 0=default
add' (y/n) '
:Else
:If default
add' (Y/n) '
:Else
add' (y/N) '
:EndIf
:EndIf
:If 1<question
((question)question)((question)question),add
questionquestion
:Else
questionquestion,add
:EndIf
:Repeat
question
answer
:If answerquestion Did... (since version 18.0 trailing blanks are not removed anynmore)
:OrIf (answer)=¯1+question ..the ...
:OrIf 0=answer ...user just...
dtb{-+/\' '=}
answer2dtb answer
:OrIf answer2((-answer2)(⎕UCS 10){~: ' ',dtb {1+}}question) ...press <enter>?
:If 0default
yesOrNodefault
isOkay1
:EndIf
:Else
answer¯1{-+/\' '=}answer
:If answer'YyNn'
isOkay1
yesOrNoanswer'Yy'
:EndIf
:EndIf
:Until isOkay
Done
2 changes: 0 additions & 2 deletions Make/Make.bat

This file was deleted.

Binary file added TestResults/CodeCoverage.dcf
Binary file not shown.
135 changes: 135 additions & 0 deletions TestResults/CodeCoverage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Coverage</title>
<meta charset="utf-8"/>
<style>
@media screen{
html {background-color: #FFFFF0;}
body {
font-size: 16px;
font-family : Verdana, "Bitstream Vera Sans", "DejaVu Sans", Tahoma, Geneva, Arial, Sans-serif;
margin: 1em;
}
th, td {padding: 5px 10px;}
th {text-align: left;}
h1, h2, h3, h4, h5, h6 {color: #424242;}
h1 {font-size: 22px;}
h2 {font-size: 18px; margin-top: 2em; margin-bottom:0.3em;}
tbody tr:nth-child(even) {background-color: #F0F0F0;}
tbody tr:nth-child(odd) {background-color: #FAFAFA;}
th {background-color: #E6E6E6;color: #424242;}
table {border: silver 1px solid; font-size: 14px;font-family: APLFont, monospace;}
code , code a {font-size: 14px; font-family: APLFont, monospace;}
code.header {
font-size: 16px;
font-family: APLFont, monospace;
margin: 1.5em 0.5em 0 0.5em;
padding:0;
display: block;
}
div.code-block {
border: 1px silver dashed;
background-color: #F2F2F2;
display: block;
margin: 0.5em 0.5em 0.5em 0.5em;
padding: 0.5em;
}
div.code-block code {display: block; white-space: pre-wrap; margin:0; padding:0; word-wrap: break-word;}
.emphasize { font-weight: 800;}
ul li, ol li {margin: 0.7em 0.2em;}
.float-right {float:right;}
.no-underline { text-decoration :none;}
.top-links {font-size:20px; padding-left: 0.6em;}
.align-right {text-align: right;}
#footer hr {margin-top:1.5em;}
#footer p {margin-top:5px; padding-top:0; font-size: 9px;}
@font-face {
font-family: "APLFont";
src:
local("APL385 Unicode"),
url("https://misc.aplteam.com/apl385.ttf") format("truetype");
}}
@media print{@page {size: portrait}
@page {
margin: 1cm 1cm 1cm 1.75cm;
@bottom-right {
content: counter(page) " / " counter(pages);
}
}
body {
font: 12pt "Times New Roman", Times, serif;
line-height: 1.2;
/* CSS3 filter, at the moment Webkit only. Prefix it for future implementations */
-webkit-filter: grayscale(100%);
filter: grayscale(100%); /* future-proof */
}
h1 {font-size: 18pt;}
h2 {font-size: 16pt; margin-top: 10pt; margin-bottom: 3pt;}
th, td {padding: 2pt 3pt;}
th {text-align: left;background-color: #DBDBDB;}
tbody tr:nth-child(odd) {background-color: #EDEDED;}
table {
color-adjust: exact !important;
-webkit-print-color-adjust: exact !important;
print-color-adjust: exact !important;
font-size: 8pt;
font-family: APLFont, monospace;
}
div.keep-together {break-inside: avoid; break-before:auto;}
table {border: silver 1pt solid;}
code , code a {font-size: 8pt; font-family: APLFont, monospace;}
code.header {
font-size: 8pt;
font-family: APLFont, monospace;
margin: 7pt 3pt 0 10pt;
padding:0;
display: block;
}
div.code-block {
border: 1pt silver dashed;
background-color: #F2F2F2;
display: block;
margin: 4pt 4pt 4pt 4pt;
padding: 4pt;
}
div.code-block code {display: block; white-space: pre-wrap; margin:0; padding:0; word-wrap: break-word;}
.emphasize { font-weight: 800;}
a {text-decoration: none;color: black;}
ul li, ol li {margin: 8pt 3pt;}
.no-print {display:none;}
.align-right {text-align: right;}
#footer hr {margin-top:1.5em;}
#footer p {margin-top:5pt; padding-top:0; font-size: 6pt;}
@font-face {
font-family: "APLFont";
src:
local("APL385 Unicode"),
url("https://misc.aplteam.com/apl385.ttf") format("truetype");
}}
</style>
</head>
<body>
<h1 id="top">Coverage Report</h1>
<p>Watched: 5 fns/opr within <code>#.EventCodes.EventCodes</code></p>
<p>Overall 91% of the testable code is covered.</p>
<p>(Comment lines, empty lines, all <code>:End</code>* lines etc. are all ignored)</p>
<p>3 of the fns/opr are 100% covered.</p>
<div id="partly-covered" class="keep-together">
<p>2 are partly covered:</p>
<table>
<thead>
<tr><th style="text-align:left;">Function/Operator</th><th style="text-align:left;">Lines not executed</th><th style="text-align:left;">Coverage</th><th style="text-align:right;"></th></tr>
</thead>
<tbody>
<tr><td>#.EventCodes.EventCodes.List</td><td>16,18</td><td>83%</td><td class="align-right">12</td></tr>
<tr><td>#.EventCodes.EventCodes.QEM</td><td>11</td><td>92%</td><td class="align-right">13</td></tr>
</tbody>
</table>
</div>
<div id="footer">
<hr>
<p>Created by "CodeCoverage" version 0.6.1.13 from 2020-09-16</p>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion acre.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"CaseCode": "Off",
"Open": "",
"ProjectSpace": "#.EventCodes",
"StartUp": ""
"StartUp": "Initialize"
}
1 change: 1 addition & 0 deletions apl-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ alias: "", api: "EventCodes", date: "2020-03-22", description: "Constants with meaningful names for Dyalog error codes", files: "", group: "aplteam", name: "EventCodes", project_url: "https://github.com/aplteam/EventCodes", source: "APLSource/EventCodes.aplc", tags: "aplteam;event-constants;windows;linux;mac-os", version: "2.0.0",}
Expand Down
2 changes: 1 addition & 1 deletion publish.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<tool name="EventCodes"> <version>2.0.0</version> <date>2020-03-22</date> <container>#.EventCodes</container> <needs> <script>APLTreeUtils</script> <script>FilesAndDirs</script> <script>OS</script> <script>WinReg</script> <script development="true">Tester2</script> </needs> <autoload>1</autoload> <buildid>15</buildid> <scriptOnly>1</scriptOnly> <package>1</package></tool>
<tool name="EventCodes"> <version>3.0.0</version> <date>2020-09-21</date> <container>#.EventCodes</container> <needs> <script development="true">APLTreeUtils2</script> <script development="true">FilesAndDirs</script> <script development="true">OS</script> <script development="true">WinReg</script> <script development="true">Tester2</script> <script development="true">CodeCoverage</script> </needs> <autoload>1</autoload> <buildid>16</buildid> <scriptOnly>1</scriptOnly> <package>1</package> <desc>Constants with meaningful names for Dyalog error codes</desc> <tags>apltree;event-constants;Windows;Linux;Mac-OS</tags></tool>
Expand Down

0 comments on commit bd3d018

Please sign in to comment.