trackler 2.0.0.4 → 2.0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 930373b0c5670419a14e779c478608d57004bd93
4
- data.tar.gz: 0f5bd0b92f26975bfa7a090b7b4b16bb4824f52f
3
+ metadata.gz: 0ad43d193656b92d10fd9344553cf30d66baae72
4
+ data.tar.gz: fa8601209c89c67e01b4e8d3b797a3fc98271692
5
5
  SHA512:
6
- metadata.gz: 626a0ea3510ad74ff08a010e9f3539fb8b9e128a1921953994ffa9755051712c23e123f808300c75d4c1d9e2d7e835d3580e13e23697183ac792c163624e9854
7
- data.tar.gz: 961075ac95564c32b9ac6eaf618c2f9765961c06c13caa9d12bbbd6b9458be177fe0105d644e61efab7bc964002358d3f56a85caafbdd9585de19df7c9888c53
6
+ metadata.gz: ad7e2dba3130960687bf8c0dc7b4e0184e4d2951d10090d740af794de761d986e3c88aab193c5678627f9ed9908fe3bfea57c936c694f97c299896bbab2afcda
7
+ data.tar.gz: b7b933be55c8174b41730383df120ddf5aabd607cf9ef38054ee222df76058d73b8a012249ec1915ce3d529a1d6131469ab7ec684f4c5c0b25fabdc57040babc
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.0.4"
2
+ VERSION = "2.0.0.5"
3
3
  end
@@ -4,8 +4,6 @@
4
4
 
5
5
  (def short-vector [1, 3, 4, 6, 8, 9, 11])
6
6
 
7
- (def unsorted-vector [2, 1, 4, 3, 6])
8
-
9
7
  (def large-vector [1, 3, 5, 8, 13, 21, 34, 55, 89])
10
8
 
11
9
  (def even-length-vector [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377])
@@ -382,6 +382,12 @@
382
382
  "topics": [
383
383
  ]
384
384
  },
