Skip to content
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

from appveyor to sourceforge #128

Merged
merged 33 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4eb28c9
from appveyor to sourceforge
axtens Apr 18, 2024
f349168
different server
axtens Apr 18, 2024
47614a9
7z
axtens Apr 18, 2024
f08fff6
7z
axtens Apr 18, 2024
d0156c4
yaml issue fixed
axtens Apr 18, 2024
8a50e5b
slashes
axtens Apr 18, 2024
d7d9c8b
7z oddities
axtens Apr 18, 2024
6096670
directories
axtens Apr 18, 2024
b176cae
$HOME ?
axtens Apr 19, 2024
def366c
atbash tweak
axtens Apr 19, 2024
6413083
cache management fix
axtens Apr 19, 2024
ecc67c6
commented out extraneous DISPLAY in proof.ci.cob files
axtens Apr 19, 2024
6a34367
eol issue
axtens Apr 19, 2024
ce37afc
line ends fixed
axtens Apr 19, 2024
f9bb67d
strangenesses
axtens Apr 19, 2024
89bbccd
SPACE instead of "" in CUT files
axtens Apr 19, 2024
4a5e1e2
Trim additional line
ErikSchierboom Apr 19, 2024
25ee6b2
Merge remote-tracking branch 'origin/main' into appveyor
ErikSchierboom Apr 19, 2024
94b78e3
Debug
ErikSchierboom Apr 19, 2024
e59d0c6
Try simplify environment variables
ErikSchierboom Apr 19, 2024
7d23961
More debugging
ErikSchierboom Apr 19, 2024
3191b38
More tweaking
ErikSchierboom Apr 19, 2024
104d602
Fix path
ErikSchierboom Apr 19, 2024
076a331
Fix path
ErikSchierboom Apr 19, 2024
79277b1
Fix path
ErikSchierboom Apr 19, 2024
f111ee1
Fix env
ErikSchierboom Apr 19, 2024
a0226da
Streamline
ErikSchierboom Apr 19, 2024
701ac83
eof is lf
axtens Apr 19, 2024
fdd5893
acronym
axtens Apr 19, 2024
9c2fb8b
acronym
axtens Apr 19, 2024
ca1c9ff
sqrt
axtens Apr 19, 2024
6e684a6
Fix paths
ErikSchierboom Apr 19, 2024
9e729fd
Fix cache path
ErikSchierboom Apr 19, 2024
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
21 changes: 6 additions & 15 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
id: cache-gnu-cobol
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: ~\gnucobol-3.2-dev.zip
path: $HOME\gnucobol-3.2.7z
key: ${{ runner.os }}-gnu-cobol-3.2

- name: Download GnuCOBOL
Expand All @@ -45,27 +45,18 @@ jobs:
MaximumRetryCount = 3
RetryIntervalSec = 1
}
Invoke-WebRequest -Uri 'https://ci.appveyor.com/api/projects/GitMensch/gnucobol-3-x-win32-posix/artifacts/gnucobol-3.2-dev-MinGW-binaries%20(debug).zip?job=Environment:%20BUILD_TYPE=MSYS,%20BUILD_BIN=C:\MinGW\msys\1.0\bin' -OutFile ~\gnucobol-3.2-dev.zip @requestOpts
Invoke-WebRequest -Uri 'https://www.arnoldtrembley.com/GC32-BDB-SP1-rename-7z-to-exe.7z' -OutFile $HOME\gnucobol-3.2.7z @requestOpts

- name: Extract GnuCOBOL
shell: pwsh
run: Expand-Archive ~\gnucobol-3.2-dev.zip -DestinationPath gnucobol -Force
run: 7z x $HOME\gnucobol-3.2.7z -ognucobol -y

- name: Fetch CobolCheck
shell: pwsh
run: bin/fetch-cobolcheck.ps1

- name: Setup environment
shell: pwsh
run: |
$env:Path = "D:\a\cobol\cobol\gnucobol\bin;$HOME\bin;" + $env:Path
[System.Environment]::SetEnvironmentVariable('COB_CONFIG_DIR', 'D:\a\cobol\cobol\gnucobol\config')
[System.Environment]::SetEnvironmentVariable('COB_COPY_DIR', 'D:\a\cobol\cobol\gnucobol\copy')
[System.Environment]::SetEnvironmentVariable('COB_CFLAGS', '-I D:\a\cobol\cobol\gnucobol\include')
[System.Environment]::SetEnvironmentVariable('COB_LDFLAGS', '-L D:\a\cobol\cobol\gnucobol\lib')
[System.Environment]::SetEnvironmentVariable('COB_LIBRARY_PATH', 'D:\a\cobol\cobol\gnucobol\lib')
[System.Environment]::SetEnvironmentVariable('COB_LIBS', 'D:\a\cobol\cobol\gnucobol\bin\libcob-4.dll')

