Testing

Testing: write a small programs that chack that the code under test behave as expected.

To make a test:

  • in a package directory, create a file that ends with _test.go. This files are not build with go build
  • inside the file three functions are treated special: tests, benchmarks, examples
  • test function begin with Test and report the result PASS ot FAIL
  • benchmark function begin with Benchmark and measure the performance of some operation
  • example function begin with Example and provide machine documentation

results matching ""

    No results matching ""