Documentation
¶
Overview ¶
Package tests implements auxiliary tools for testing package.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EquateFloat64 ¶
EquateFloat64 compares two float64 numbers and reports them equal if their relative change is less than or equal to relchg. See: https://en.wikipedia.org/wiki/Relative_change
Example (Fail) ¶
package main
import (
"fmt"
"github.com/google/go-cmp/cmp"
"github.com/skhal/lab/go/tests"
)
func main() {
diff := cmp.Diff(3.4, 3.1, tests.EquateFloat64(0.01))
if diff != "" {
fmt.Print("3.4 !~= 3.1")
return
}
fmt.Print("3.4 ~= 3.1")
}
Output: 3.4 !~= 3.1
Example (Pass) ¶
package main
import (
"fmt"
"github.com/google/go-cmp/cmp"
"github.com/skhal/lab/go/tests"
)
func main() {
diff := cmp.Diff(3.4, 3.1, tests.EquateFloat64(0.1))
if diff != "" {
fmt.Print("3.4 !~= 3.1")
return
}
fmt.Print("3.4 ~= 3.1")
}
Output: 3.4 ~= 3.1
Types ¶
type GoldenFile ¶
type GoldenFile string
GoldenFile holds baseline data for regression tests.
Click to show internal directories.
Click to hide internal directories.