Last active
March 26, 2021 14:44
-
-
Save mumunuu/9d4015a332bf6d4405d7d436611c89ea to your computer and use it in GitHub Desktop.
ultimate go 노션에 해당하는 모든 함수들 입니다.
This file contains 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 main | |
import ( | |
"fmt" | |
"math" | |
) | |
func main() { | |
fmt.Println(abs(-5)) | |
} | |
func abs(x float64) float64 { | |
return math.Abs(x) | |
} |
This file contains 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 main | |
import "testing" | |
func TestF1(t *testing.T) { | |
got := abs(-5.44) | |
if got != 5.44 { | |
t.Errorf("Abs(-5) = %F; want 5", got) | |
} | |
} | |
func TestNotF1(t *testing.T) { | |
got := abs(-5.44) | |
if got != 5.44 { | |
t.Errorf("Abs(-5) = %F; want 5", got) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment