Skip to content

Commit 4c9d371

Browse files
codingsince1985jameswpm
authored andcommitted
typo fixed
1 parent 45224ab commit 4c9d371

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

en/11.3.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The above output shows in detail the results of our test. We see that the test f
9292
}
9393
}
9494

95-
We execute `go test-v` once again. The following information should now be displayed -the test suite has passed~:
95+
We execute `go test -v` once again. The following information should now be displayed -the test suite has passed~:
9696

9797
=== RUN Test_Division_1
9898
--- PASS: Test_Division_1 (0.00 seconds)
@@ -105,14 +105,14 @@ We execute `go test-v` once again. The following information should now be displ
105105

106106
## How to write stress tests
107107

108-
Stress testing is used to detect function performance, and bears some resemblance to unit testing (which we will not get into here), however we need need to pay attention to the following points:
108+
Stress testing is used to detect function performance, and bears some resemblance to unit testing (which we will not get into here), however we need to pay attention to the following points:
109109

110110
- Stress tests must follow the following format, where XXX can be any alphanumeric combination and its first letter cannot be a lowercase letter.
111111

112112
func BenchmarkXXX (b *testing.B){...}
113113

114114
- By default, `Go test` does not perform function stress tests. If you want to perform stress tests, you need to set the flag `-test.bench` with the format: `-test.bench="test_name_regex"`. For instance, to run all stress tests in your suite, you would run `go test -test.bench=".*"`.
115-
- In your stress tests, please remember to use testing.BN any loop bodies, so that the tests can be run properly.
115+
- In your stress tests, please remember to use testing.B.N any loop bodies, so that the tests can be run properly.
116116
- As before, test file names must end in `_test.go`
117117

118118
Here we create a stress test file called webbench_test.go:
@@ -124,7 +124,7 @@ Here we create a stress test file called webbench_test.go:
124124
)
125125

126126
func Benchmark_Division(b *testing.B) {
127-
for i := 0; i < bN; i++ { // use bN for looping
127+
for i := 0; i < b.N; i++ { // use b.N for looping
128128
Division(4, 5)
129129
}
130130
}

0 commit comments

Comments
 (0)