Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 11 additions & 20 deletions exercises/practice/raindrops/.meta/Example.bat
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
@echo off
SETLOCAL EnableDelayedExpansion

set "input=%~1"
set "result="

if "!input!"=="0" (
set "result=0"
) else (
if !input! gtr 0 (
if !input! lss 3 (
set "result=!input!"
) else (
set /a "mod3=!input! %% 3"
if !mod3!==0 set "result=Pling"
set /a "mod5=!input! %% 5"
if !mod5!==0 set "result=!result!Plang"
set /a "mod7=!input! %% 7"
if !mod7!==0 set "result=!result!Plong"
if not defined result set "result=%input%"
)
)
)
set /a "mod3=input %% 3"
if %mod3% EQU 0 set "result=Pling"

set /a "mod5=input %% 5"
if %mod5% EQU 0 set "result=%result%Plang"

set /a "mod7=input %% 7"
if %mod7% EQU 0 set "result=%result%Plong"

if not defined result set "result=%input%"

echo !result!
echo %result%
3 changes: 3 additions & 0 deletions exercises/practice/raindrops/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"authors": [
"GroophyLifefor"
],
"contributors": [
"BNAndras"
],
"files": {
"solution": [
"Raindrops.bat"
Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/raindrops/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ description = "the sound for 49 is Plong as it has a factor 7"
[17f2bc9a-b65a-4d23-8ccd-266e8c271444]
description = "the sound for 52 is 52"

[e46677ed-ff1a-419f-a740-5c713d2830e4]
description = "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7"

[13c6837a-0fcd-4b86-a0eb-20572f7deb0b]
description = "the sound for 3125 is Plang as it has a factor 5"
9 changes: 4 additions & 5 deletions exercises/practice/raindrops/RaindropsTest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ if "%1" == "test-runner" (
set "if_failed=the sound for 52 is 52."
CALL :Assert 52

REM TODO: fix the test case
REM set "expected=PlingPlangPlong"
REM set "if_success=Test passed"
REM set "if_failed=the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7."
REM CALL :Assert 105
set "expected=PlingPlangPlong"
set "if_success=Test passed"
set "if_failed=the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7."
CALL :Assert 105

set "expected=Plang"
set "if_success=Test passed"
Expand Down