testlapack: use helpers to name sub-tests
MODIFY
lapack/testlapack/dlarf.go
lapack/testlapack/dlarf.go
@@ -22,10 +22,7 @@ type Dlarfer interface {
func DlarfTest(t *testing.T, impl Dlarfer) {
for _, side := range []blas.Side{blas.Left, blas.Right} {
- name := "Right"
- if side == blas.Left {
- name = "Left"
- }
+ name := sideToString(side)
t.Run(name, func(t *testing.T) {
runDlarfTest(t, impl, side)
})

MODIFY
lapack/testlapack/dlauu2.go
lapack/testlapack/dlauu2.go
@@ -21,10 +21,7 @@ type Dlauu2er interface {
func Dlauu2Test(t *testing.T, impl Dlauu2er) {
for _, uplo := range []blas.Uplo{blas.Upper, blas.Lower} {
- name := "Upper"
- if uplo == blas.Lower {
- name = "Lower"
- }
+ name := uploToString(uplo)
t.Run(name, func(t *testing.T) {
ns := []int{0, 1, 2, 3, 4, 5, 10, 25}
dlauuTest(t, impl.Dlauu2, uplo, ns)

MODIFY
lapack/testlapack/dlauum.go
lapack/testlapack/dlauum.go
@@ -16,10 +16,7 @@ type Dlauumer interface {
func DlauumTest(t *testing.T, impl Dlauumer) {
for _, uplo := range []blas.Uplo{blas.Upper, blas.Lower} {
- name := "Upper"
- if uplo == blas.Lower {
- name = "Lower"
- }
+ name := uploToString(uplo)
t.Run(name, func(t *testing.T) {
// Include small and large sizes to make sure that both
// unblocked and blocked paths are taken.

MODIFY
lapack/testlapack/dpotri.go
lapack/testlapack/dpotri.go
@@ -22,10 +22,7 @@ type Dpotrier interface {
func DpotriTest(t *testing.T, impl Dpotrier) {
for _, uplo := range []blas.Uplo{blas.Upper, blas.Lower} {
- name := "Upper"
- if uplo == blas.Lower {
- name = "Lower"
- }
+ name := uploToString(uplo)
t.Run(name, func(t *testing.T) {
// Include small and large sizes to make sure that both
// unblocked and blocked paths are taken.

MODIFY
lapack/testlapack/dtrevc3.go
lapack/testlapack/dtrevc3.go
@@ -27,11 +27,11 @@ func Dtrevc3Test(t *testing.T, impl Dtrevc3er) {
var name string
switch side {
case lapack.EVRight:
- name = "Rigth"
+ name = "EVRigth"
case lapack.EVLeft:
- name = "Left"
+ name = "EVLeft"
case lapack.EVBoth:
- name = "Both"
+ name = "EVBoth"
}
t.Run(name, func(t *testing.T) {
runDtrevc3Test(t, impl, rnd, side)

MODIFY
lapack/testlapack/general.go
lapack/testlapack/general.go
@@ -99,6 +99,17 @@ func diagToString(diag blas.Diag) string {
}
}
+func sideToString(side blas.Side) string {
+ switch side {
+ case blas.Left:
+ return "Left"
+ case blas.Right:
+ return "Right"
+ default:
+ panic("invalid side")
+ }
+}
+
// nanSlice allocates a new slice of length n filled with NaN.
func nanSlice(n int) []float64 {
s := make([]float64, n)

testlapack: use helpers to name sub-tests