mirror of
https://github.com/gonum/gonum.git
synced 2025-10-23 07:09:27 +08:00
unit: make tests parallel
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAbsorbedRadioactiveDose(t *testing.T) {
|
func TestAbsorbedRadioactiveDose(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got AbsorbedRadioactiveDose
|
var got AbsorbedRadioactiveDose
|
||||||
err := got.From(AbsorbedRadioactiveDose(value).Unit())
|
err := got.From(AbsorbedRadioactiveDose(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestAbsorbedRadioactiveDose(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAbsorbedRadioactiveDoseFormat(t *testing.T) {
|
func TestAbsorbedRadioactiveDoseFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value AbsorbedRadioactiveDose
|
value AbsorbedRadioactiveDose
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAcceleration(t *testing.T) {
|
func TestAcceleration(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Acceleration
|
var got Acceleration
|
||||||
err := got.From(Acceleration(value).Unit())
|
err := got.From(Acceleration(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestAcceleration(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAccelerationFormat(t *testing.T) {
|
func TestAccelerationFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Acceleration
|
value Acceleration
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAngle(t *testing.T) {
|
func TestAngle(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Angle
|
var got Angle
|
||||||
err := got.From(Angle(value).Unit())
|
err := got.From(Angle(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestAngle(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAngleFormat(t *testing.T) {
|
func TestAngleFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Angle
|
value Angle
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestArea(t *testing.T) {
|
func TestArea(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Area
|
var got Area
|
||||||
err := got.From(Area(value).Unit())
|
err := got.From(Area(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestArea(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAreaFormat(t *testing.T) {
|
func TestAreaFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Area
|
value Area
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCapacitance(t *testing.T) {
|
func TestCapacitance(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Capacitance
|
var got Capacitance
|
||||||
err := got.From(Capacitance(value).Unit())
|
err := got.From(Capacitance(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestCapacitance(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCapacitanceFormat(t *testing.T) {
|
func TestCapacitanceFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Capacitance
|
value Capacitance
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCharge(t *testing.T) {
|
func TestCharge(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Charge
|
var got Charge
|
||||||
err := got.From(Charge(value).Unit())
|
err := got.From(Charge(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestCharge(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestChargeFormat(t *testing.T) {
|
func TestChargeFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Charge
|
value Charge
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestConductance(t *testing.T) {
|
func TestConductance(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Conductance
|
var got Conductance
|
||||||
err := got.From(Conductance(value).Unit())
|
err := got.From(Conductance(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestConductance(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConductanceFormat(t *testing.T) {
|
func TestConductanceFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Conductance
|
value Conductance
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAvogadroFormat(t *testing.T) {
|
func TestAvogadroFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestBoltzmannFormat(t *testing.T) {
|
func TestBoltzmannFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestElectricConstantFormat(t *testing.T) {
|
func TestElectricConstantFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestFaradayFormat(t *testing.T) {
|
func TestFaradayFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -279,6 +279,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Test{{.Name}}Format(t *testing.T) {
|
func Test{{.Name}}Format(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct{
|
for _, test := range []struct{
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGravitationalFormat(t *testing.T) {
|
func TestGravitationalFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMagneticConstantFormat(t *testing.T) {
|
func TestMagneticConstantFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestPlanckFormat(t *testing.T) {
|
func TestPlanckFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
format string
|
format string
|
||||||
want string
|
want string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCurrent(t *testing.T) {
|
func TestCurrent(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Current
|
var got Current
|
||||||
err := got.From(Current(value).Unit())
|
err := got.From(Current(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestCurrent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCurrentFormat(t *testing.T) {
|
func TestCurrentFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Current
|
value Current
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestDimless(t *testing.T) {
|
func TestDimless(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Dimless
|
var got Dimless
|
||||||
err := got.From(Dimless(value).Unit())
|
err := got.From(Dimless(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestDimless(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDimlessFormat(t *testing.T) {
|
func TestDimlessFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Dimless
|
value Dimless
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestEnergy(t *testing.T) {
|
func TestEnergy(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Energy
|
var got Energy
|
||||||
err := got.From(Energy(value).Unit())
|
err := got.From(Energy(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestEnergy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEnergyFormat(t *testing.T) {
|
func TestEnergyFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Energy
|
value Energy
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestEquivalentRadioactiveDose(t *testing.T) {
|
func TestEquivalentRadioactiveDose(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got EquivalentRadioactiveDose
|
var got EquivalentRadioactiveDose
|
||||||
err := got.From(EquivalentRadioactiveDose(value).Unit())
|
err := got.From(EquivalentRadioactiveDose(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestEquivalentRadioactiveDose(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEquivalentRadioactiveDoseFormat(t *testing.T) {
|
func TestEquivalentRadioactiveDoseFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value EquivalentRadioactiveDose
|
value EquivalentRadioactiveDose
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestForce(t *testing.T) {
|
func TestForce(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Force
|
var got Force
|
||||||
err := got.From(Force(value).Unit())
|
err := got.From(Force(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestForce(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestForceFormat(t *testing.T) {
|
func TestForceFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Force
|
value Force
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestFrequency(t *testing.T) {
|
func TestFrequency(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Frequency
|
var got Frequency
|
||||||
err := got.From(Frequency(value).Unit())
|
err := got.From(Frequency(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestFrequency(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFrequencyFormat(t *testing.T) {
|
func TestFrequencyFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Frequency
|
value Frequency
|
||||||
format string
|
format string
|
||||||
|
@@ -595,6 +595,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Test{{.DimensionName}}(t *testing.T) {
|
func Test{{.DimensionName}}(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got {{.DimensionName}}
|
var got {{.DimensionName}}
|
||||||
err := got.From({{.DimensionName}}(value).Unit())
|
err := got.From({{.DimensionName}}(value).Unit())
|
||||||
@@ -615,6 +616,7 @@ func Test{{.DimensionName}}(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test{{.DimensionName}}Format(t *testing.T) {
|
func Test{{.DimensionName}}Format(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct{
|
for _, test := range []struct{
|
||||||
value {{.DimensionName}}
|
value {{.DimensionName}}
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestInductance(t *testing.T) {
|
func TestInductance(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Inductance
|
var got Inductance
|
||||||
err := got.From(Inductance(value).Unit())
|
err := got.From(Inductance(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestInductance(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInductanceFormat(t *testing.T) {
|
func TestInductanceFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Inductance
|
value Inductance
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestLength(t *testing.T) {
|
func TestLength(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Length
|
var got Length
|
||||||
err := got.From(Length(value).Unit())
|
err := got.From(Length(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestLength(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLengthFormat(t *testing.T) {
|
func TestLengthFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Length
|
value Length
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestLuminousIntensity(t *testing.T) {
|
func TestLuminousIntensity(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got LuminousIntensity
|
var got LuminousIntensity
|
||||||
err := got.From(LuminousIntensity(value).Unit())
|
err := got.From(LuminousIntensity(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestLuminousIntensity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLuminousIntensityFormat(t *testing.T) {
|
func TestLuminousIntensityFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value LuminousIntensity
|
value LuminousIntensity
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMagneticFlux(t *testing.T) {
|
func TestMagneticFlux(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got MagneticFlux
|
var got MagneticFlux
|
||||||
err := got.From(MagneticFlux(value).Unit())
|
err := got.From(MagneticFlux(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestMagneticFlux(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMagneticFluxFormat(t *testing.T) {
|
func TestMagneticFluxFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value MagneticFlux
|
value MagneticFlux
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMagneticFluxDensity(t *testing.T) {
|
func TestMagneticFluxDensity(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got MagneticFluxDensity
|
var got MagneticFluxDensity
|
||||||
err := got.From(MagneticFluxDensity(value).Unit())
|
err := got.From(MagneticFluxDensity(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestMagneticFluxDensity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMagneticFluxDensityFormat(t *testing.T) {
|
func TestMagneticFluxDensityFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value MagneticFluxDensity
|
value MagneticFluxDensity
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMass(t *testing.T) {
|
func TestMass(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Mass
|
var got Mass
|
||||||
err := got.From(Mass(value).Unit())
|
err := got.From(Mass(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestMass(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMassFormat(t *testing.T) {
|
func TestMassFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Mass
|
value Mass
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMole(t *testing.T) {
|
func TestMole(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Mole
|
var got Mole
|
||||||
err := got.From(Mole(value).Unit())
|
err := got.From(Mole(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestMole(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMoleFormat(t *testing.T) {
|
func TestMoleFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Mole
|
value Mole
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestPower(t *testing.T) {
|
func TestPower(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Power
|
var got Power
|
||||||
err := got.From(Power(value).Unit())
|
err := got.From(Power(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestPower(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPowerFormat(t *testing.T) {
|
func TestPowerFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Power
|
value Power
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestPressure(t *testing.T) {
|
func TestPressure(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Pressure
|
var got Pressure
|
||||||
err := got.From(Pressure(value).Unit())
|
err := got.From(Pressure(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestPressure(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPressureFormat(t *testing.T) {
|
func TestPressureFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Pressure
|
value Pressure
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestRadioactivity(t *testing.T) {
|
func TestRadioactivity(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Radioactivity
|
var got Radioactivity
|
||||||
err := got.From(Radioactivity(value).Unit())
|
err := got.From(Radioactivity(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestRadioactivity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRadioactivityFormat(t *testing.T) {
|
func TestRadioactivityFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Radioactivity
|
value Radioactivity
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestResistance(t *testing.T) {
|
func TestResistance(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Resistance
|
var got Resistance
|
||||||
err := got.From(Resistance(value).Unit())
|
err := got.From(Resistance(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestResistance(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestResistanceFormat(t *testing.T) {
|
func TestResistanceFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Resistance
|
value Resistance
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTemperature(t *testing.T) {
|
func TestTemperature(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Temperature
|
var got Temperature
|
||||||
err := got.From(Temperature(value).Unit())
|
err := got.From(Temperature(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestTemperature(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTemperatureFormat(t *testing.T) {
|
func TestTemperatureFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Temperature
|
value Temperature
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTime(t *testing.T) {
|
func TestTime(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Time
|
var got Time
|
||||||
err := got.From(Time(value).Unit())
|
err := got.From(Time(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestTime(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTimeFormat(t *testing.T) {
|
func TestTimeFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Time
|
value Time
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTorque(t *testing.T) {
|
func TestTorque(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Torque
|
var got Torque
|
||||||
err := got.From(Torque(value).Unit())
|
err := got.From(Torque(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestTorque(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTorqueFormat(t *testing.T) {
|
func TestTorqueFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Torque
|
value Torque
|
||||||
format string
|
format string
|
||||||
|
@@ -102,6 +102,7 @@ var formatTests = []struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFormat(t *testing.T) {
|
func TestFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, ts := range formatTests {
|
for _, ts := range formatTests {
|
||||||
if r := fmt.Sprintf(ts.format, ts.unit); r != ts.expect {
|
if r := fmt.Sprintf(ts.format, ts.unit); r != ts.expect {
|
||||||
t.Errorf("Format %q: got: %q expected: %q", ts.format, r, ts.expect)
|
t.Errorf("Format %q: got: %q expected: %q", ts.format, r, ts.expect)
|
||||||
@@ -110,6 +111,7 @@ func TestFormat(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGoStringFormat(t *testing.T) {
|
func TestGoStringFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
expect1 := `&unit.Unit{dimensions:unit.Dimensions{4:2, 7:-1}, value:6.62606957e-34}`
|
expect1 := `&unit.Unit{dimensions:unit.Dimensions{4:2, 7:-1}, value:6.62606957e-34}`
|
||||||
expect2 := `&unit.Unit{dimensions:unit.Dimensions{7:-1, 4:2}, value:6.62606957e-34}`
|
expect2 := `&unit.Unit{dimensions:unit.Dimensions{7:-1, 4:2}, value:6.62606957e-34}`
|
||||||
if r := fmt.Sprintf("%#v", New(6.62606957e-34, Dimensions{MassDim: 2, TimeDim: -1})); r != expect1 && r != expect2 {
|
if r := fmt.Sprintf("%#v", New(6.62606957e-34, Dimensions{MassDim: 2, TimeDim: -1})); r != expect1 && r != expect2 {
|
||||||
@@ -127,6 +129,7 @@ var initializationTests = []struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInitialization(t *testing.T) {
|
func TestInitialization(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, ts := range initializationTests {
|
for _, ts := range initializationTests {
|
||||||
if ts.expValue != ts.unit.value {
|
if ts.expValue != ts.unit.value {
|
||||||
t.Errorf("Value wrong on initialization: got: %v expected: %v", ts.unit.value, ts.expValue)
|
t.Errorf("Value wrong on initialization: got: %v expected: %v", ts.unit.value, ts.expValue)
|
||||||
@@ -159,6 +162,7 @@ var dimensionEqualityTests = []struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDimensionEquality(t *testing.T) {
|
func TestDimensionEquality(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, ts := range dimensionEqualityTests {
|
for _, ts := range dimensionEqualityTests {
|
||||||
if DimensionsMatch(ts.a, ts.b) != ts.shouldMatch {
|
if DimensionsMatch(ts.a, ts.b) != ts.shouldMatch {
|
||||||
t.Errorf("Dimension comparison incorrect for case %s. got: %v, expected: %v", ts.name, !ts.shouldMatch, ts.shouldMatch)
|
t.Errorf("Dimension comparison incorrect for case %s. got: %v, expected: %v", ts.name, !ts.shouldMatch, ts.shouldMatch)
|
||||||
@@ -180,6 +184,7 @@ var operationTests = []struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOperations(t *testing.T) {
|
func TestOperations(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for i, test := range operationTests {
|
for i, test := range operationTests {
|
||||||
var got Uniter
|
var got Uniter
|
||||||
if panics(func() { got = test.recvOp(test.param) }) {
|
if panics(func() { got = test.recvOp(test.param) }) {
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestVelocity(t *testing.T) {
|
func TestVelocity(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Velocity
|
var got Velocity
|
||||||
err := got.From(Velocity(value).Unit())
|
err := got.From(Velocity(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestVelocity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestVelocityFormat(t *testing.T) {
|
func TestVelocityFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Velocity
|
value Velocity
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestVoltage(t *testing.T) {
|
func TestVoltage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Voltage
|
var got Voltage
|
||||||
err := got.From(Voltage(value).Unit())
|
err := got.From(Voltage(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestVoltage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestVoltageFormat(t *testing.T) {
|
func TestVoltageFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Voltage
|
value Voltage
|
||||||
format string
|
format string
|
||||||
|
@@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestVolume(t *testing.T) {
|
func TestVolume(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, value := range []float64{-1, 0, 1} {
|
for _, value := range []float64{-1, 0, 1} {
|
||||||
var got Volume
|
var got Volume
|
||||||
err := got.From(Volume(value).Unit())
|
err := got.From(Volume(value).Unit())
|
||||||
@@ -32,6 +33,7 @@ func TestVolume(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestVolumeFormat(t *testing.T) {
|
func TestVolumeFormat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
value Volume
|
value Volume
|
||||||
format string
|
format string
|
||||||
|
Reference in New Issue
Block a user