本文整理汇总了Golang中golang.org/x/tour/wc.Test函数的典型用法代码示例。如果您正苦于以下问题:Golang Test函数的具体用法?Golang Test怎么用?Golang Test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Test函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
fmt.Println("### Start Map Exercise ###")
wc.Test(WordCount)
fmt.Println("### End Map Exercise ###")
}
开发者ID:tomoyan,项目名称:go_tour_exercise,代码行数:7,代码来源:exercise_maps.go
示例2: main
func main() {
pointers()
structs()
arrays()
slices()
ranges()
//pic.Show(Pic) // Note: This will print a base64 encoded image.
maps()
wc.Test(WordCount)
closures()
}
开发者ID:traplol,项目名称:learning-go,代码行数:11,代码来源:pt3.go
示例3: main
func main() {
pointer()
v := Vertex{1, 2}
v.X = 4
fmt.Println(v)
p := &v
p.X = 1e9
fmt.Println(v)
structLiterals()
array()
slice()
tictactoe()
slicing()
makeslice()
zeroSlice()
appendSlice()
ranges()
pic.Show(Pic)
var vLL = VertexLL{40.68433, -74.39967}
geography("Bell Labs", vLL)
fmt.Println(m["Bell Labs"])
vLL = VertexLL{37.4828, 122.2361}
geography("Redwood City", vLL)
fmt.Println(m["Redwood City"])
fmt.Println(m)
mutateMap()
wc.Test(WordCount)
fmt.Println(hypot(5, 12))
fmt.Println(compute(hypot))
fmt.Println(compute(math.Pow))
exAdder()
f := fibonacci()
for i := 0; i < 10; i++ {
fmt.Println(f())
}
}
开发者ID:happyspace,项目名称:gofun,代码行数:48,代码来源:pointer.go
示例4: ExerciseMaps
func ExerciseMaps() {
wc.Test(WordCount)
}
开发者ID:szkkentaro,项目名称:golang-study,代码行数:3,代码来源:exercise_maps.go
示例5: main
func main() {
wc.Test(WordCount)
}
开发者ID:pythonboys,项目名称:tour,代码行数:3,代码来源:exercise-maps.go
示例6: testWordCount
func testWordCount() {
wc.Test(WordCount)
}
开发者ID:paulweb515,项目名称:learning,代码行数:3,代码来源:hello.go
示例7: main
//.........这里部分代码省略.........
a2 = append(a2, 0)
printSlice("a2", a2)
// the slice grows as needed.
a2 = append(a2, 1)
printSlice("a2", a2)
// we can add more than one element at a time.
a2 = append(a2, 2, 3, 4)
printSlice("a2", a2)
// range
for i, v := range pow2 {
fmt.Printf("2**%d = %d\n", i, v)
}
pow3 := make([]int, 10)
for i := range pow3 {
pow3[i] = 1 << uint(i)
}
for _, value := range pow3 {
fmt.Printf("%d\n", value)
}
pic.Show(Pic)
// Maps
map1 = make(map[string]LocationCoordinate)
map1["Bell Labs"] = LocationCoordinate{
40.68433, -74.39967,
}
fmt.Println(map1["Bell Labs"])
fmt.Println(map1)
fmt.Println(map2)
//Mutating Maps
map3 := make(map[string]int)
map3["Answer"] = 42
fmt.Println("The value:", map3["Answer"])
v6, ok1 := map3["Answer"]
fmt.Println("The value:", v6, "Present?", ok1)
map3["Answer"] = 48
fmt.Println("The value:", map3["Answer"])
delete(map3, "Answer")
fmt.Println("The value:", map3["Answer"])
v6, ok2 := map3["Answer"]
fmt.Println("The value:", v6, "Present?", ok2)
// map exercise
wc.Test(WordCount)
//functions arevalues too
hypot := func(x, y float64) float64 {
return math.Sqrt(x*x + y*y)
}
fmt.Println(hypot(3, 4))
pos, neg := adder(), adder()
for i := 0; i < 10; i++ {
fmt.Println(
pos(i),
neg(-2*i),
)
}
fib := fibonacci()
for i := 0; i < 10; i++ {
fmt.Println(fib())
}
v7 := &FloatVertex{3, 4}
fmt.Println("FloatVertex", v7.Abs())
f1 := MyFloat(-math.Sqrt2)
fmt.Println(f1.Abs())
v8 := &FloatVertex{3, 4}
v8.Scale(5)
fmt.Println(v8, v8.Abs())
runInterface()
runImplicitInterface()
runStringer()
runErrors()
go say("world")
say("hello")
runGoRoutine()
runBufferedChannel()
runRangeAndClose()
runFibonacci3()
runDefaultSelection()
}
开发者ID:trsathya,项目名称:go,代码行数:101,代码来源:sandbox.go
示例8: ExecWc
func ExecWc() {
wc.Test(WordCount)
}
开发者ID:yu81,项目名称:go-sandbox,代码行数:3,代码来源:maps.go
示例9: TestExerciseMaps
func TestExerciseMaps(t *testing.T) {
wc.Test(WordCount)
}
开发者ID:matijavizintin,项目名称:tour-of-go,代码行数:3,代码来源:maps_test.go
示例10: main
func main() {
wc.Test(WordCount)
fmt.Println(WordCount(" Stas Stas stas "))
}
开发者ID:svr93,项目名称:go_examples,代码行数:5,代码来源:word-count.go
注:本文中的golang.org/x/tour/wc.Test函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论