bentley_mcilroy 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/aprescott/bentley_mcilroy.png?branch=master)](https://travis-ci.org/aprescott/bentley_mcilroy)
2
+
1
3
  A Ruby implementation of Bentley-McIlroy's data compression scheme to encode
2
4
  compressed versions of strings, and compute deltas between source and target.
3
5
 
@@ -123,11 +125,4 @@ the case of no backward extensions, it is `xabcda<2, 3>y`.
123
125
  # License
124
126
 
125
127
  Copyright (c) Adam Prescott, released under the MIT license. See the license file.
126
-
127
- # TODO
128
-
129
- compress("abcaaaaaa", 1) -> ["abc", [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]
130
-
131
- Can this be fixed to be: ["abc", [0, 1], [3, 5]] ? Essentially following the paper
132
- and picking the longest match on a clash (here, index 0 and index 3 are hit for
133
- index 4, but index 3 leads to a better result when the match is extended forward)
128
+ Any contributions will be assumed to be under the same terms.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "bentley_mcilroy"
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
  s.authors = ["Adam Prescott"]
5
5
  s.email = ["adam@aprescott.com"]
6
6
  s.homepage = "https://github.com/aprescott/bentley_mcilroy"
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.files = Dir["{lib/**/*,test/**/*}"] + %w[LICENSE README.md bentley_mcilroy.gemspec rakefile]
10
10
  s.test_files = Dir["test/*"]
11
11
  s.require_path = "lib"
12
+ s.license = "MIT"
12
13
  s.add_development_dependency "rake"
13
14
  s.add_development_dependency "rspec"
14
15
  end
@@ -18,29 +18,14 @@ describe BentleyMcIlroy::Codec do
18
18
  codec.compress("xabcabcy", 2).should == ["xabca", [2, 2], "y"]
19
19
  end
20
20
 
21
- # "aaaa" should compress down to ["a", [0, 3]]
22
- it "picks the longest match on clashes"
23
-
24
- # 11
25
- # 0123 45678901
26
- # encode("xaby", "abababab", 1) would be more efficiently encoded as
27
- #
28
- # ["x", [1, 2], [4, 6]]
29
- #
30
- # where [4, 6] refers to the decoded target itself, in the style of
31
- # VCDIFF. See RFC3284 section 3, where COPY 4, 4 + COPY 12, 24 is used.
32
- #
33
- # this should probably only be allowed with a flag or something.
34
- #
35
- # note that compress is more efficient for this type of input,
36
- # since the "source" is everything to the left of the current position:
37
- #
38
- # compress("abababab", 1) #=> ["ab", [0, 6]]
39
- it "can refer to its own target"
21
+ # compress("abcaaaaaa", 1) turns into ["abc", [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]
22
+ # which could instead be ["abc", [0, 1], [3, 5]], where the [3, 5] refers to
23
+ # the previously encoded [0, 1].
24
+ it "can refer to previously encoded target data"
40
25
 
41
26
  it "handles binary" do
42
27
  codec = BentleyMcIlroy::Codec
43
- str = ("\x52\303\x66" * 3)
28
+ str = ("\x52\303\x66" * 3) # this is an invalid UTF-8 string
44
29
  str.force_encoding("BINARY") if str.respond_to?(:force_encoding)
45
30
 
46
31
  codec.compress(str, 3).should == ["\x52\303\x66", [0, 6]]
@@ -68,6 +53,23 @@ describe BentleyMcIlroy::Codec do
68
53
  end
69
54
 
70
55
  describe ".encode" do
56
+ # 11
57
+ # 0123 45678901
58
+ # encode("xaby", "abababab", 1) would be more efficiently encoded as
59
+ #
60
+ # ["x", [1, 2], [4, 6]]
61
+ #
62
+ # where [4, 6] refers to the decoded target itself, in the style of
63
+ # VCDIFF. See RFC3284 section 3, where COPY 4, 4 + COPY 12, 24 is used.
64
+ #
65
+ # this should probably only be allowed with a flag or something.
66
+ #
67
+ # note that compress is more efficient for this type of input,
68
+ # since the "source" is everything to the left of the current position:
69
+ #
70
+ # compress("abababab", 1) #=> ["ab", [0, 6]]
71
+ it "can refer to its own target"
72
+
71
73
  it "encodes strings" do
72
74
  codec = BentleyMcIlroy::Codec
73
75
  codec.encode("abcdef", "defghiabc", 3).should == [[3, 3], "ghi", [0, 3]]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bentley_mcilroy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-09 00:00:00.000000000 Z
12
+ date: 2013-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -61,7 +61,8 @@ files:
61
61
  - bentley_mcilroy.gemspec
62
62
  - rakefile
63
63
  homepage: https://github.com/aprescott/bentley_mcilroy
64
- licenses: []
64
+ licenses:
65
+ - MIT
65
66
  post_install_message:
66
67
  rdoc_options: []
67
68
  require_paths: