blob: 96966f3f7d0f94682d24ebdbf169221ce4688835 [file] [log] [blame]
Jamie Hannafordb2b237f2014-09-15 12:17:47 +02001package testhelper
2
3import "testing"
4
Jamie Hannaford2964aed2014-09-15 12:20:02 +02005// This function compares two arbitrary values and performs a comparison. If the
6// comparison fails, a fatal error is raised that will fail the test
Jamie Hannafordb2b237f2014-09-15 12:17:47 +02007func Compare(t *testing.T, expected interface{}, actual interface{}) {
8 if expected != actual {
9 t.Fatalf("Expected [%#v] but got [%#v]", expected, actual)
10 }
11}
12
Jamie Hannaford2964aed2014-09-15 12:20:02 +020013// A convenience function for checking whether an error value is an actual error
Jamie Hannafordb2b237f2014-09-15 12:17:47 +020014func CheckErr(t *testing.T, e error) {
15 if e != nil {
16 t.Fatalf("Unexpected error: %#v", e)
17 }
18}