-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TestIncrease should test func increase(int, int) int in main.go
- Loading branch information
郑海成
committed
Apr 26, 2022
1 parent
d618f27
commit 37dfb08
Showing
2 changed files
with
6 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
package main | ||
|
||
func main() { | ||
var a *int | ||
*a += 1 | ||
// DoOperation(1, increase) | ||
DoOperation(1, increase) | ||
DoOperation(1, decrease) | ||
} | ||
|
||
func increase(a, b int) int { | ||
println("increase result is:", a+b) | ||
return a + b | ||
} | ||
|
||
func DoOperation(y int, f func(int, int)) { | ||
func DoOperation(y int, f func(int, int) int) { | ||
f(y, 1) | ||
} | ||
|
||
func decrease(a, b int) { | ||
func decrease(a, b int) int { | ||
println("decrease result is:", a-b) | ||
return a - b | ||
} |
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
37dfb08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestIncrease should test func increase(int, int) int in main.go