Browse Source

Convert last "prog" exercises as functions exercises (intermediate commit)

content-update
Xavier Petit 4 years ago committed by xpetit
parent
commit
a68429ab87
  1. 4
      subjects/doppelgangerprog.en.md
  2. 4
      subjects/findprevprimeprog.en.md
  3. 14
      subjects/halfcontest.en.md
  4. 0
      subjects/slice.en.md
  5. 2
      tests/go/solutions/halfcontest.go
  6. 2
      tests/go/test_findprevprime.go
  7. 2
      tests/go/test_halfcontest.go
  8. 0
      tests/go/test_printrevcomb.go
  9. 0
      tests/go/test_reachablenumber.go
  10. 0
      tests/go/test_slice.go

4
subjects/doppelgangerprog.en.md

@ -18,9 +18,9 @@ func DoppelGanger(s, substr string) int {
package main
import (
piscine ".."
"fmt"
piscine ".."
)
func main() {

4
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() {

14
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))
}
```

0
subjects/sliceprog.en.md → subjects/slice.en.md

2
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

2
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)
}
}

2
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)
}
}

0
tests/go/solutions/printrevcomb/test_printrevcombprog.go → tests/go/test_printrevcomb.go

0
tests/go/solutions/reachablenumberprog/test_reachablenumberprog.go → tests/go/test_reachablenumber.go

0
tests/go/solutions/sliceprog/test_sliceprog.go → tests/go/test_slice.go

Loading…
Cancel
Save