tdiff 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/ChangeLog.md +4 -0
- data/Gemfile +13 -0
- data/Rakefile +6 -31
- data/gemspec.yml +1 -3
- data/lib/tdiff/tdiff.rb +1 -1
- data/lib/tdiff/version.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/tdiff_examples.rb +14 -14
- data/spec/tdiff_spec.rb +13 -13
- data/spec/unordered_spec.rb +2 -2
- metadata +18 -53
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba7729ae82c1c53666417fcf4bc11e8ac808aac3
|
4
|
+
data.tar.gz: ea2304121fa503bd0dc4f987939b65193ae5a580
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f7b3f28012237e0da54930eaae0250d7e180a2e4d52e5de49109e312bf973669c92fddae940648da166cc2a76d37e92c066c0a980bdf34ed652754dffbcf4bdf
|
7
|
+
data.tar.gz: 2d1c0e60dcbe4a007fdab798d848c42cc83df7f1edc4269827539b8d7d9ef10bea6842df949da9b4d2dac4fe135c35a414a6737acdfb759ed61d38675fc5df00
|
data/.gitignore
CHANGED
data/ChangeLog.md
CHANGED
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -1,36 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'rubygems/tasks'
|
3
|
+
Gem::Tasks.new
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
require 'rubygems/tasks'
|
7
|
-
|
8
|
-
Gem::Tasks.new
|
9
|
-
rescue LoadError => e
|
10
|
-
warn e.message
|
11
|
-
warn "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
|
12
|
-
end
|
13
|
-
|
14
|
-
begin
|
15
|
-
gem 'rspec', '~> 2.4'
|
16
|
-
require 'rspec/core/rake_task'
|
17
|
-
|
18
|
-
RSpec::Core::RakeTask.new
|
19
|
-
rescue LoadError => e
|
20
|
-
task :spec do
|
21
|
-
abort "Please run `gem install rspec` to install RSpec."
|
22
|
-
end
|
23
|
-
end
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new
|
24
7
|
task :test => :spec
|
25
8
|
task :default => :spec
|
26
9
|
|
27
|
-
|
28
|
-
|
29
|
-
require 'yard'
|
30
|
-
|
31
|
-
YARD::Rake::YardocTask.new
|
32
|
-
rescue LoadError => e
|
33
|
-
task :yard do
|
34
|
-
abort "Please run `gem install yard` to install YARD."
|
35
|
-
end
|
36
|
-
end
|
10
|
+
require 'yard'
|
11
|
+
YARD::Rake::YardocTask.new
|
data/gemspec.yml
CHANGED
data/lib/tdiff/tdiff.rb
CHANGED
data/lib/tdiff/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/tdiff_examples.rb
CHANGED
@@ -5,36 +5,36 @@ shared_examples_for 'TDiff' do |method|
|
|
5
5
|
include Helpers::Trees
|
6
6
|
|
7
7
|
it "should tell if two trees are identical" do
|
8
|
-
|
9
|
-
change == ' '
|
10
|
-
|
8
|
+
expect(
|
9
|
+
@tree.send(method,@tree).all? { |change,node| change == ' ' }
|
10
|
+
).to be true
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should stop if the root nodes have changed" do
|
14
14
|
changes = @tree.send(method,@different_root).to_a
|
15
15
|
|
16
|
-
changes.length.
|
16
|
+
expect(changes.length).to be 2
|
17
17
|
|
18
|
-
changes[0][0].
|
19
|
-
changes[0][1].
|
18
|
+
expect(changes[0][0]).to be == '-'
|
19
|
+
expect(changes[0][1]).to be == @tree
|
20
20
|
|
21
|
-
changes[1][0].
|
22
|
-
changes[1][1].
|
21
|
+
expect(changes[1][0]).to be == '+'
|
22
|
+
expect(changes[1][1]).to be == @different_root
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should tell when sub-nodes are added" do
|
26
26
|
changes = @tree.send(method,@added).select { |change,node| change == '+' }
|
27
27
|
|
28
|
-
changes.length.
|
29
|
-
changes[0][0].
|
30
|
-
changes[0][1].
|
28
|
+
expect(changes.length).to be 1
|
29
|
+
expect(changes[0][0]).to be == '+'
|
30
|
+
expect(changes[0][1]).to be == @added.children[0].children[1]
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should tell when sub-nodes are removed" do
|
34
34
|
changes = @tree.send(method,@removed).select { |change,node| change == '-' }
|
35
35
|
|
36
|
-
changes.length.
|
37
|
-
changes[0][0].
|
38
|
-
changes[0][1].
|
36
|
+
expect(changes.length).to be 1
|
37
|
+
expect(changes[0][0]).to be == '-'
|
38
|
+
expect(changes[0][1]).to be == @tree.children[0].children[1]
|
39
39
|
end
|
40
40
|
end
|
data/spec/tdiff_spec.rb
CHANGED
@@ -11,24 +11,24 @@ describe TDiff do
|
|
11
11
|
it "should detect when the order of children has changed" do
|
12
12
|
changes = @tree.tdiff(@changed_order).to_a
|
13
13
|
|
14
|
-
changes.length.
|
14
|
+
expect(changes.length).to be == 6
|
15
15
|
|
16
|
-
changes[0][0].
|
17
|
-
changes[0][1].
|
16
|
+
expect(changes[0][0]).to be == ' '
|
17
|
+
expect(changes[0][1]).to be == @tree
|
18
18
|
|
19
|
-
changes[1][0].
|
20
|
-
changes[1][1].
|
19
|
+
expect(changes[1][0]).to be == '-'
|
20
|
+
expect(changes[1][1]).to be == @tree.children[0]
|
21
21
|
|
22
|
-
changes[2][0].
|
23
|
-
changes[2][1].
|
22
|
+
expect(changes[2][0]).to be == ' '
|
23
|
+
expect(changes[2][1]).to be == @tree.children[1]
|
24
24
|
|
25
|
-
changes[3][0].
|
26
|
-
changes[3][1].
|
25
|
+
expect(changes[3][0]).to be == '+'
|
26
|
+
expect(changes[3][1]).to be == @changed_order.children[1]
|
27
27
|
|
28
|
-
changes[4][0].
|
29
|
-
changes[4][1].
|
28
|
+
expect(changes[4][0]).to be == ' '
|
29
|
+
expect(changes[4][1]).to be == @tree.children[1].children[0]
|
30
30
|
|
31
|
-
changes[5][0].
|
32
|
-
changes[5][1].
|
31
|
+
expect(changes[5][0]).to be == ' '
|
32
|
+
expect(changes[5][1]).to be == @tree.children[1].children[1]
|
33
33
|
end
|
34
34
|
end
|
data/spec/unordered_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe TDiff::Unordered do
|
|
11
11
|
include TDiff::Unordered
|
12
12
|
end
|
13
13
|
|
14
|
-
base.
|
14
|
+
expect(base).to include(TDiff)
|
15
15
|
end
|
16
16
|
|
17
17
|
it_should_behave_like 'TDiff', :tdiff_unordered
|
@@ -21,6 +21,6 @@ describe TDiff::Unordered do
|
|
21
21
|
change != ' '
|
22
22
|
end
|
23
23
|
|
24
|
-
changes.
|
24
|
+
expect(changes).to be_empty
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,64 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Postmodern
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-06-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0
|
19
|
+
version: '1.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rspec
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '2.4'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '2.4'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: yard
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0.7'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.7'
|
26
|
+
version: '1.0'
|
62
27
|
description: Calculates the differences between two tree-like structures. Similar
|
63
28
|
to Rubys built-in TSort module.
|
64
29
|
email: postmodern.mod3@gmail.com
|
@@ -69,12 +34,13 @@ extra_rdoc_files:
|
|
69
34
|
- LICENSE.txt
|
70
35
|
- README.md
|
71
36
|
files:
|
72
|
-
- .document
|
73
|
-
- .gemtest
|
74
|
-
- .gitignore
|
75
|
-
- .rspec
|
76
|
-
- .yardopts
|
37
|
+
- ".document"
|
38
|
+
- ".gemtest"
|
39
|
+
- ".gitignore"
|
40
|
+
- ".rspec"
|
41
|
+
- ".yardopts"
|
77
42
|
- ChangeLog.md
|
43
|
+
- Gemfile
|
78
44
|
- LICENSE.txt
|
79
45
|
- README.md
|
80
46
|
- Rakefile
|
@@ -93,26 +59,25 @@ files:
|
|
93
59
|
homepage: https://github.com/postmodern/tdiff#readme
|
94
60
|
licenses:
|
95
61
|
- MIT
|
62
|
+
metadata: {}
|
96
63
|
post_install_message:
|
97
64
|
rdoc_options: []
|
98
65
|
require_paths:
|
99
66
|
- lib
|
100
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
68
|
requirements:
|
103
|
-
- -
|
69
|
+
- - ">="
|
104
70
|
- !ruby/object:Gem::Version
|
105
71
|
version: 1.8.7
|
106
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
73
|
requirements:
|
109
|
-
- -
|
74
|
+
- - ">="
|
110
75
|
- !ruby/object:Gem::Version
|
111
76
|
version: '0'
|
112
77
|
requirements: []
|
113
78
|
rubyforge_project:
|
114
|
-
rubygems_version:
|
79
|
+
rubygems_version: 2.6.14
|
115
80
|
signing_key:
|
116
|
-
specification_version:
|
81
|
+
specification_version: 4
|
117
82
|
summary: Calculates the differences between two tree-like structures.
|
118
83
|
test_files: []
|