From a68429ab87fe87c6312cf56b5120f1c3c82751f8 Mon Sep 17 00:00:00 2001 From: Xavier Petit <32063953+xpetit@users.noreply.github.com> Date: Sun, 26 Apr 2020 17:10:53 +0200 Subject: [PATCH] Convert last "prog" exercises as functions exercises (intermediate commit) --- subjects/doppelgangerprog.en.md | 4 ++-- subjects/findprevprimeprog.en.md | 4 ++-- subjects/halfcontest.en.md | 14 +++++++++----- subjects/{sliceprog.en.md => slice.en.md} | 0 tests/go/solutions/halfcontest.go | 2 +- tests/go/test_findprevprime.go | 2 +- tests/go/test_halfcontest.go | 2 +- ...st_printrevcombprog.go => test_printrevcomb.go} | 0 ...chablenumberprog.go => test_reachablenumber.go} | 0 .../sliceprog/test_sliceprog.go => test_slice.go} | 0 10 files changed, 16 insertions(+), 12 deletions(-) rename subjects/{sliceprog.en.md => slice.en.md} (100%) rename tests/go/{solutions/printrevcomb/test_printrevcombprog.go => test_printrevcomb.go} (100%) rename tests/go/{solutions/reachablenumberprog/test_reachablenumberprog.go => test_reachablenumber.go} (100%) rename tests/go/{solutions/sliceprog/test_sliceprog.go => test_slice.go} (100%) diff --git a/subjects/doppelgangerprog.en.md b/subjects/doppelgangerprog.en.md index 3df66594d..4a0eba06f 100644 --- a/subjects/doppelgangerprog.en.md +++ b/subjects/doppelgangerprog.en.md @@ -18,9 +18,9 @@ func DoppelGanger(s, substr string) int { package main import ( - piscine ".." - "fmt" + + piscine ".." ) func main() { diff --git a/subjects/findprevprimeprog.en.md b/subjects/findprevprimeprog.en.md index c095ab1ec..2eef05381 100644 --- a/subjects/findprevprimeprog.en.md +++ b/subjects/findprevprimeprog.en.md @@ -22,9 +22,9 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - piscine ".." - "fmt" + + piscine ".." ) func main() { diff --git a/subjects/halfcontest.en.md b/subjects/halfcontest.en.md index f42b3435f..c51b5f9f4 100644 --- a/subjects/halfcontest.en.md +++ b/subjects/halfcontest.en.md @@ -13,7 +13,7 @@ Contest cannot finish before it was started. ### Expected function ```go -func Halfcontest(h1, m1, h2, m2 int) int { +func HalfContest(h1, m1, h2, m2 int) int { } ``` @@ -25,12 +25,16 @@ Here is a possible program to test your function : ```go package main -import "fmt" +import ( + "fmt" + + piscine ".." +) func main() { - fmt.Println(Halfcontest(1, 15, 3, 33)) - fmt.Println(Halfcontest(10, 3, 11, 55)) - fmt.Println(Halfcontest(9, 2, 11, 3)) + fmt.Println(piscine.HalfContest(1, 15, 3, 33)) + fmt.Println(piscine.HalfContest(10, 3, 11, 55)) + fmt.Println(piscine.HalfContest(9, 2, 11, 3)) } ``` diff --git a/subjects/sliceprog.en.md b/subjects/slice.en.md similarity index 100% rename from subjects/sliceprog.en.md rename to subjects/slice.en.md diff --git a/tests/go/solutions/halfcontest.go b/tests/go/solutions/halfcontest.go index 2448ddeec..159b8b454 100644 --- a/tests/go/solutions/halfcontest.go +++ b/tests/go/solutions/halfcontest.go @@ -1,6 +1,6 @@ package correct -func Halfcontest(h1, m1, h2, m2 int) int { +func HalfContest(h1, m1, h2, m2 int) int { t1 := h1*60 + m1 t2 := h2*60 + m2 t2 = (t2 + t1) / 2 diff --git a/tests/go/test_findprevprime.go b/tests/go/test_findprevprime.go index 871cb98b1..2144e7570 100644 --- a/tests/go/test_findprevprime.go +++ b/tests/go/test_findprevprime.go @@ -10,6 +10,6 @@ import ( func main() { a := append(z01.MultRandIntBetween(0, 99999), 5, 4, 1) for _, elem := range a { - z01.Challenge("FindPrevPrimeProg", student.FindPrevPrime, correct.FindPrevPrime, elem) + z01.Challenge("FindPrevPrime", student.FindPrevPrime, correct.FindPrevPrime, elem) } } diff --git a/tests/go/test_halfcontest.go b/tests/go/test_halfcontest.go index 95869be5e..f901405f5 100644 --- a/tests/go/test_halfcontest.go +++ b/tests/go/test_halfcontest.go @@ -29,6 +29,6 @@ func main() { } for _, arg := range table { - z01.Challenge("HalfContestProg", student.Halfcontest, correct.Halfcontest, arg.h1, arg.m1, arg.h2, arg.m2) + z01.Challenge("HalfContest", student.HalfContest, correct.HalfContest, arg.h1, arg.m1, arg.h2, arg.m2) } } diff --git a/tests/go/solutions/printrevcomb/test_printrevcombprog.go b/tests/go/test_printrevcomb.go similarity index 100% rename from tests/go/solutions/printrevcomb/test_printrevcombprog.go rename to tests/go/test_printrevcomb.go diff --git a/tests/go/solutions/reachablenumberprog/test_reachablenumberprog.go b/tests/go/test_reachablenumber.go similarity index 100% rename from tests/go/solutions/reachablenumberprog/test_reachablenumberprog.go rename to tests/go/test_reachablenumber.go diff --git a/tests/go/solutions/sliceprog/test_sliceprog.go b/tests/go/test_slice.go similarity index 100% rename from tests/go/solutions/sliceprog/test_sliceprog.go rename to tests/go/test_slice.go