Functions

import (
  "testing"
  "github.com/maxatome/go-testdeep/td"
)

func TestMyFunc(t *testing.T) {
  // Compares MyFunc() result against a fixed value
  td.Cmp(t, MyFunc(), 128, "MyFunc() result is 128")

  // Compares MyFunc() result using the Between Testdeep operator
  td.Cmp(t, MyFunc(), td.Between(100, 199),
    "MyFunc() result is between 100 and 199")
}

CmpDeeply() is now replaced by Cmp(), but it is still available for backward compatibility purpose.

Main shortcut functions

import (
  "testing"
  "github.com/maxatome/go-testdeep/td"
)

func TestMyFunc(t *testing.T) {
  td.CmpBetween(t, MyFunc(), 100, 199, td.BoundsInIn,
    "MyFunc() result is between 100 and 199")
}

For each of these functions, it is always a shortcut on Cmp() and the correponding Testdeep operator:

CmpHasPrefix(t, got, expected, …) ⇒ Cmp(t, got, HasPrefix(expected), …)
   ^-------^                                    ^-------^
       +--------------------------------------------+

Each shortcut method is described in the corresponding operator page. See operators list.