This package provides a simple utility function for comparing values in a test. The goal is extreme simplicity:
import (
"testing"
"github.com/nitroshare/compare"
)
func TestSomething(t *testing.T) {
// Second and third parameter are compared and the fourth parameter
// determines if they should match; in this case, they should...
compare.Compare(t, 1, 1, true)
// ...and in this case they should not
compare.Compare(t, 1, 2, false)
// Functions are a special exception - they cannot be directly compared
// with Compare, so a separate function is provided that will work in
// most circumstances:
compare.CompareFn(t, testing.Init, testing.Init, true)
}