- name: Run tests for all exercises
shell: pwsh
run: bin/test.ps1
run: |
bin/setup-environment.ps1
bin/test.ps1
4 changes: 1 addition & 3 deletions bin/fetch-cobolcheck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ Function Get-DownloadUrl {
}

$downloadUrl = Get-DownloadUrl
$outputDir = Join-Path -Path $HOME -ChildPath "bin"
$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe"
New-Item -ItemType Directory -Force -Path $outputDir | Out-Null
$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe"
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts
7 changes: 7 additions & 0 deletions bin/setup-environment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$env:Path = "${env:GITHUB_WORKSPACE}\gnucobol\bin;${env:GITHUB_WORKSPACE}\bin;${env:Path}"
[System.Environment]::SetEnvironmentVariable('COB_CONFIG_DIR', "${env:GITHUB_WORKSPACE}\gnucobol\config")
[System.Environment]::SetEnvironmentVariable('COB_COPY_DIR', "${env:GITHUB_WORKSPACE}\gnucobol\copy")
[System.Environment]::SetEnvironmentVariable('COB_CFLAGS', "-I ${env:GITHUB_WORKSPACE}\gnucobol\include")
[System.Environment]::SetEnvironmentVariable('COB_LDFLAGS', "-L ${env:GITHUB_WORKSPACE}\gnucobol\lib")
[System.Environment]::SetEnvironmentVariable('COB_LIBRARY_PATH', "${env:GITHUB_WORKSPACE}\gnucobol\lib")
[System.Environment]::SetEnvironmentVariable('COB_LIBS', "${env:GITHUB_WORKSPACE}\gnucobol\bin\libcob-4.dll")
4 changes: 1 addition & 3 deletions exercises/practice/acronym/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
EVALUATE CHAR
WHEN "_"
CONTINUE
WHEN " "
WHEN SPACE
MOVE 1 TO PICKNEXT
CONTINUE
WHEN "-"
Expand All @@ -48,5 +48,3 @@
ADD 1 TO LEN
END-PERFORM.
COMPUTE LEN = 80 - LEN.


44 changes: 42 additions & 2 deletions exercises/practice/acronym/src/acronym.cob
Original file line number Diff line number Diff line change
@@ -1,10 +1,50 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. ACRONYM.
PROGRAM-ID. acronym.
AUTHOR. kapitaali.
ENVIRONMENT DIVISION.
DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.
01 WS-ACRONYM PIC X(80).
01 WS-RESULT PIC X(20).

01 LEN PIC 99.
01 PICKNEXT PIC 9.
01 COUNTER PIC 99.
01 IDX PIC 99.
01 CHAR PIC X.

PROCEDURE DIVISION.
ABBREVIATE.
PERFORM STR-LENGTH.
MOVE 1 TO IDX.
MOVE SPACES TO WS-RESULT.
MOVE 1 TO PICKNEXT.
PERFORM VARYING COUNTER FROM 1 BY 1 UNTIL COUNTER = LEN
MOVE WS-ACRONYM(COUNTER:1) TO CHAR
EVALUATE CHAR
WHEN "_"
CONTINUE
WHEN SPACE
MOVE 1 TO PICKNEXT
CONTINUE
WHEN "-"
MOVE 1 TO PICKNEXT
CONTINUE
WHEN OTHER
IF PICKNEXT = 1
MOVE FUNCTION UPPER-CASE(CHAR)
TO WS-RESULT(IDX:1)
ADD 1 TO IDX
END-IF
MOVE 0 TO PICKNEXT
END-PERFORM.

STR-LENGTH.
MOVE 0 TO LEN.
MOVE FUNCTION LENGTH(WS-ACRONYM) TO IDX.
PERFORM VARYING IDX FROM FUNCTION LENGTH(WS-ACRONYM)
BY -1 UNTIL WS-ACRONYM(IDX:1) <> " "
ADD 1 TO LEN
END-PERFORM.
COMPUTE LEN = 80 - LEN.
1 change: 0 additions & 1 deletion exercises/practice/all-your-base/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,3 @@
MOVE WS-RESULT TO WS-DIGITS.
PERFORM STR-LENGTH.
MOVE SPACES TO WS-RESULT(LEN:1).

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TestCase "15-bit integer"
TestCase "empty list"
MOVE 2 TO WS-INPUTBASE
MOVE 10 TO WS-OUTPUTBASE
MOVE "" TO WS-DIGITS
MOVE SPACE TO WS-DIGITS
PERFORM REBASE
EXPECT WS-RESULT = "0"

Expand Down Expand Up @@ -97,7 +97,7 @@ TestCase "input base is one"
TestCase "input base is zero"
MOVE 0 TO WS-INPUTBASE
MOVE 10 TO WS-OUTPUTBASE
MOVE "" TO WS-DIGITS
MOVE SPACE TO WS-DIGITS
PERFORM REBASE
EXPECT WS-ERROR = "input base must be >= 2"

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/allergies/tst/allergies/allergies.cut
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ TestCase "cats: allergic to everything",
TestCase "list when: no allergies"
MOVE 0 TO WS-SCORE
PERFORM LIST-ALLERGENS
EXPECT WS-RESULT-LIST = ""
EXPECT WS-RESULT-LIST = SPACE

TestCase "list when: just eggs"
MOVE 1 TO WS-SCORE
Expand Down
5 changes: 3 additions & 2 deletions exercises/practice/armstrong-numbers/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
MOVE 0 TO WS-RESULT
END-IF.

DISPLAY WS-ARMSTRONG.
DISPLAY WS-NUMBER.
* DISPLAY WS-ARMSTRONG.
* DISPLAY WS-NUMBER.

4 changes: 2 additions & 2 deletions exercises/practice/atbash-cipher/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
WORKING-STORAGE SECTION.
01 WS-PHRASE PIC X(60).
01 WS-RESULT PIC X(60).
01 ABC PIC X(36) VALUES "abcdefghijklmnopqrstuvwxyz0123456789".
01 ZYX PIC X(36) VALUES "zyxwvutsrqponmlkjihgfedcba0123456789".
01 ABC PIC X(36) VALUE "abcdefghijklmnopqrstuvwxyz0123456789".
01 ZYX PIC X(36) VALUE "zyxwvutsrqponmlkjihgfedcba0123456789".
01 COUNTER PIC 999.
01 LEN PIC 999.
01 IDX PIC 999.
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/binary/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
MOVE CHAR-ERROR TO WS-ERROR
NEXT SENTENCE
END-IF
END-PERFORM.
END-PERFORM.
2 changes: 1 addition & 1 deletion exercises/practice/bob/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@
MOVE "Whatever." TO WS-RESULT
END-IF
END-EVALUATE
END-IF.
END-IF.
2 changes: 1 addition & 1 deletion exercises/practice/bob/tst/bob/bob.cut
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TestCase "prattling on"
EXPECT WS-RESULT = "Sure."

TestCase "silence"
MOVE "" TO WS-HEYBOB
MOVE SPACE TO WS-HEYBOB
PERFORM BOB
EXPECT WS-RESULT = "Fine. Be that way!"

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/collatz-conjecture/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
ADD 1 TO WS-STEPS
END-PERFORM.

DISPLAY WS-STEPS.
DISPLAY WS-ERROR.
*DISPLAY WS-STEPS.
*DISPLAY WS-ERROR.
12 changes: 6 additions & 6 deletions exercises/practice/complex-numbers/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
COMPUTE RESULT-IM = Z1-IM * Z2-RE + Z1-RE * Z2-IM.

C-DIV.
DISPLAY "Z1 (" Z1-RE "," Z1-IM ") Z2 (" Z2-RE "," Z2-IM ")".
* DISPLAY "Z1 (" Z1-RE "," Z1-IM ") Z2 (" Z2-RE "," Z2-IM ")".
COMPUTE TEMP = Z2-RE * Z2-RE + Z2-IM * Z2-IM.
DISPLAY "TEMP " TEMP.
* DISPLAY "TEMP " TEMP.
COMPUTE RESULT-RE = Z1-RE * Z2-RE + Z1-IM * Z2-IM.
COMPUTE RESULT-RE = RESULT-RE / TEMP.
DISPLAY "RESULT-RE " RESULT-RE.
* DISPLAY "RESULT-RE " RESULT-RE.
COMPUTE RESULT-IM = Z1-IM * Z2-RE - Z1-RE * Z2-IM.
DISPLAY Z1-IM "*" Z2-RE "-" Z1-RE "*" Z2-IM.
DISPLAY "= " RESULT-IM " / TEMP=" TEMP.
* DISPLAY Z1-IM "*" Z2-RE "-" Z1-RE "*" Z2-IM.
* DISPLAY "= " RESULT-IM " / TEMP=" TEMP.
COMPUTE RESULT-IM = RESULT-IM / TEMP.
DISPLAY "RESULT-IM " RESULT-IM.
* DISPLAY "RESULT-IM " RESULT-IM.

