trackler 2.0.8.48 → 2.0.8.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f9103d1bb0fccad3f8e1a1268d1e27805e27221
4
- data.tar.gz: 4c3d8b30edf248fc9ffbba8d61013cc0f976c5b5
3
+ metadata.gz: 48201089c77e7b81845af6440956854c37235757
4
+ data.tar.gz: c8df11ee44d68548e4dc45916eb772d42db76d18
5
5
  SHA512:
6
- metadata.gz: c5ab069fa0635df70cb2cffa4fd5515d8be46e14994dee37191f9c748c580a5c33827f39180c2a76612197567c9e7633fbbd88631c14add8fe026484746e502d
7
- data.tar.gz: 2990d6c65e663be910fd127207db947485b3725a577d56934de2c44861aee2c847ec97712ed6da4bdb46a26a14e115a872551b0a7d342ab65990630c38e9b996
6
+ metadata.gz: 8c8ee5ad1aa4951cc1960e272f54ee5928757809050c731a15c4c68c76031b1ec7410315dd58479dea955c5f889fdcfd9cf2bcb35c3676c912df549b317cd59f
7
+ data.tar.gz: 8871ec457aebdc4366e1c910a2a2fdf95a44e309d32ea9d113435f3d5f23f2c5d2e9913e19708dd13f72460d5163a6f45f3682f89ecaea041fb4bef555c6d159
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.8.48"
2
+ VERSION = "2.0.8.49"
3
3
  end
@@ -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
- Create struct {
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
- // Handle the three tests similarly
40
-
41
- type timeCase struct {
42
- Description string
43
- Hour, Minute int
44
- Expected string
28
+ type TestGroups []struct {
29
+ Description string
30
+ Cases []OneCase
45
31
  }
46
- type addCase struct {
47
- Description string
48
- Hour, Minute, Add int
49
- Expected string
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
- type eqCase struct {
52
- Description string
53
- Clock1, Clock2 struct{ Hour, Minute int }
54
- Expected bool
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
- // Source: {{.Ori}}
60
- {{if .Commit}}// Commit: {{.Commit}}
61
- {{end}}
67
+ {{.Header}}
62
68
 
63
- {{range .J.Create.Description}}// {{.}}
64
- {{end}}var timeTests = []struct {
69
+ {{with .J.Groups}}
70
+ // {{ .GroupComment "create"}}
71
+ {{end}} var timeTests = []struct {
65
72
  h, m int
66
73
  want string
67
- }{
68
- {{range .J.Create.Cases}}{ {{.Hour}}, {{.Minute}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
69
- {{end}}}
74
+ }{ {{range .J.Groups}} {{range .Cases}}
75
+ {{if .IsTimeCase}}{ {{.Hour}}, {{.Minute}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
76
+ {{- end}}{{end}}{{end}} }
70
77
 
71
- {{range .J.Add.Description}}// {{.}}
72
- {{end}}var addTests = []struct {
78
+ {{with .J.Groups}}
79
+ // {{ .GroupComment "add"}}
80
+ {{end}} var addTests = []struct {
73
81
  h, m, a int
74
- want string
75
- }{
76
- {{range .J.Add.Cases}}{ {{.Hour}}, {{.Minute}}, {{.Add}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
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
- {{range .J.Equal.Description}}// {{.}}
80
- {{end}}type hm struct{ h, m int }
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
- {{range .J.Equal.Cases}}// {{.Description}}
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
- {{end}}}`
100
+ }, {{- end}}{{end}}{{end}}
101
+ }
102
+ `
@@ -1,7 +1,8 @@
1
1
  package clock
2
2
 
3
3
  // Source: exercism/x-common
4
- // Commit: 180638f Merge pull request #217 from ErikSchierboom/patch-2
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
- Add struct {
26
- Description []string
25
+ Cases []struct {
26
+ Description string
27
27
  Cases []struct {
28
- Input string
29
- Expected string
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
- // Source: {{.Ori}}
38
- {{if .Commit}}// Commit: {{.Commit}}
39
- {{end}}
40
- {{range .J.Add.Description}}// {{.}}
41
- {{end}}var addCases = []struct {
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 .J.Add.Cases}}{
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: 1e9e232 Merge pull request #45 from soniakeys/gigasecond-tests
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
- in string
9
- want string
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(`AddGigasecond(%s)
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
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8.48
4
+ version: 2.0.8.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen