Skip to content

Commit

Permalink
move item struct to be in the exercise instead of generated test file
Browse files Browse the repository at this point in the history
  • Loading branch information
jesse-kroon committed Feb 1, 2024
1 parent e5c6113 commit 91e57c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 5 additions & 7 deletions exercises/practice/knapsack/.meta/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,19 @@ var tmpl = `package knapsack
{{.Header}}
type item struct {
Weight int
Value int
}
type maximumValueCaseInput struct {
MaximumWeight int
Items []item
}
var maximumValueTests = []struct {
type maximumValueTest struct {
description string
input maximumValueCaseInput
expected int
}{ {{range .J.maximumValue}}
}
var maximumValueTests = []maximumValueTest {
{{range .J.maximumValue}}
{
description: {{printf "%q" .Description}},
input: maximumValueCaseInput {
Expand Down
12 changes: 5 additions & 7 deletions exercises/practice/knapsack/cases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ package knapsack
// Source: exercism/problem-specifications
// Commit: 6c1d8e2 Knapsack: Fix empty list of items (#2350)

type item struct {
Weight int
Value int
}

type maximumValueCaseInput struct {
MaximumWeight int
Items []item
}

var maximumValueTests = []struct {
type maximumValueTest struct {
description string
input maximumValueCaseInput
expected int
}{
}

var maximumValueTests = []maximumValueTest{

{
description: "no items",
input: maximumValueCaseInput{
Expand Down
4 changes: 4 additions & 0 deletions exercises/practice/knapsack/knapsack.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package knapsack

type item struct {
Weight, Value int
}

func Knapsack(maximumWeight int, items []item) int {
return 0
}

0 comments on commit 91e57c6

Please sign in to comment.