C-ABS.
MOVE 0 TO RESULT-IM.
Expand Down
6 changes: 3 additions & 3 deletions exercises/practice/difference-of-squares/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
WS-SQUARE-OF-SUM - WS-SUM-OF-SQUARES.

SHOW-RESULTS.
DISPLAY WS-SQUARE-OF-SUM.
DISPLAY WS-SUM-OF-SQUARES.
DISPLAY WS-DIFFERENCE-OF-SQUARES.
*DISPLAY WS-SQUARE-OF-SUM.
*DISPLAY WS-SUM-OF-SQUARES.
*DISPLAY WS-DIFFERENCE-OF-SQUARES.

4 changes: 2 additions & 2 deletions exercises/practice/hamming/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@

END-PERFORM.

DISPLAY "Hamming Distance is: " WS-HAMMING.
DISPLAY WS-ERROR.
*DISPLAY "Hamming Distance is: " WS-HAMMING.
*DISPLAY WS-ERROR.
1 change: 0 additions & 1 deletion exercises/practice/hello-world/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
HELLO-WORLD.
MOVE "Hello, World!" TO WS-RESULT.


2 changes: 1 addition & 1 deletion exercises/practice/luhn/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
MOVE "FALSE" TO WS-VALID
END-IF.

DISPLAY WS-VALID.
*DISPLAY WS-VALID.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TestCase "paired square brackets"
EXPECT WS-RESULT = 1

TestCase "empty string"
MOVE "" TO WS-INPUT
MOVE SPACE TO WS-INPUT
PERFORM ISPAIRED
EXPECT WS-RESULT = 1

Expand Down
10 changes: 5 additions & 5 deletions exercises/practice/nucleotide-count/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
END-EVALUATE
END-PERFORM.

DISPLAY "A: " WS-A.
DISPLAY "C: " WS-C.
DISPLAY "G: " WS-G.
DISPLAY "T: " WS-T.
DISPLAY WS-ERROR.
*DISPLAY "A: " WS-A.
*DISPLAY "C: " WS-C.
*DISPLAY "G: " WS-G.
*DISPLAY "T: " WS-T.
*DISPLAY WS-ERROR.
2 changes: 1 addition & 1 deletion exercises/practice/raindrops/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
MOVE WS-NUMBER TO WS-RESULT
END-IF.

DISPLAY WS-RESULT.
*DISPLAY WS-RESULT.
2 changes: 1 addition & 1 deletion exercises/practice/reverse-string/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
MOVE FUNCTION TRIM(WS-STRING LEADING)
TO WS-STRING.

DISPLAY WS-STRING.
*DISPLAY WS-STRING.
2 changes: 1 addition & 1 deletion exercises/practice/rna-transcription/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
INSPECT WS-COMPLEMENT CONVERTING WS-DNA
TO WS-RNA.

DISPLAY WS-COMPLEMENT.
*DISPLAY WS-COMPLEMENT.
1 change: 0 additions & 1 deletion exercises/practice/roman-numerals/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@
ALL "c" BY COLUMN-LETTER-CHARACTERS(3).
MAKE-ROMAN-EXIT.
EXIT.

4 changes: 2 additions & 2 deletions exercises/practice/rotational-cipher/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
TO WS-CIPHER (WS-CHAR-INDEX:1)
END-PERFORM.

DISPLAY "Plain: " WS-TEXT.
DISPLAY "Cipher: " WS-CIPHER.
*DISPLAY "Plain: " WS-TEXT.
*DISPLAY "Cipher: " WS-CIPHER.
2 changes: 1 addition & 1 deletion exercises/practice/scrabble-score/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
END-IF

SET LETTER-INDEX UP BY 1
END-PERFORM.
END-PERFORM.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TestCase "english-like word"
EXPECT WS-RESULT = 8

TestCase "empty input"
MOVE "" TO WS-WORD
MOVE SPACE TO WS-WORD
PERFORM SCRABBLE-SCORE
EXPECT WS-RESULT = 0

Expand Down
4 changes: 1 addition & 3 deletions exercises/practice/square-root/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@

PROCEDURE DIVISION.
SQUARE-ROOT.
COMPUTE WS-SQRT = WS-NUMBER ** .5

DISPLAY WS-SQRT.
COMPUTE WS-SQRT = WS-NUMBER ** 0.5.
1 change: 0 additions & 1 deletion exercises/practice/square-root/src/square-root.cob
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@

PROCEDURE DIVISION.
SQUARE-ROOT.

1 change: 0 additions & 1 deletion exercises/practice/yacht/.meta/proof.ci.cob
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,3 @@
END-PERFORM.
BUBBLE-SORT-EXIT.
EXIT.

Loading