feat: add even number problem

master
sundowndev 2020-12-09 13:09:50 +04:00
parent 0df7a369b7
commit cb7b3d0ed6
5 changed files with 35 additions and 3 deletions

View File

@ -17,4 +17,4 @@ jobs:
uses: actions/checkout@v2
- name: Test
run: go test -race -v -bench=. ./...
run: go test -race -v ./...

View File

@ -1,6 +1,5 @@
package camelcase
func Camelcase(s string) string {
return s
return s
}

5
even/even.go Normal file
View File

@ -0,0 +1,5 @@
package even
func isEven(n int) bool {
return n%2 == 0
}

22
even/even_test.go Normal file
View File

@ -0,0 +1,22 @@
package even
import "testing"
func TestEven(t *testing.T) {
suite := map[int]bool{
2: true,
1: false,
824: true,
200: true,
52: true,
1785616589187: false,
0: true,
100000000000000000: true,
}
for k, v := range suite {
if output := isEven(k); output != v {
t.Errorf("input: %d - expected: %v, got: %v", k, v, output)
}
}
}

6
even/readme.txt Normal file
View File

@ -0,0 +1,6 @@
Given a number N, return a boolean that tells whether N is a even number or not.
Example:
isEven(2) = true
isEven(7) = false