diff --git a/subjects/doppelgangerprog.en.md b/subjects/doppelgangerprog.en.md index 5ba026ac..3df66594 100644 --- a/subjects/doppelgangerprog.en.md +++ b/subjects/doppelgangerprog.en.md @@ -17,18 +17,22 @@ func DoppelGanger(s, substr string) int { ```go package main -import "fmt" +import ( + piscine ".." + + "fmt" +) func main() { var result int - result = DoppelGanger("aaaaaaa", "a") + result = piscine.DoppelGanger("aaaaaaa", "a") fmt.Println(result) // 6 - result = DoppelGanger("qwerty", "t") + result = piscine.DoppelGanger("qwerty", "t") fmt.Println(result) // 4 - result = DoppelGanger("a", "b") + result = piscine.DoppelGanger("a", "b") fmt.Println(result) // -1 } ``` diff --git a/subjects/findprevprimeprog.en.md b/subjects/findprevprimeprog.en.md index 08643fac..c095ab1e 100644 --- a/subjects/findprevprimeprog.en.md +++ b/subjects/findprevprimeprog.en.md @@ -21,11 +21,15 @@ Here is a possible [program](TODO-LINK) to test your function : ```go package main -import "fmt" +import ( + piscine ".." + + "fmt" +) func main() { - fmt.Println(FindPrevPrime(5)) - fmt.Println(FindPrevPrime(4)) + fmt.Println(piscine.FindPrevPrime(5)) + fmt.Println(piscine.FindPrevPrime(4)) } ``` diff --git a/subjects/halfcontestprog.en.md b/subjects/halfcontest.en.md similarity index 100% rename from subjects/halfcontestprog.en.md rename to subjects/halfcontest.en.md diff --git a/subjects/printrevcombprog.en.md b/subjects/printrevcomb.en.md similarity index 100% rename from subjects/printrevcombprog.en.md rename to subjects/printrevcomb.en.md diff --git a/subjects/reachablenumberprog.en.md b/subjects/reachablenumber.en.md similarity index 100% rename from subjects/reachablenumberprog.en.md rename to subjects/reachablenumber.en.md diff --git a/subjects/sliceprog.en.md b/subjects/sliceprog.en.md index 86edbe49..9ca8ffe3 100644 --- a/subjects/sliceprog.en.md +++ b/subjects/sliceprog.en.md @@ -2,7 +2,7 @@ ### Instructions -Write a **function** that replicates the javascript function `slice`. +Write a **function** that replicates the JavaScript function `slice`. The function receives a slice of strings and one or more integers, and returns a slice of strings. The returned slice is part of the received one but cut from the position indicated in the first int, until the position indicated by the second int. @@ -25,24 +25,28 @@ Here is a possible program to test your function : ```go package main -import "fmt" +import ( + "fmt" + + piscine ".." +) func main(){ a := []string{"coding", "algorithm", "ascii", "package", "golang"} - fmt.Println(Slice(a, 1)) - fmt.Println(Slice(a, 2, 4)) - fmt.Println(Slice(a, -3)) - fmt.Println(Slice(a, -2, -1)) - fmt.Println(Slice(a, 2, 0)) + fmt.Printf("%#v\n", piscine.Slice(a, 1)) + fmt.Printf("%#v\n", piscine.Slice(a, 2, 4)) + fmt.Printf("%#v\n", piscine.Slice(a, -3)) + fmt.Printf("%#v\n", piscine.Slice(a, -2, -1)) + fmt.Printf("%#v\n", piscine.Slice(a, 2, 0)) } ``` ```console student@ubuntu:~/student/test$ go build student@ubuntu:~/student/test$ ./test -[algorithm ascii package golang] -[ascii package] -[ascii package golang] -[package] -[] +[]string{"algorithm", "ascii", "package", "golang"} +[]string{"ascii", "package"} +[]string{"ascii", "package", "golang"} +[]string{"package"} +[]string(nil) ``` diff --git a/tests/go/solutions/printrevcombprog/main.go b/tests/go/solutions/printrevcomb/main.go similarity index 100% rename from tests/go/solutions/printrevcombprog/main.go rename to tests/go/solutions/printrevcomb/main.go diff --git a/tests/go/solutions/printrevcombprog/test_printrevcombprog.go b/tests/go/solutions/printrevcomb/test_printrevcombprog.go similarity index 100% rename from tests/go/solutions/printrevcombprog/test_printrevcombprog.go rename to tests/go/solutions/printrevcomb/test_printrevcombprog.go diff --git a/tests/go/solutions/sliceprog/test_sliceprog.go b/tests/go/solutions/sliceprog/test_sliceprog.go index 7064d708..02d32098 100644 --- a/tests/go/solutions/sliceprog/test_sliceprog.go +++ b/tests/go/solutions/sliceprog/test_sliceprog.go @@ -41,6 +41,6 @@ func main() { } for _, a := range arr { - z01.Challenge("SliceProg", student.Slice, correct.Slice, a...) + z01.Challenge("Slice", student.Slice, correct.Slice, a...) } } diff --git a/tests/go/solutions/doppelgangerprog/test_doppelgangerprog.go b/tests/go/test_doppelganger.go similarity index 100% rename from tests/go/solutions/doppelgangerprog/test_doppelgangerprog.go rename to tests/go/test_doppelganger.go diff --git a/tests/go/solutions/findprevprimeprog/test_findprevprimeprog.go b/tests/go/test_findprevprime.go similarity index 100% rename from tests/go/solutions/findprevprimeprog/test_findprevprimeprog.go rename to tests/go/test_findprevprime.go diff --git a/tests/go/solutions/halfcontestprog/test_halfcontestprog.go b/tests/go/test_halfcontest.go similarity index 100% rename from tests/go/solutions/halfcontestprog/test_halfcontestprog.go rename to tests/go/test_halfcontest.go