go-hep.org/x/hep@v0.38.1/fit/fit_test.go (about) 1 // Copyright ©2020 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package fit_test 6 7 import ( 8 "os" 9 "path" 10 "testing" 11 12 "gonum.org/v1/plot/cmpimg" 13 ) 14 15 func checkPlot(ex func(), t *testing.T, filenames ...string) { 16 checkPlotApprox(ex, t, 0, filenames...) 17 } 18 19 func checkPlotApprox(ex func(), t *testing.T, delta float64, filenames ...string) { 20 t.Helper() 21 cmpimg.CheckPlotApprox(ex, t, delta, filenames...) 22 if t.Failed() { 23 return 24 } 25 for _, fname := range filenames { 26 _ = os.Remove(path.Join("testdata", fname)) 27 } 28 }