github.com/jingcheng-WU/gonum@v0.9.1-0.20210323123734-f1a2a11a8f7b/unit/constant/magneticconstant_test.go (about) 1 // Code generated by "go generate github.com/jingcheng-WU/gonum/unit/constant”; DO NOT EDIT. 2 3 // Copyright ©2019 The Gonum Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package constant 8 9 import ( 10 "fmt" 11 "testing" 12 ) 13 14 func TestMagneticConstantFormat(t *testing.T) { 15 t.Parallel() 16 for _, test := range []struct { 17 format string 18 want string 19 }{ 20 {"%v", "1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3"}, 21 {"%.1v", "1e-06 A^2 s^4 kg^-1 m^-3"}, 22 {"%50.1v", " 1e-06 A^2 s^4 kg^-1 m^-3"}, 23 {"%50v", " 1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3"}, 24 {"%1v", "1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3"}, 25 {"%#v", "constant.magneticConstantUnits(1.2566370621238374e-06)"}, 26 {"%s", "%!s(constant.magneticConstantUnits=1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3)"}, 27 } { 28 got := fmt.Sprintf(test.format, MagneticConstant) 29 if got != test.want { 30 t.Errorf("Format %q: got: %q want: %q", test.format, got, test.want) 31 } 32 } 33 }