mirror of
https://github.com/gonum/gonum.git
synced 2025-10-05 23:26:52 +08:00
all: quieten vet for unkeyed composite literals in test code
This commit is contained in:

committed by
Dan Kortschak

parent
3f94af49e6
commit
70492dcef1
@@ -741,7 +741,7 @@ var encodeTests = []struct {
|
||||
},
|
||||
{
|
||||
g: directedNodeAttrGraphFrom(powerMethodGraph, [][]encoding.Attribute{
|
||||
2: {{"fontsize", "16"}, {"shape", "ellipse"}},
|
||||
2: {{Key: "fontsize", Value: "16"}, {Key: "shape", Value: "ellipse"}},
|
||||
4: {},
|
||||
}),
|
||||
|
||||
@@ -768,7 +768,7 @@ var encodeTests = []struct {
|
||||
},
|
||||
{
|
||||
g: undirectedNodeAttrGraphFrom(powerMethodGraph, [][]encoding.Attribute{
|
||||
2: {{"fontsize", "16"}, {"shape", "ellipse"}},
|
||||
2: {{Key: "fontsize", Value: "16"}, {Key: "shape", Value: "ellipse"}},
|
||||
4: {},
|
||||
}),
|
||||
|
||||
@@ -795,7 +795,7 @@ var encodeTests = []struct {
|
||||
},
|
||||
{
|
||||
g: directedNamedIDNodeAttrGraphFrom(powerMethodGraph, [][]encoding.Attribute{
|
||||
2: {{"fontsize", "16"}, {"shape", "ellipse"}},
|
||||
2: {{Key: "fontsize", Value: "16"}, {Key: "shape", Value: "ellipse"}},
|
||||
4: {},
|
||||
}),
|
||||
|
||||
@@ -824,7 +824,7 @@ var encodeTests = []struct {
|
||||
g: undirectedNamedIDNodeAttrGraphFrom(powerMethodGraph, [][]encoding.Attribute{
|
||||
0: nil,
|
||||
1: nil,
|
||||
2: {{"fontsize", "16"}, {"shape", "ellipse"}},
|
||||
2: {{Key: "fontsize", Value: "16"}, {Key: "shape", Value: "ellipse"}},
|
||||
3: nil,
|
||||
4: {},
|
||||
}),
|
||||
@@ -896,9 +896,9 @@ var encodeTests = []struct {
|
||||
},
|
||||
{
|
||||
g: directedEdgeAttrGraphFrom(powerMethodGraph, map[edge][]encoding.Attribute{
|
||||
{from: 0, to: 2}: {{"label", `"???"`}, {"style", "dashed"}},
|
||||
{from: 0, to: 2}: {{Key: "label", Value: `"???"`}, {Key: "style", Value: "dashed"}},
|
||||
{from: 2, to: 4}: {},
|
||||
{from: 3, to: 4}: {{"color", "red"}},
|
||||
{from: 3, to: 4}: {{Key: "color", Value: "red"}},
|
||||
}),
|
||||
|
||||
want: `digraph {
|
||||
@@ -924,9 +924,9 @@ var encodeTests = []struct {
|
||||
},
|
||||
{
|
||||
g: undirectedEdgeAttrGraphFrom(powerMethodGraph, map[edge][]encoding.Attribute{
|
||||
{from: 0, to: 2}: {{"label", `"???"`}, {"style", "dashed"}},
|
||||
{from: 0, to: 2}: {{Key: "label", Value: `"???"`}, {Key: "style", Value: "dashed"}},
|
||||
{from: 2, to: 4}: {},
|
||||
{from: 3, to: 4}: {{"color", "red"}},
|
||||
{from: 3, to: 4}: {{Key: "color", Value: "red"}},
|
||||
}),
|
||||
|
||||
want: `graph {
|
||||
@@ -997,8 +997,8 @@ var encodeTests = []struct {
|
||||
{
|
||||
g: directedPortedAttrGraphFrom(powerMethodGraph,
|
||||
[][]encoding.Attribute{
|
||||
2: {{"shape", "record"}, {"label", `"<Two>English|<Zwei>German"`}},
|
||||
4: {{"shape", "record"}, {"label", `"<Four>English|<Vier>German"`}},
|
||||
2: {{Key: "shape", Value: "record"}, {Key: "label", Value: `"<Two>English|<Zwei>German"`}},
|
||||
4: {{Key: "shape", Value: "record"}, {Key: "label", Value: `"<Four>English|<Vier>German"`}},
|
||||
},
|
||||
map[edge]portedEdge{
|
||||
{from: 0, to: 1}: {fromCompass: "s"},
|
||||
@@ -1037,8 +1037,8 @@ var encodeTests = []struct {
|
||||
{
|
||||
g: undirectedPortedAttrGraphFrom(powerMethodGraph,
|
||||
[][]encoding.Attribute{
|
||||
2: {{"shape", "record"}, {"label", `"<Two>English|<Zwei>German"`}},
|
||||
4: {{"shape", "record"}, {"label", `"<Four>English|<Vier>German"`}},
|
||||
2: {{Key: "shape", Value: "record"}, {Key: "label", Value: `"<Two>English|<Zwei>German"`}},
|
||||
4: {{Key: "shape", Value: "record"}, {Key: "label", Value: `"<Four>English|<Vier>German"`}},
|
||||
},
|
||||
map[edge]portedEdge{
|
||||
{from: 0, to: 1}: {fromCompass: "s"},
|
||||
@@ -1078,9 +1078,9 @@ var encodeTests = []struct {
|
||||
// Handling graph attributes.
|
||||
{
|
||||
g: graphAttributer{Graph: undirectedEdgeAttrGraphFrom(powerMethodGraph, map[edge][]encoding.Attribute{
|
||||
{from: 0, to: 2}: {{"label", `"???"`}, {"style", "dashed"}},
|
||||
{from: 0, to: 2}: {{Key: "label", Value: `"???"`}, {Key: "style", Value: "dashed"}},
|
||||
{from: 2, to: 4}: {},
|
||||
{from: 3, to: 4}: {{"color", "red"}},
|
||||
{from: 3, to: 4}: {{Key: "color", Value: "red"}},
|
||||
})},
|
||||
|
||||
want: `graph {
|
||||
@@ -1106,12 +1106,12 @@ var encodeTests = []struct {
|
||||
},
|
||||
{
|
||||
g: graphAttributer{Graph: undirectedEdgeAttrGraphFrom(powerMethodGraph, map[edge][]encoding.Attribute{
|
||||
{from: 0, to: 2}: {{"label", `"???"`}, {"style", "dashed"}},
|
||||
{from: 0, to: 2}: {{Key: "label", Value: `"???"`}, {Key: "style", Value: "dashed"}},
|
||||
{from: 2, to: 4}: {},
|
||||
{from: 3, to: 4}: {{"color", "red"}},
|
||||
{from: 3, to: 4}: {{Key: "color", Value: "red"}},
|
||||
}),
|
||||
graph: []encoding.Attribute{{"rankdir", `"LR"`}},
|
||||
node: []encoding.Attribute{{"fontsize", "16"}, {"shape", "ellipse"}},
|
||||
graph: []encoding.Attribute{{Key: "rankdir", Value: `"LR"`}},
|
||||
node: []encoding.Attribute{{Key: "fontsize", Value: "16"}, {Key: "shape", Value: "ellipse"}},
|
||||
},
|
||||
|
||||
want: `graph {
|
||||
|
@@ -27,7 +27,7 @@ func (e *edgeWithPorts) ToPort() (string, string) {
|
||||
func ExamplePorter() {
|
||||
g := simple.NewUndirectedGraph()
|
||||
g.SetEdge(&edgeWithPorts{
|
||||
Edge: simple.Edge{simple.Node(1), simple.Node(0)},
|
||||
Edge: simple.Edge{F: simple.Node(1), T: simple.Node(0)},
|
||||
fromPort: "p1",
|
||||
toPort: "p2",
|
||||
})
|
||||
|
@@ -193,7 +193,7 @@ func (e *edge) SetLabel(l string) {
|
||||
}
|
||||
|
||||
func (e *edge) Attributes() []encoding.Attribute {
|
||||
return []encoding.Attribute{{"label", e.label}}
|
||||
return []encoding.Attribute{{Key: "label", Value: e.label}}
|
||||
}
|
||||
|
||||
type attributes map[string]encoding.Attribute
|
||||
|
@@ -131,8 +131,8 @@ func twoSat(r io.Reader) (state map[string]bool, ok bool) {
|
||||
}
|
||||
|
||||
// Add implications to the graph.
|
||||
g.SetEdge(simple.Edge{variables[0].negated(), variables[1]})
|
||||
g.SetEdge(simple.Edge{variables[1].negated(), variables[0]})
|
||||
g.SetEdge(simple.Edge{F: variables[0].negated(), T: variables[1]})
|
||||
g.SetEdge(simple.Edge{F: variables[1].negated(), T: variables[0]})
|
||||
}
|
||||
|
||||
// Find implication inconsistencies.
|
||||
|
@@ -68,10 +68,10 @@ func testLinesearcher(t *testing.T, ls Linesearcher, decrease, curvature float64
|
||||
for i, prob := range []linesearcherTest{
|
||||
newLinesearcherTest("Concave-to-the-right function", functions.ConcaveRight{}),
|
||||
newLinesearcherTest("Concave-to-the-left function", functions.ConcaveLeft{}),
|
||||
newLinesearcherTest("Plassmann wiggly function (l=39, beta=0.01)", functions.Plassmann{39, 0.01}),
|
||||
newLinesearcherTest("Yanai-Ozawa-Kaneko function (beta1=0.001, beta2=0.001)", functions.YanaiOzawaKaneko{0.001, 0.001}),
|
||||
newLinesearcherTest("Yanai-Ozawa-Kaneko function (beta1=0.01, beta2=0.001)", functions.YanaiOzawaKaneko{0.01, 0.001}),
|
||||
newLinesearcherTest("Yanai-Ozawa-Kaneko function (beta1=0.001, beta2=0.01)", functions.YanaiOzawaKaneko{0.001, 0.01}),
|
||||
newLinesearcherTest("Plassmann wiggly function (l=39, beta=0.01)", functions.Plassmann{L: 39, Beta: 0.01}),
|
||||
newLinesearcherTest("Yanai-Ozawa-Kaneko function (beta1=0.001, beta2=0.001)", functions.YanaiOzawaKaneko{Beta1: 0.001, Beta2: 0.001}),
|
||||
newLinesearcherTest("Yanai-Ozawa-Kaneko function (beta1=0.01, beta2=0.001)", functions.YanaiOzawaKaneko{Beta1: 0.01, Beta2: 0.001}),
|
||||
newLinesearcherTest("Yanai-Ozawa-Kaneko function (beta1=0.001, beta2=0.01)", functions.YanaiOzawaKaneko{Beta1: 0.001, Beta2: 0.01}),
|
||||
} {
|
||||
for _, initStep := range []float64{0.001, 0.1, 1, 10, 1000} {
|
||||
prefix := fmt.Sprintf("test %d (%v started from %v)", i, prob.name, initStep)
|
||||
|
@@ -26,8 +26,8 @@ func TestLatinHypercube(t *testing.T) {
|
||||
src := rand.New(rand.NewSource(1))
|
||||
for _, nSamples := range []int{1, 2, 5, 10, 20} {
|
||||
for _, dist := range []lhDist{
|
||||
distmv.NewUniform([]distmv.Bound{{0, 3}}, src),
|
||||
distmv.NewUniform([]distmv.Bound{{0, 3}, {-1, 5}, {-4, -1}}, src),
|
||||
distmv.NewUniform([]distmv.Bound{{Min: 0, Max: 3}}, src),
|
||||
distmv.NewUniform([]distmv.Bound{{Min: 0, Max: 3}, {Min: -1, Max: 5}, {Min: -4, Max: -1}}, src),
|
||||
} {
|
||||
dim := dist.Dim()
|
||||
batch := mat.NewDense(nSamples, dim, nil)
|
||||
|
Reference in New Issue
Block a user