385
+ {
386
+ "slug": "dominoes",
387
+ "difficulty": 8,
388
+ "topics": [
389
+ ]
390
+ },
385
391
  {
386
392
  "slug": "sgf-parsing",
387
393
  "difficulty": 9,
@@ -0,0 +1,16 @@
1
+ name: dominoes
2
+
3
+ dependencies:
4
+ - base
5
+
6
+ library:
7
+ exposed-modules: Dominoes
8
+ source-dirs: src
9
+
10
+ tests:
11
+ test:
12
+ main: Tests.hs
13
+ source-dirs: test
14
+ dependencies:
15
+ - dominoes
16
+ - hspec
@@ -0,0 +1,15 @@
1
+ module Dominoes (chain) where
2
+
3
+ import Data.List (delete)
4
+ import Data.Maybe (listToMaybe, mapMaybe)
5
+
6
+ chain :: [(Int, Int)] -> Maybe [(Int, Int)]
7
+ chain [] = Just []
8
+ chain (x@(left, right):xs) = fmap (x:) (subchain xs left right)
9
+
10
+ subchain :: [(Int, Int)] -> Int -> Int -> Maybe [(Int, Int)]
11
+ subchain [] chainLeft chainRight = if chainLeft == chainRight then Just [] else Nothing
12
+ subchain l chainLeft chainRight = listToMaybe (mapMaybe subchain' l)
13
+ where subchain' (a, b) | a == chainRight = fmap ((a, b):) (subchain (delete (a, b) l) chainLeft b)
14
+ subchain' (a, b) | b == chainRight = fmap ((b, a):) (subchain (delete (a, b) l) chainLeft a)
15
+ subchain' _ = Nothing
@@ -0,0 +1,19 @@
1
+ name: dominoes
2
+
3
+ dependencies:
4
+ - base
5
+
6
+ library:
7
+ exposed-modules: Dominoes
8
+ source-dirs: src
9
+ dependencies:
10
+ # - foo # List here the packages you
11
+ # - bar # want to use in your solution.
12
+
13
+ tests:
14
+ test:
15
+ main: Tests.hs
16
+ source-dirs: test
17
+ dependencies:
18
+ - dominoes
19
+ - hspec
@@ -0,0 +1,4 @@
1
+ module Dominoes (chain) where
2
+
3
+ chain :: [(Int, Int)] -> Maybe [(Int, Int)]
4
+ chain dominoes = undefined
@@ -0,0 +1 @@
1
+ resolver: nightly-2016-07-17
@@ -0,0 +1,108 @@
1
+ {-# LANGUAGE FlexibleContexts #-}
2
+ {-# LANGUAGE RecordWildCards #-}
3
+
4
+ import Control.Monad (forM_, unless)
5
+ import Data.Foldable (for_)
6
+ import Data.Function (on)
7
+ import Test.Hspec (Spec, describe, expectationFailure, it, shouldBe, shouldMatchList)
8
+ import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
9
+ import Text.Printf (printf)
10
+
11
+ import Dominoes (chain)
12
+
13
+ main :: IO ()
14
+ main = hspecWith defaultConfig {configFastFail = True} specs
15
+
16
+ specs :: Spec
17
+ specs = describe "dominoes" $
18
+ describe "chain" $ for_ cases test
19
+ where
20
+
21
+ test Case{..} = it description assertion
22
+ where
23
+ assertion = if expected
24
+ then shouldBeChain $ chain input
25
+ else chain input `shouldBe` Nothing
26
+
27
+ shouldBeChain Nothing = expectationFailure "should have had a chain, but didn't"
28
+ shouldBeChain (Just output) = do
29
+ output `shouldMatchDominoesOf` input
30
+ consecutivesShouldMatch output
31
+ endsShouldMatch output
32
+
33
+ shouldMatchDominoesOf = shouldMatchList `on` map sortDomino
34
+
35
+ consecutivesShouldMatch l = forM_ (indexedPairs l) $ \(d1, d2, i) ->
36
+ shouldBeConsecutive l ("domino " ++ show i, d1) ("domino " ++ show (i + 1), d2)
37
+
38
+ endsShouldMatch [] = return ()
39
+ endsShouldMatch l@(d1:_) =
40
+ shouldBeConsecutive l (" last domino", last l) ("first domino", d1)
41
+
42
+ indexedPairs :: [a] -> [(a, a, Int)]
43
+ indexedPairs l = zip3 l (drop 1 l) [1..]
44
+
45
+ sortDomino (a, b) = if a > b then (b, a) else (a, b)
46
+
47
+ shouldBeConsecutive l (name1, d1@(_, d1r)) (name2, d2@(d2l, _)) =
48
+ unless (d1r == d2l) $
49
+ expectationFailure $
50
+ printf "In chain %s:\n\t right end of %s (%s)\n\tand left end of %s (%s)\n\tdidn't match!" (show l) name1 (show d1) name2 (show d2)
51
+
52
+ -- Test cases adapted from `exercism/x-common/dominoes` on 2016-11-11.
53
+
54
+ data Case = Case { description :: String
55
+ , input :: [(Int, Int)]
56
+ , expected :: Bool
57
+ }
58
+
59
+ cases :: [Case]
60
+ cases = [ Case { description = "empty input = empty output"
61
+ , input = []
62
+ , expected = True
63
+ }
64
+ , Case { description = "singleton input = singleton output"
65
+ , input = [(1, 1)]
66
+ , expected = True
67
+ }
68
+ , Case { description = "singleton that can't be chained"
69
+ , input = [(1, 2)]
70
+ , expected = False
71
+ }
72
+ , Case { description = "three elements"
73
+ , input = [(1, 2), (3, 1), (2, 3)]
74
+ , expected = True
75
+ }
76
+ , Case { description = "can reverse dominoes"
77
+ , input = [(1, 2), (1, 3), (2, 3)]
78
+ , expected = True
79
+ }
80
+ , Case { description = "can't be chained"
81
+ , input = [(1, 2), (4, 1), (2, 3)]
82
+ , expected = False
83
+ }
84
+ , Case { description = "disconnected - simple"
85
+ , input = [(1, 1), (2, 2)]
86
+ , expected = False
87
+ }
88
+ , Case { description = "disconnected - double loop"
89
+ , input = [(1, 2), (2, 1), (3, 4), (4, 3)]
90
+ , expected = False
91
+ }
92
+ , Case { description = "disconnected - single isolated"
93
+ , input = [(1, 2), (2, 3), (3, 1), (4, 4)]
94
+ , expected = False
95
+ }
96
+ , Case { description = "need backtrack"
97
+ , input = [(1, 2), (2, 3), (3, 1), (2, 4), (2, 4)]
98
+ , expected = True
99
+ }
100
+ , Case { description = "separate loops"
101
+ , input = [(1, 2), (2, 3), (3, 1), (1, 1), (2, 2), (3, 3)]
102
+ , expected = True
103
+ }
104
+ , Case { description = "ten elements"
105
+ , input = [(1, 2), (5, 3), (3, 1), (1, 2), (2, 4), (1, 6), (2, 3), (3, 4), (5, 6)]
106
+ , expected = True
107
+ }
108
+ ]
@@ -5,7 +5,13 @@ if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}
5
5
  fail('Please rebase to get rid of the merge commits in this PR')
6
6
  end
7
7
  can_merge = github.pr_json["mergeable"]
8
- warn("This PR cannot be merged yet.", sticky: false) unless can_merge
8
+ is_merged = github.pr_json["merged"]
9
+
10
+ if is_merged
11
+ warn("This PR was merged before CI was done.", sticky: false)
12
+ else
13
+ warn("This PR cannot be merged yet.", sticky: false) unless can_merge
14
+ end
9
15
 
10
16
  # Make it more obvious that a PR is a work in progress and shouldn't be merged yet
11
17
  warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
@@ -5,7 +5,13 @@ if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}
5
5
  fail('Please rebase to get rid of the merge commits in this PR')
6
6
  end
7
7
  can_merge = github.pr_json["mergeable"]
8
- warn("This PR cannot be merged yet.", sticky: false) unless can_merge
8
+ is_merged = github.pr_json["merged"]
9
+
10
+ if is_merged
11
+ warn("This PR was merged before CI was done.", sticky: false)
12
+ else
13
+ warn("This PR cannot be merged yet.", sticky: false) unless can_merge
14
+ end
9
15
 
10
16
  # Make it more obvious that a PR is a work in progress and shouldn't be merged yet
11
17
  warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
@@ -20,9 +26,9 @@ warn("Please provide a summary in the Pull Request description") if github.pr_bo
20
26
  jsonpath = "lintreport.json"
21
27
  contents = File.read jsonpath
22
28
  require "json"
23
- if contents.to_s == ''
29
+ if contents.to_s == ''
24
30
  contents = "[]"
25
- end
31
+ end
26
32
  json = JSON.parse contents
27
33
  json.each do |object|
28
34
  shortFile = object["file"]
@@ -30,7 +36,7 @@ json.each do |object|
30
36
  shortFile = shortFile.to_s || ''
31
37
  msg = object["reason"].to_s || ''
32
38
  line = object["line"] || 1
33
- #only warn for files that were edited in this PR.
39
+ #only warn for files that were edited in this PR.
34
40
  if git.modified_files.include? shortFile
35
41
  shortFile.prepend("/") # get away from doing inline comments since they are buggy as of Sep-2016
36
42
  warn(msg, file: shortFile, line: line)
@@ -45,6 +51,3 @@ contents2 = File.read jsonpath2
45
51
  json2 = JSON.parse contents2
46
52
  firstStrinInArray = json2["tests_summary_messages"][0]
47
53
  message(firstStrinInArray)
48
-
49
-
50
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.4
4
+ version: 2.0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-11 00:00:00.000000000 Z
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -2907,6 +2907,12 @@ files:
2907
2907
  - tracks/haskell/exercises/difference-of-squares/src/Squares.hs
2908
2908
  - tracks/haskell/exercises/difference-of-squares/stack.yaml
2909
2909
  - tracks/haskell/exercises/difference-of-squares/test/Tests.hs
2910
+ - tracks/haskell/exercises/dominoes/examples/success-standard/package.yaml
2911
+ - tracks/haskell/exercises/dominoes/examples/success-standard/src/Dominoes.hs
2912
+ - tracks/haskell/exercises/dominoes/package.yaml
2913
+ - tracks/haskell/exercises/dominoes/src/Dominoes.hs
2914
+ - tracks/haskell/exercises/dominoes/stack.yaml
2915
+ - tracks/haskell/exercises/dominoes/test/Tests.hs
2910
2916
  - tracks/haskell/exercises/etl/examples/success-standard/package.yaml
2911
2917
  - tracks/haskell/exercises/etl/examples/success-standard/src/ETL.hs
2912
2918
  - tracks/haskell/exercises/etl/package.yaml