trackler 2.0.8.48 → 2.0.8.49
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/go/exercises/clock/.meta/gen.go +56 -46
- data/tracks/go/exercises/clock/cases_test.go +6 -1
- data/tracks/go/exercises/gigasecond/.meta/gen.go +14 -11
- data/tracks/go/exercises/gigasecond/cases_test.go +10 -3
- data/tracks/go/exercises/gigasecond/gigasecond_test.go +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48201089c77e7b81845af6440956854c37235757
|
4
|
+
data.tar.gz: c8df11ee44d68548e4dc45916eb772d42db76d18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c8ee5ad1aa4951cc1960e272f54ee5928757809050c731a15c4c68c76031b1ec7410315dd58479dea955c5f889fdcfd9cf2bcb35c3676c912df549b317cd59f
|
7
|
+
data.tar.gz: 8871ec457aebdc4366e1c910a2a2fdf95a44e309d32ea9d113435f3d5f23f2c5d2e9913e19708dd13f72460d5163a6f45f3682f89ecaea041fb4bef555c6d159
|
data/lib/trackler/version.rb
CHANGED
@@ -22,71 +22,81 @@ func main() {
|
|
22
22
|
|
23
23
|
// The JSON structure we expect to be able to umarshal into
|
24
24
|
type js struct {
|
25
|
-
|
26
|
-
Description []string
|
27
|
-
Cases []timeCase
|
28
|
-
}
|
29
|
-
Add struct {
|
30
|
-
Description []string
|
31
|
-
Cases []addCase
|
32
|
-
}
|
33
|
-
Equal struct {
|
34
|
-
Description []string
|
35
|
-
Cases []eqCase
|
36
|
-
}
|
25
|
+
Groups TestGroups `json:"Cases"`
|
37
26
|
}
|
38
27
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
Description string
|
43
|
-
Hour, Minute int
|
44
|
-
Expected string
|
28
|
+
type TestGroups []struct {
|
29
|
+
Description string
|
30
|
+
Cases []OneCase
|
45
31
|
}
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
32
|
+
|
33
|
+
type OneCase struct {
|
34
|
+
Description string
|
35
|
+
Property string
|
36
|
+
Hour int // "create"/"add" cases
|
37
|
+
Minute int // "create"/"add" cases
|
38
|
+
Add int // "add" cases only
|
39
|
+
|
40
|
+
Clock1 struct{ Hour, Minute int } // "equal" cases only
|
41
|
+
Clock2 struct{ Hour, Minute int } // "equal" cases only
|
42
|
+
Expected interface{} // string or bool
|
50
43
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
|
45
|
+
func (c OneCase) IsTimeCase() bool { return c.Property == "create" }
|
46
|
+
func (c OneCase) IsAddCase() bool { return c.Property == "add" }
|
47
|
+
func (c OneCase) IsEqualCase() bool { return c.Property == "equal" }
|
48
|
+
|
49
|
+
func (groups TestGroups) GroupComment(property string) string {
|
50
|
+
for _, group := range groups {
|
51
|
+
propertyGroupMatch := true
|
52
|
+
for _, testcase := range group.Cases {
|
53
|
+
if testcase.Property != property {
|
54
|
+
propertyGroupMatch = false
|
55
|
+
break
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if propertyGroupMatch {
|
59
|
+
return group.Description
|
60
|
+
}
|
61
|
+
}
|
62
|
+
return "Note: Apparent inconsistent use of \"property\": \"" + property + "\" within test case group!"
|
55
63
|
}
|
56
64
|
|
57
65
|
var tmpl = `package clock
|
58
66
|
|
59
|
-
|
60
|
-
{{if .Commit}}// Commit: {{.Commit}}
|
61
|
-
{{end}}
|
67
|
+
{{.Header}}
|
62
68
|
|
63
|
-
{{
|
64
|
-
{{
|
69
|
+
{{with .J.Groups}}
|
70
|
+
// {{ .GroupComment "create"}}
|
71
|
+
{{end}} var timeTests = []struct {
|
65
72
|
h, m int
|
66
73
|
want string
|
67
|
-
}{
|
68
|
-
{{
|
69
|
-
{{end}}}
|
74
|
+
}{ {{range .J.Groups}} {{range .Cases}}
|
75
|
+
{{if .IsTimeCase}}{ {{.Hour}}, {{.Minute}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
|
76
|
+
{{- end}}{{end}}{{end}} }
|
70
77
|
|
71
|
-
{{
|
72
|
-
{{
|
78
|
+
{{with .J.Groups}}
|
79
|
+
// {{ .GroupComment "add"}}
|
80
|
+
{{end}} var addTests = []struct {
|
73
81
|
h, m, a int
|
74
|
-
want
|
75
|
-
}{
|
76
|
-
{{
|
77
|
-
{{end}}}
|
82
|
+
want string
|
83
|
+
}{ {{range .J.Groups}} {{range .Cases}}
|
84
|
+
{{if .IsAddCase}}{ {{.Hour}}, {{.Minute}}, {{.Add}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
|
85
|
+
{{- end}}{{end}}{{end}} }
|
78
86
|
|
79
|
-
{{
|
80
|
-
{{
|
87
|
+
{{with .J.Groups}}
|
88
|
+
// {{ .GroupComment "equal"}}
|
89
|
+
{{end}} type hm struct{ h, m int }
|
81
90
|
|
82
91
|
var eqTests = []struct {
|
83
92
|
c1, c2 hm
|
84
93
|
want bool
|
85
|
-
}{
|
86
|
-
{{
|
94
|
+
}{ {{range .J.Groups}} {{range .Cases}}
|
95
|
+
{{if .IsEqualCase}} // {{.Description}}
|
87
96
|
{
|
88
97
|
hm{ {{.Clock1.Hour}}, {{.Clock1.Minute}}},
|
89
98
|
hm{ {{.Clock2.Hour}}, {{.Clock2.Minute}}},
|
90
99
|
{{.Expected}},
|
91
|
-
},
|
92
|
-
|
100
|
+
}, {{- end}}{{end}}{{end}}
|
101
|
+
}
|
102
|
+
`
|
@@ -1,7 +1,8 @@
|
|
1
1
|
package clock
|
2
2
|
|
3
3
|
// Source: exercism/x-common
|
4
|
-
// Commit:
|
4
|
+
// Commit: 8c7fc0c clock: Fix canonical-data.json formatting
|
5
|
+
// x-common version: 1.0.0
|
5
6
|
|
6
7
|
// Test creating a new clock with an initial time.
|
7
8
|
var timeTests = []struct {
|
@@ -27,6 +28,7 @@ var timeTests = []struct {
|
|
27
28
|
{1, -4820, "16:40"}, // negative minutes roll over continuously
|
28
29
|
{-25, -160, "20:20"}, // negative hour and minutes both roll over
|
29
30
|
{-121, -5810, "22:10"}, // negative hour and minutes both roll over continuously
|
31
|
+
|
30
32
|
}
|
31
33
|
|
32
34
|
// Test adding and subtracting minutes.
|
@@ -34,6 +36,7 @@ var addTests = []struct {
|
|
34
36
|
h, m, a int
|
35
37
|
want string
|
36
38
|
}{
|
39
|
+
|
37
40
|
{10, 0, 3, "10:03"}, // add minutes
|
38
41
|
{6, 41, 0, "06:41"}, // add no minutes
|
39
42
|
{0, 45, 40, "01:25"}, // add to next hour
|
@@ -50,6 +53,7 @@ var addTests = []struct {
|
|
50
53
|
{6, 15, -160, "03:35"}, // subtract more than two hours with borrow
|
51
54
|
{5, 32, -1500, "04:32"}, // subtract more than one day (1500 min = 25 hrs)
|
52
55
|
{2, 20, -3000, "00:20"}, // subtract more than two days
|
56
|
+
|
53
57
|
}
|
54
58
|
|
55
59
|
// Construct two separate clocks, set times, test if they are equal.
|
@@ -59,6 +63,7 @@ var eqTests = []struct {
|
|
59
63
|
c1, c2 hm
|
60
64
|
want bool
|
61
65
|
}{
|
66
|
+
|
62
67
|
// clocks with same time
|
63
68
|
{
|
64
69
|
hm{15, 37},
|
@@ -22,11 +22,12 @@ func main() {
|
|
22
22
|
|
23
23
|
// The JSON structure we expect to be able to unmarshal into
|
24
24
|
type js struct {
|
25
|
-
|
26
|
-
Description
|
25
|
+
Cases []struct {
|
26
|
+
Description string
|
27
27
|
Cases []struct {
|
28
|
-
|
29
|
-
|
28
|
+
Description string
|
29
|
+
Input string
|
30
|
+
Expected string
|
30
31
|
}
|
31
32
|
}
|
32
33
|
}
|
@@ -34,17 +35,19 @@ type js struct {
|
|
34
35
|
// template applied to above data structure generates the Go test cases
|
35
36
|
var tmpl = `package gigasecond
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
{{
|
40
|
-
|
41
|
-
|
38
|
+
{{.Header}}
|
39
|
+
|
40
|
+
{{range .J.Cases}}// {{.Description}}
|
41
|
+
var addCases = []struct {
|
42
|
+
description string
|
42
43
|
in string
|
43
44
|
want string
|
44
45
|
}{
|
45
|
-
{{range .
|
46
|
+
{{range .Cases}}{
|
47
|
+
{{printf "%q" .Description}},
|
46
48
|
{{printf "%q" .Input}},
|
47
49
|
{{printf "%q" .Expected}},
|
48
50
|
},
|
49
|
-
{{end}}}
|
51
|
+
{{end}}{{end}}
|
52
|
+
}
|
50
53
|
`
|
@@ -1,30 +1,37 @@
|
|
1
1
|
package gigasecond
|
2
2
|
|
3
3
|
// Source: exercism/x-common
|
4
|
-
// Commit:
|
4
|
+
// Commit: 61e7d70 Fix "Gigasecond: Schema Compliance"
|
5
|
+
// x-common version: 1.0.0
|
5
6
|
|
6
7
|
// Add one gigasecond to the input.
|
7
8
|
var addCases = []struct {
|
8
|
-
|
9
|
-
|
9
|
+
description string
|
10
|
+
in string
|
11
|
+
want string
|
10
12
|
}{
|
11
13
|
{
|
14
|
+
"date only specification of time",
|
12
15
|
"2011-04-25",
|
13
16
|
"2043-01-01T01:46:40",
|
14
17
|
},
|
15
18
|
{
|
19
|
+
"second test for date only specification of time",
|
16
20
|
"1977-06-13",
|
17
21
|
"2009-02-19T01:46:40",
|
18
22
|
},
|
19
23
|
{
|
24
|
+
"third test for date only specification of time",
|
20
25
|
"1959-07-19",
|
21
26
|
"1991-03-27T01:46:40",
|
22
27
|
},
|
23
28
|
{
|
29
|
+
"full time specified",
|
24
30
|
"2015-01-24T22:00:00",
|
25
31
|
"2046-10-02T23:46:40",
|
26
32
|
},
|
27
33
|
{
|
34
|
+
"full time with day roll-over",
|
28
35
|
"2015-01-24T23:59:59",
|
29
36
|
"2046-10-03T01:46:39",
|
30
37
|
},
|
@@ -28,10 +28,12 @@ func TestAddGigasecond(t *testing.T) {
|
|
28
28
|
want := parse(tc.want, t)
|
29
29
|
got := AddGigasecond(in)
|
30
30
|
if !got.Equal(want) {
|
31
|
-
t.Fatalf(`
|
31
|
+
t.Fatalf(`FAIL: %s
|
32
|
+
AddGigasecond(%s)
|
32
33
|
= %s
|
33
|
-
want %s`, in, got, want)
|
34
|
+
want %s`, tc.description, in, got, want)
|
34
35
|
}
|
36
|
+
t.Log("PASS:", tc.description)
|
35
37
|
}
|
36
38
|
t.Log("Tested", len(addCases), "cases.")
|
37
39
|
}
|