mirror of
https://github.com/gonum/gonum.git
synced 2025-10-09 00:50:16 +08:00
all: make tests pass when -count is greater than 1
Tests run repeatedly do not reinitialise state, meaning that a second run of the tests will have leftover state from the previous run. This ensures that repeated runs are identical with the exception of map iteration order.
This commit is contained in:
@@ -185,20 +185,19 @@ func TestDimensionEquality(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
var operationTests = []struct {
|
||||
recvOp func(Uniter) *Unit
|
||||
param Uniter
|
||||
want Uniter
|
||||
}{
|
||||
{Dimless(1).Unit().Add, Dimless(2), Dimless(3)},
|
||||
{Dimless(1).Unit().Mul, Dimless(2), Dimless(2)},
|
||||
{Dimless(1).Unit().Mul, Length(2), Length(2)},
|
||||
{Length(1).Unit().Mul, Dimless(2), Length(2)},
|
||||
{Dimless(1).Unit().Div, Length(2), New(0.5, Dimensions{LengthDim: -1})},
|
||||
{Length(1).Unit().Div, Dimless(2), Length(0.5)},
|
||||
}
|
||||
|
||||
func TestOperations(t *testing.T) {
|
||||
operationTests := []struct {
|
||||
recvOp func(Uniter) *Unit
|
||||
param Uniter
|
||||
want Uniter
|
||||
}{
|
||||
{Dimless(1).Unit().Add, Dimless(2), Dimless(3)},
|
||||
{Dimless(1).Unit().Mul, Dimless(2), Dimless(2)},
|
||||
{Dimless(1).Unit().Mul, Length(2), Length(2)},
|
||||
{Length(1).Unit().Mul, Dimless(2), Length(2)},
|
||||
{Dimless(1).Unit().Div, Length(2), New(0.5, Dimensions{LengthDim: -1})},
|
||||
{Length(1).Unit().Div, Dimless(2), Length(0.5)},
|
||||
}
|
||||
t.Parallel()
|
||||
for i, test := range operationTests {
|
||||
var got Uniter
|
||||
|
Reference in New Issue
Block a user