typo fixed

This commit is contained in:
Jerry Zhao
2015-06-26 20:32:07 +10:00
committed by James Miranda
parent 45224ab3ae
commit 4c9d371363

View File

@@ -92,7 +92,7 @@ The above output shows in detail the results of our test. We see that the test f
}
}
We execute `go test-v` once again. The following information should now be displayed -the test suite has passed~:
We execute `go test -v` once again. The following information should now be displayed -the test suite has passed~:
=== RUN Test_Division_1
--- 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
## How to write stress tests
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:
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:
- Stress tests must follow the following format, where XXX can be any alphanumeric combination and its first letter cannot be a lowercase letter.
func BenchmarkXXX (b *testing.B){...}
- 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=".*"`.
- In your stress tests, please remember to use testing.BN any loop bodies, so that the tests can be run properly.
- In your stress tests, please remember to use testing.B.N any loop bodies, so that the tests can be run properly.
- As before, test file names must end in `_test.go`
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:
)
func Benchmark_Division(b *testing.B) {
for i := 0; i < bN; i++ { // use bN for looping
for i := 0; i < b.N; i++ { // use b.N for looping
Division(4, 5)
}
}