gibbler 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +0,0 @@
1
-
2
- library :gibbler, File.dirname(__FILE__), '..', 'lib'
3
- library 'gibbler/history', File.dirname(__FILE__), '..', 'lib'
4
-
5
- group "History"
6
-
7
- Gibbler.enable_debug if Tryouts.verbose > 3
8
-
9
-
10
- tryouts "Exceptions" do
11
-
12
- dream :exception, Gibbler::BadDigest
13
- drill "raises exception when reverting to unknown gibble" do
14
- a = {}
15
- a.gibbler_commit
16
- a.gibbler_revert! '2222222222222222222222222222222222222222'
17
- end
18
-
19
- dream :exception, Gibbler::NoHistory
20
- drill "raises exception when reverting and there's no history" do
21
- a = []
22
- a.gibbler_revert!
23
- end
24
-
25
- dream :exception, NoMethodError
26
- drill "raises exception when reverting an unsupported object" do
27
- :kimmy.gibbler_revert!
28
- end
29
-
30
- end
@@ -1,80 +0,0 @@
1
-
2
- library :gibbler, File.dirname(__FILE__), '..', 'lib'
3
- group "Performance"
4
-
5
- tryouts "Speed", :benchmark do
6
- # NOTE: gibbler is slower when history is enabled.
7
- drill "Setup variables" do
8
- @@array = (1..10000).map { rand }
9
- values = (1..10000).map { rand }
10
- zipped = @@array.zip(values)
11
- @@hash = Hash[*zipped]
12
- end
13
-
14
- drill "Array#hash", 5 do
15
- @@array.hash
16
- end
17
-
18
-
19
- # dream :mean, 0.21
20
- drill "Array#gibbler", 5 do
21
- @@array.gibbler
22
- end
23
-
24
- drill "Hash#hash", 5 do
25
- @@hash.hash
26
- end
27
-
28
- # dream :mean, 1.4
29
- drill "Hash#gibbler", 5 do
30
- @@hash.gibbler
31
- end
32
-
33
- end
34
-
35
- repetitions = 100 # at 100_000 hash shows errors
36
- sample_size = 1..100
37
-
38
- tryouts "Uniqueness", :api do
39
-
40
- drill "Array#hash, all unique", 0 do
41
- seen = []
42
- repetitions.times do
43
- srand
44
- seen << ((sample_size).map { rand }).hash
45
- end
46
- seen.size - seen.uniq.size
47
- end
48
-
49
- drill "Hash#hash, all unique", 0 do
50
- seen = []
51
- repetitions.times do
52
- srand
53
- seen << Hash[*(sample_size).map { rand }.zip((sample_size).map { rand })].hash
54
- end
55
- seen.size - seen.uniq.size
56
- end
57
-
58
- drill "Array#gibbler, all unique", 0 do
59
- seen = []
60
- repetitions.times do
61
- srand
62
- seen << ((sample_size).map { rand }).gibbler
63
- end
64
- seen.size - seen.uniq.size
65
- end
66
-
67
- drill "Hash#gibbler, all unique", 0 do
68
- seen = []
69
- repetitions.times do
70
- srand
71
- seen << Hash[*(sample_size).map { rand }.zip((sample_size).map { rand })].gibbler
72
- end
73
- seen.size - seen.uniq.size
74
- end
75
-
76
-
77
-
78
-
79
-
80
- end
@@ -1,65 +0,0 @@
1
-
2
- group "Aliases"
3
-
4
- library :gibbler, 'lib'
5
- library 'gibbler/aliases', 'lib'
6
- library 'gibbler/history', 'lib'
7
-
8
- tryouts "Gibbler::Object Aliases" do
9
-
10
- drill "has digest", true do
11
- :kimmy.gibbler == :kimmy.digest
12
- end
13
-
14
- drill "has digest_cache", true do
15
- a = :kimmy.gibbler
16
- a.gibbler_cache == a.digest_cache
17
- end
18
-
19
- drill "has changed?", true do
20
- a = "kimmy"
21
- a.digest
22
- a << '+ dj'
23
- a.gibbled?
24
- end
25
-
26
- end
27
-
28
-
29
- tryouts "Gibbler::History Aliases" do
30
-
31
- dream "d7049916ddb25e6cc438b1028fb957e5139f9910"
32
- drill "can convert short digest into long" do
33
- a = { :magic => :original }
34
- g = a.commit.short
35
- stash :short, g
36
- a.find_long g
37
- end
38
-
39
- dream :class, Time
40
- drill "can return most recent stamp" do
41
- a = { :magic => :original }
42
- a.commit
43
- stash :hist, a.history
44
- a.stamp
45
- end
46
-
47
- dream ["d7049916ddb25e6cc438b1028fb957e5139f9910", "0b11c377fccd44554a601e5d2b135c46dc1c4cb1"]
48
- drill "can return history" do
49
- a = { :magic => :original }
50
- a.commit
51
- a[:magic] = :changed
52
- a.commit
53
- a.history
54
- end
55
-
56
- dream ["d7049916", "0b11c377"]
57
- drill "can return history (short)" do
58
- a = { :magic => :original }
59
- a.commit
60
- a[:magic] = :changed
61
- a.commit
62
- a.history(:short)
63
- end
64
-
65
- end
@@ -1,30 +0,0 @@
1
-
2
- library :gibbler, File.dirname(__FILE__), '..', 'lib'
3
- group "Object#hash"
4
-
5
- tryout "Object#hash (Ruby 1.9 only)", :api do
6
-
7
- drill "Object", Object.hash, 1892070
8
- drill "Class", Class.hash, 1892030
9
- drill "Array", Array.hash, 1866770
10
- drill "Hash", Hash.hash, 1863840
11
-
12
- end
13
-
14
- tryouts "Object#hash (Ruby 1.8 only)", :api do
15
-
16
- drill "Object", Object.hash, 118420
17
- drill "Class", Class.hash, 118400
18
- drill "Array", Array.hash, 104100
19
- drill "Hash", Hash.hash, 102590
20
-
21
- end
22
-
23
- tryouts "Object#hash (JRuby only)", :api do
24
-
25
- drill "Object", Object.hash, 1
26
- drill "Class", Class.hash, 3
27
- drill "Array", Array.hash, 46
28
- drill "Hash", Hash.hash, 43
29
-
30
- end