當前位置: 首頁>>代碼示例>>Golang>>正文


Golang wc.Test函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。