Knapsack problem/Bounded/Go test: Difference between revisions

Content added Content deleted
(Add Go test file and instructions)
 
m (update sub-repo url)
Line 38: Line 38:
If you're unfamiliar with using benchmarks within go tests:
If you're unfamiliar with using benchmarks within go tests:
* Put the above into a <tt>*_test.go</tt> file in the same directory as the <tt>*.go</tt> file from [[Knapsack_problem/Bounded#Go]] (and with no other Go source files)
* Put the above into a <tt>*_test.go</tt> file in the same directory as the <tt>*.go</tt> file from [[Knapsack_problem/Bounded#Go]] (and with no other Go source files)
* Get and build [http://godoc.org/code.google.com/p/go.tools/cmd/benchcmp benchcmp] if you don't already have it: "<code>go get -v code.google.com/p/go.tools/cmd/benchcmp</code>"
* Get and build [http://godoc.org/golang.org/x/tools/cmd/benchcmp benchcmp] if you don't already have it: "<code>go get -v golang.org/x/tools/cmd/benchcmp</code>"
* Run <code>go test -v -bench=. > bench.out.orig</code> (or <code>go test -bench=. | tee bench.out.orig</code> or some such)
* Run <code>go test -v -bench=. > bench.out.orig</code> (or <code>go test -bench=. | tee bench.out.orig</code> or some such)
* Make changes as desired
* Make changes as desired