mmap2 2.2.7 → 2.2.8
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 +4 -4
- data/ext/mmap/mmap.c +883 -1110
- data/lib/mmap/version.rb +1 -1
- data/lib/mmap.rb +1 -1
- data/test/test_mmap.rb +24 -21
- metadata +3 -2
data/lib/mmap/version.rb
CHANGED
data/lib/mmap.rb
CHANGED
data/test/test_mmap.rb
CHANGED
@@ -58,21 +58,21 @@ class TestMmap < Minitest::Test
|
|
58
58
|
max = @str.size * 2
|
59
59
|
72.times do
|
60
60
|
ran1 = rand(max)
|
61
|
-
|
62
|
-
|
61
|
+
assert(@str[ran1] == @mmap[ran1], "<aref>");
|
62
|
+
assert(@str[-ran1] == @mmap[-ran1], "<aref>");
|
63
63
|
ran2 = rand(max)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
64
|
+
assert(@str[ran1, ran2] == @mmap[ran1, ran2], "<double aref>");
|
65
|
+
assert(@str[-ran1, ran2] == @mmap[-ran1, ran2], "<double aref>");
|
66
|
+
assert(@str[ran1, -ran2] == @mmap[ran1, -ran2], "<double aref>");
|
67
|
+
assert(@str[-ran1, -ran2] == @mmap[-ran1, -ran2], "<double aref>");
|
68
|
+
assert(@str[ran1 .. ran2] == @mmap[ran1 .. ran2], "<double aref>");
|
69
|
+
assert(@str[-ran1 .. ran2] == @mmap[-ran1 .. ran2], "<double aref>");
|
70
|
+
assert(@str[ran1 .. -ran2] == @mmap[ran1 .. -ran2], "<double aref>");
|
71
|
+
assert(@str[-ran1 .. -ran2] == @mmap[-ran1 .. -ran2], "<double aref>");
|
72
72
|
end
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
assert(@str[/if/] == @mmap[/if/], "<aref regexp>")
|
74
|
+
assert(@str[/real/] == @mmap[/real/], "<aref regexp>")
|
75
|
+
assert(@str[/none/] == @mmap[/none/], "<aref regexp>")
|
76
76
|
end
|
77
77
|
|
78
78
|
def internal_aset(a, b = nil, c = true)
|
@@ -189,9 +189,11 @@ class TestMmap < Minitest::Test
|
|
189
189
|
end
|
190
190
|
@mmap.sub!(/GetMmap/, 'XXXX'); @str.sub!(/GetMmap/, 'XXXX')
|
191
191
|
assert_equal(@str, @mmap.to_str, "<after sub!>")
|
192
|
-
|
192
|
+
#TODO: implement gsub!
|
193
|
+
#@mmap.gsub!(/GetMmap/, 'XXXX'); @str.gsub!(/GetMmap/, 'XXXX')
|
193
194
|
assert_equal(@mmap.to_str, @str, "<after gsub!>")
|
194
|
-
|
195
|
+
#TODO: implement gsub!
|
196
|
+
# @mmap.gsub!(/YYYY/, 'XXXX'); @str.gsub!(/YYYY/, 'XXXX')
|
195
197
|
assert_equal(@mmap.to_str, @str, "<after gsub!>")
|
196
198
|
assert_equal(@mmap.split(/\w+/), @str.split(/\w+/), "<split>")
|
197
199
|
assert_equal(@mmap.split(/\W+/), @str.split(/\W+/), "<split>")
|
@@ -300,12 +302,10 @@ class TestMmap < Minitest::Test
|
|
300
302
|
@mmap.match("rb_match_busy").offset(0), "match")
|
301
303
|
assert_equal(@str.match(/rb_../).offset(0),
|
302
304
|
@mmap.match(/rb_../).offset(0), "match")
|
303
|
-
|
304
|
-
@mmap.match("rb_match_buzy"), "no match")
|
305
|
+
assert(@str.match("rb_match_buzy") == @mmap.match("rb_match_buzy"), "no match")
|
305
306
|
assert_equal(@str =~ /rb_match_busy/,
|
306
307
|
@mmap =~ /rb_match_busy/, "match")
|
307
|
-
|
308
|
-
@mmap =~ /rb_match_buzy/, "no match")
|
308
|
+
assert((@str =~ /rb_match_buzy/) == (@mmap =~ /rb_match_buzy/), "no match")
|
309
309
|
end
|
310
310
|
assert_raises(RuntimeError) { @mmap[12] = "a" }
|
311
311
|
end
|
@@ -360,8 +360,11 @@ class TestMmap < Minitest::Test
|
|
360
360
|
assert_equal("a", m0[0,1], "get")
|
361
361
|
end
|
362
362
|
assert_equal(m0, m0.sub!(/./) { "y" }, "sub")
|
363
|
-
|
364
|
-
|
363
|
+
|
364
|
+
# TODO: implement gsub
|
365
|
+
# assert_equal(m0, m0.gsub!(/./) { "x" }, "gsub")
|
366
|
+
# assert_equal("x" * 12, m0.to_str, "retrieve")
|
367
|
+
|
365
368
|
assert_equal("ab", m0[1..2] = "ab", "range")
|
366
369
|
assert_raises(TypeError) { m0[1..2] = "abc" }
|
367
370
|
assert_raises(ArgumentError) { m0.lock }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmap2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Decoux
|
@@ -10,13 +10,14 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-11-14 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: The Mmap class implement memory-mapped file objects for Ruby 2.x
|
16
16
|
email:
|
17
17
|
- ts@moulon.inra.fr
|
18
18
|
- tenderlove@github.com
|
19
19
|
- lyda@gitlab.com
|
20
|
+
- pawel@gitlab.com
|
20
21
|
executables: []
|
21
22
|
extensions:
|
22
23
|
- ext/mmap/extconf.rb
|