Skip to content

Commit 9c13c16

Browse files
committed
Added triple
1 parent 65dc3df commit 9c13c16

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

batch/test.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ $Error.clear()
1313
Compare-Object (Get-Content "$PSScriptRoot\..\test\clockhands_expected") |
1414
Assert-MatchTests &&
1515
. "$PSScriptRoot\hello.bat" &&
16+
. "$PSScriptRoot\triple.bat" |
17+
Compare-Object (Get-Content "$PSScriptRoot\..\test\triple_expected") |
18+
Assert-MatchTests &&
1619
ForEach-Object 'foo'
1720

1821
if ($Error -or !$?) {

batch/triple.bat

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@ECHO OFF
2+
3+
FOR /L %%c IN (1, 1, 40) DO CALL :FIRST %%c
4+
GOTO :END
5+
6+
:FIRST
7+
FOR /L %%b IN (1, 1, %1) DO CALL :SECOND %1 %%b
8+
GOTO :END
9+
10+
:SECOND
11+
FOR /L %%a IN (1, 1, %2) DO CALL :THIRD %1 %2 %%a
12+
GOTO :END
13+
14+
:THIRD
15+
SET /A legs=%3 * %3 + %2 * %2
16+
SET /A hyp=%1*%1
17+
IF %legs% EQU %hyp% ECHO %3, %2, %1
18+
19+
:END

0 commit comments

Comments
 (0)