diff --git a/tools/testtool/testdata/submissions/correct/coverme/private/coverme/coverage_test.go b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/coverage_test.go index 0b1f59f..6aebc0d 100644 --- a/tools/testtool/testdata/submissions/correct/coverme/private/coverme/coverage_test.go +++ b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/coverage_test.go @@ -6,10 +6,11 @@ import ( "testing" "github.com/stretchr/testify/require" + "gitlab.com/slon/shad-go/coverme" ) -// min coverage: 60% +// min coverage: 70% func TestSum(t *testing.T) { require.Equal(t, int64(2), coverme.Sum(1, 1)) diff --git a/tools/testtool/testdata/submissions/correct/coverme/private/coverme/service.go b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/service.go index d350073..48e8e89 100644 --- a/tools/testtool/testdata/submissions/correct/coverme/private/coverme/service.go +++ b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/service.go @@ -2,9 +2,13 @@ package coverme +import "net/http" + func Sum(a, b int64) int64 { if a == 0 { return b + } else if a == http.StatusOK { + return http.StatusCreated + b - 1 } return a + b } diff --git a/tools/testtool/testdata/submissions/correct/coverme/private/coverme/solution_test.go b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/solution_test.go index 6d72392..059a2b5 100644 --- a/tools/testtool/testdata/submissions/correct/coverme/private/coverme/solution_test.go +++ b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/solution_test.go @@ -11,4 +11,5 @@ import ( func TestSum(t *testing.T) { require.Equal(t, int64(2), Sum(1, 1)) require.Equal(t, int64(1), Sum(0, 1)) + require.Equal(t, int64(202), Sum(200, 2)) } diff --git a/tools/testtool/testdata/submissions/correct/coverme/private/coverme/subpkg/g.go b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/subpkg/g.go new file mode 100644 index 0000000..acbff5b --- /dev/null +++ b/tools/testtool/testdata/submissions/correct/coverme/private/coverme/subpkg/g.go @@ -0,0 +1,5 @@ +package subpkg + +func AddTwo(n int) int { + return AddOne(n + 1) +} diff --git a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/additional_test.go b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/additional_test.go new file mode 100644 index 0000000..95dc7a3 --- /dev/null +++ b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/additional_test.go @@ -0,0 +1,11 @@ +package coverme + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSum2(t *testing.T) { + require.Equal(t, int64(202), Sum(200, 2)) +} diff --git a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/coverage_test.go b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/coverage_test.go index 0b1f59f..6aebc0d 100644 --- a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/coverage_test.go +++ b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/coverage_test.go @@ -6,10 +6,11 @@ import ( "testing" "github.com/stretchr/testify/require" + "gitlab.com/slon/shad-go/coverme" ) -// min coverage: 60% +// min coverage: 70% func TestSum(t *testing.T) { require.Equal(t, int64(2), coverme.Sum(1, 1)) diff --git a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/service.go b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/service.go index d350073..48e8e89 100644 --- a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/service.go +++ b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/service.go @@ -2,9 +2,13 @@ package coverme +import "net/http" + func Sum(a, b int64) int64 { if a == 0 { return b + } else if a == http.StatusOK { + return http.StatusCreated + b - 1 } return a + b } diff --git a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/subpkg/additional_test.go b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/subpkg/additional_test.go index b624221..366a2dd 100644 --- a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/subpkg/additional_test.go +++ b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/subpkg/additional_test.go @@ -10,3 +10,7 @@ func TestAddOne_2(t *testing.T) { require.Equal(t, 2, AddOne(1)) require.Equal(t, 30, AddOne(29)) } + +func TestAddTwo(t *testing.T) { + require.Equal(t, 4, AddTwo(2)) +} diff --git a/tools/testtool/testdata/submissions/correct/coverme/student/coverme/subpkg/g.go b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/subpkg/g.go new file mode 100644 index 0000000..acbff5b --- /dev/null +++ b/tools/testtool/testdata/submissions/correct/coverme/student/coverme/subpkg/g.go @@ -0,0 +1,5 @@ +package subpkg + +func AddTwo(n int) int { + return AddOne(n + 1) +} diff --git a/tools/testtool/testdata/submissions/correct/coverme/student/go.sum b/tools/testtool/testdata/submissions/correct/coverme/student/go.sum index fb52f53..a80206a 100644 --- a/tools/testtool/testdata/submissions/correct/coverme/student/go.sum +++ b/tools/testtool/testdata/submissions/correct/coverme/student/go.sum @@ -1,6 +1,10 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=