Created
November 28, 2015 11:33
-
-
Save cimadai/5d1a1569626b1a76f425 to your computer and use it in GitHub Desktop.
drone.io用のサンプルコード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sample | |
func Sum(xs ...int) (s int) { | |
for _, x := range xs { | |
s += x | |
} | |
return | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sample | |
import "testing" | |
func TestSum(t *testing.T) { | |
expect := 55 | |
actual := Sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | |
if actual != expect { | |
t.Errorf(`expect="%d" actual="%d"`, expect, actual) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment