lz4-ruby 0.1.7-x86-mingw32 → 0.2.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -2
- data/README.rdoc +5 -0
- data/Rakefile +15 -8
- data/VERSION +1 -1
- data/lib/1.8/lz4ruby.so +0 -0
- data/lib/1.9/lz4ruby.so +0 -0
- data/lib/lz4-jruby.rb +3 -0
- data/lib/lz4-ruby.rb +2 -0
- data/pom.xml +71 -0
- data/{test → spec}/helper.rb +7 -2
- data/spec/lz4_compressHC_spec.rb +50 -0
- data/spec/lz4_compress_spec.rb +50 -0
- data/src/main/java/com/headius/jruby/lz4/LZ4Internal.java +64 -0
- data/src/main/java/com/headius/jruby/lz4/LZ4Library.java +18 -0
- metadata +35 -74
- data/test/test_lz4-ruby.rb +0 -109
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a100986fd48ee5f814628a1a6abac6750bd2e69d
|
4
|
+
data.tar.gz: f2da6709979c16255d7f115c6e31e7d566cccb2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 79cf651cdf97b88b2070a730b7c85cee55a32ebed600a8d3aec3f1db93330b9af2b0a2101f90b0578ee311316c73d986e8d3c8b35f56a144a70d86052f7f5e43
|
7
|
+
data.tar.gz: 6d864710605c72f9a77da108518e56156ec8cd0c934c52d096e4ac7bc263a9b513f1a28c4f19b1e52e8086375b84b0c20e8a0aa70a0ba9bba60476e915ffd4c7
|
data/Gemfile
CHANGED
@@ -6,9 +6,9 @@ source "http://rubygems.org"
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
|
-
gem "
|
9
|
+
gem "rspec"
|
10
10
|
gem "rdoc", "~> 3.12"
|
11
|
-
gem "bundler"
|
11
|
+
gem "bundler"
|
12
12
|
gem "jeweler", "~> 1.8.3"
|
13
13
|
gem "rake-compiler", ">= 0"
|
14
14
|
end
|
data/README.rdoc
CHANGED
@@ -33,6 +33,7 @@ Tested on VirtualBox VM : 2-core / 4GB RAM (Host : Core i5-2520M / 8GB RAM).
|
|
33
33
|
|
34
34
|
== TODO
|
35
35
|
|
36
|
+
* replace calloc() with xalloc() in lz4hc.c
|
36
37
|
* Write API documents.
|
37
38
|
|
38
39
|
== Copyright
|
@@ -40,6 +41,10 @@ Tested on VirtualBox VM : 2-core / 4GB RAM (Host : Core i5-2520M / 8GB RAM).
|
|
40
41
|
Copyright (c) 2012 KOMIYA Atsushi.
|
41
42
|
See LICENSE.txt for further details.
|
42
43
|
|
44
|
+
== Contributors
|
45
|
+
|
46
|
+
* Charles Oliver Nutter <headius at headius.com>
|
47
|
+
|
43
48
|
== About LZ4
|
44
49
|
|
45
50
|
This Rubygem includes LZ4 codes written by Yann Collet.
|
data/Rakefile
CHANGED
@@ -36,14 +36,10 @@ Jeweler::RubygemsDotOrgTasks.new
|
|
36
36
|
$gemspec = jeweler_tasks.gemspec
|
37
37
|
$gemspec.version = jeweler_tasks.jeweler.version
|
38
38
|
|
39
|
-
require '
|
40
|
-
|
41
|
-
test.libs << 'lib' << 'test'
|
42
|
-
test.pattern = 'test/**/test_*.rb'
|
43
|
-
test.verbose = true
|
44
|
-
end
|
39
|
+
require 'rspec/core/rake_task'
|
40
|
+
RSpec::Core::RakeTask.new(:spec)
|
45
41
|
|
46
|
-
task :default => :
|
42
|
+
task :default => :spec
|
47
43
|
|
48
44
|
require 'rdoc/task'
|
49
45
|
Rake::RDocTask.new do |rdoc|
|
@@ -83,15 +79,26 @@ end
|
|
83
79
|
|
84
80
|
task "build:cross" => [:modify_gemspec_for_windows, :cross, :build] do
|
85
81
|
file = "pkg/lz4-ruby-#{get_version}.gem"
|
86
|
-
mv file, "#{file.ext}-x86-mingw32.gem"
|
87
82
|
end
|
88
83
|
|
84
|
+
task "build:jruby" => [:modify_gemspec_for_jruby, :compile_jruby, :build]
|
85
|
+
|
89
86
|
task :modify_gemspec_for_windows do
|
90
87
|
$gemspec.extensions = []
|
91
88
|
$gemspec.files.include("lib/?.?/*.so")
|
92
89
|
$gemspec.platform = "x86-mingw32"
|
93
90
|
end
|
94
91
|
|
92
|
+
task :modify_gemspec_for_jruby do
|
93
|
+
$gemspec.extensions = []
|
94
|
+
$gemspec.files.include("lib/*.jar")
|
95
|
+
$gemspec.platform = "java"
|
96
|
+
end
|
97
|
+
|
98
|
+
task :compile_jruby do
|
99
|
+
system 'mvn package'
|
100
|
+
end
|
101
|
+
|
95
102
|
def get_version
|
96
103
|
`cat VERSION`.chomp
|
97
104
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/1.8/lz4ruby.so
CHANGED
Binary file
|
data/lib/1.9/lz4ruby.so
CHANGED
Binary file
|
data/lib/lz4-jruby.rb
ADDED
data/lib/lz4-ruby.rb
CHANGED
data/pom.xml
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
2
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
3
|
+
<modelVersion>4.0.0</modelVersion>
|
4
|
+
|
5
|
+
<groupId>com.headius.jruby.lz4</groupId>
|
6
|
+
<artifactId>lz4ruby</artifactId>
|
7
|
+
<version>0.2.0</version>
|
8
|
+
<packaging>jar</packaging>
|
9
|
+
|
10
|
+
<name>lz4ruby</name>
|
11
|
+
<url>http://maven.apache.org</url>
|
12
|
+
|
13
|
+
<properties>
|
14
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
15
|
+
</properties>
|
16
|
+
|
17
|
+
<dependencies>
|
18
|
+
<dependency>
|
19
|
+
<groupId>junit</groupId>
|
20
|
+
<artifactId>junit</artifactId>
|
21
|
+
<version>3.8.1</version>
|
22
|
+
<scope>test</scope>
|
23
|
+
</dependency>
|
24
|
+
<dependency>
|
25
|
+
<groupId>net.jpountz.lz4</groupId>
|
26
|
+
<artifactId>lz4</artifactId>
|
27
|
+
<version>1.1.1</version>
|
28
|
+
</dependency>
|
29
|
+
<dependency>
|
30
|
+
<groupId>org.jruby</groupId>
|
31
|
+
<artifactId>jruby</artifactId>
|
32
|
+
<version>1.7.0</version>
|
33
|
+
<scope>provided</scope>
|
34
|
+
</dependency>
|
35
|
+
</dependencies>
|
36
|
+
|
37
|
+
<build>
|
38
|
+
<plugins>
|
39
|
+
<plugin>
|
40
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
41
|
+
<version>3.1</version>
|
42
|
+
<configuration>
|
43
|
+
<source>1.6</source>
|
44
|
+
<target>1.6</target>
|
45
|
+
</configuration>
|
46
|
+
</plugin>
|
47
|
+
<plugin>
|
48
|
+
<groupId>org.apache.maven.plugins</groupId>
|
49
|
+
<artifactId>maven-shade-plugin</artifactId>
|
50
|
+
<version>2.0</version>
|
51
|
+
<configuration>
|
52
|
+
<relocations>
|
53
|
+
<relocation>
|
54
|
+
<pattern>net.jpountz</pattern>
|
55
|
+
<shadedPattern>com.headius.jruby.lz4.vendor.net.jpountz</shadedPattern>
|
56
|
+
</relocation>
|
57
|
+
</relocations>
|
58
|
+
<outputFile>${basedir}/lib/lz4ruby.jar</outputFile>
|
59
|
+
</configuration>
|
60
|
+
<executions>
|
61
|
+
<execution>
|
62
|
+
<phase>package</phase>
|
63
|
+
<goals>
|
64
|
+
<goal>shade</goal>
|
65
|
+
</goals>
|
66
|
+
</execution>
|
67
|
+
</executions>
|
68
|
+
</plugin>
|
69
|
+
</plugins>
|
70
|
+
</build>
|
71
|
+
</project>
|
data/{test → spec}/helper.rb
RENAMED
@@ -8,7 +8,6 @@ rescue Bundler::BundlerError => e
|
|
8
8
|
exit e.status_code
|
9
9
|
end
|
10
10
|
require 'test/unit'
|
11
|
-
require 'shoulda'
|
12
11
|
|
13
12
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
13
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'ext/lz4ruby'))
|
@@ -24,5 +23,11 @@ EOS
|
|
24
23
|
|
25
24
|
require 'lz4-ruby'
|
26
25
|
|
27
|
-
|
26
|
+
def generate_random_bytes(len)
|
27
|
+
result = []
|
28
|
+
len.times do |t|
|
29
|
+
result << rand(256)
|
30
|
+
end
|
31
|
+
return result.pack("C*")
|
28
32
|
end
|
33
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
|
3
|
+
describe "LZ4::compress" do
|
4
|
+
LOOP_COUNT = 257
|
5
|
+
|
6
|
+
context "give empty text" do
|
7
|
+
compressed = LZ4.compressHC("")
|
8
|
+
uncompressed = LZ4.uncompress(compressed)
|
9
|
+
|
10
|
+
it "should be able to uncompress" do
|
11
|
+
expect(uncompressed).to eql("")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "give long text" do
|
16
|
+
text = "a" * 131073
|
17
|
+
compressed = LZ4.compressHC(text)
|
18
|
+
uncompressed = LZ4.uncompress(compressed)
|
19
|
+
|
20
|
+
it "should be able to uncompress" do
|
21
|
+
expect(uncompressed).to eql(text)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
LOOP_COUNT.times do |t|
|
26
|
+
len = t + 1
|
27
|
+
text = "a" * len
|
28
|
+
|
29
|
+
context "give text of #{len} \"a\"'s" do
|
30
|
+
compressed = LZ4.compressHC(text)
|
31
|
+
uncompressed = LZ4.uncompress(compressed)
|
32
|
+
it "should be able to uncompress" do
|
33
|
+
expect(uncompressed).to eql(text)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
LOOP_COUNT.times do |t|
|
39
|
+
len = t + 1
|
40
|
+
text = generate_random_bytes(len)
|
41
|
+
|
42
|
+
context "give text of #{len} bytes" do
|
43
|
+
compressed = LZ4.compressHC(text)
|
44
|
+
uncompressed = LZ4.uncompress(compressed)
|
45
|
+
it "should be able to uncompress" do
|
46
|
+
expect(uncompressed).to eql(text)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
|
3
|
+
describe "LZ4::compress" do
|
4
|
+
LOOP_COUNT = 257
|
5
|
+
|
6
|
+
context "give empty text" do
|
7
|
+
compressed = LZ4.compress("")
|
8
|
+
uncompressed = LZ4.uncompress(compressed)
|
9
|
+
|
10
|
+
it "should be able to uncompress" do
|
11
|
+
expect(uncompressed).to eql("")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "give long text" do
|
16
|
+
text = "a" * 131073
|
17
|
+
compressed = LZ4.compress(text)
|
18
|
+
uncompressed = LZ4.uncompress(compressed)
|
19
|
+
|
20
|
+
it "should be able to uncompress" do
|
21
|
+
expect(uncompressed).to eql(text)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
LOOP_COUNT.times do |t|
|
26
|
+
len = t + 1
|
27
|
+
text = "a" * len
|
28
|
+
|
29
|
+
context "give text of #{len} \"a\"'s" do
|
30
|
+
compressed = LZ4.compress(text)
|
31
|
+
uncompressed = LZ4.uncompress(compressed)
|
32
|
+
it "should be able to uncompress" do
|
33
|
+
expect(uncompressed).to eql(text)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
LOOP_COUNT.times do |t|
|
39
|
+
len = t + 1
|
40
|
+
text = generate_random_bytes(len)
|
41
|
+
|
42
|
+
context "give text of #{len} bytes" do
|
43
|
+
compressed = LZ4.compress(text)
|
44
|
+
uncompressed = LZ4.uncompress(compressed)
|
45
|
+
it "should be able to uncompress" do
|
46
|
+
expect(uncompressed).to eql(text)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
package com.headius.jruby.lz4;
|
2
|
+
|
3
|
+
import net.jpountz.lz4.LZ4Compressor;
|
4
|
+
import net.jpountz.lz4.LZ4Factory;
|
5
|
+
import org.jruby.RubyInteger;
|
6
|
+
import org.jruby.RubyString;
|
7
|
+
import org.jruby.anno.JRubyMethod;
|
8
|
+
import org.jruby.runtime.ThreadContext;
|
9
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
10
|
+
import org.jruby.util.ByteList;
|
11
|
+
|
12
|
+
public class LZ4Internal {
|
13
|
+
private static final LZ4Factory FACTORY = LZ4Factory.fastestInstance();
|
14
|
+
|
15
|
+
public static IRubyObject compress_internal(ThreadContext context, LZ4Compressor compressor, IRubyObject _header, IRubyObject _input, IRubyObject _in_size) {
|
16
|
+
RubyString input = _input.convertToString();
|
17
|
+
RubyString header = _header.convertToString();
|
18
|
+
RubyInteger in_size = _in_size.convertToInteger();
|
19
|
+
|
20
|
+
ByteList inputBL = input.getByteList();
|
21
|
+
int srcSize = (int)in_size.getLongValue();
|
22
|
+
|
23
|
+
ByteList headerBL = header.getByteList();
|
24
|
+
int headerSize = headerBL.getRealSize();
|
25
|
+
|
26
|
+
int bufSize = compressor.maxCompressedLength(srcSize);
|
27
|
+
byte[] buf = new byte[bufSize + headerSize];
|
28
|
+
|
29
|
+
System.arraycopy(headerBL.getUnsafeBytes(), headerBL.getBegin(), buf, 0, headerSize);
|
30
|
+
|
31
|
+
compressor.compress(inputBL.getUnsafeBytes(), inputBL.getBegin(), srcSize, buf, headerSize);
|
32
|
+
|
33
|
+
return RubyString.newStringNoCopy(context.runtime, buf);
|
34
|
+
}
|
35
|
+
|
36
|
+
@JRubyMethod(module = true)
|
37
|
+
public static IRubyObject compress(ThreadContext context, IRubyObject self, IRubyObject _header, IRubyObject _input, IRubyObject _in_size) {
|
38
|
+
return compress_internal(context, FACTORY.fastCompressor(), _header, _input, _in_size);
|
39
|
+
}
|
40
|
+
|
41
|
+
@JRubyMethod(module = true)
|
42
|
+
public static IRubyObject compressHC(ThreadContext context, IRubyObject self, IRubyObject _header, IRubyObject _input, IRubyObject _in_size) {
|
43
|
+
return compress_internal(context, FACTORY.highCompressor(), _header, _input, _in_size);
|
44
|
+
}
|
45
|
+
|
46
|
+
@JRubyMethod(required = 4, module = true)
|
47
|
+
public static IRubyObject uncompress(ThreadContext context, IRubyObject self, IRubyObject[] args) {
|
48
|
+
RubyString input = args[0].convertToString();
|
49
|
+
RubyInteger in_size = args[1].convertToInteger();
|
50
|
+
RubyInteger header_size = args[2].convertToInteger();
|
51
|
+
RubyInteger buf_size = args[3].convertToInteger();
|
52
|
+
|
53
|
+
ByteList inputBL = input.getByteList();
|
54
|
+
int inSize = (int)in_size.getLongValue();
|
55
|
+
int headerSize = (int)header_size.getLongValue();
|
56
|
+
int bufSize = (int)buf_size.getLongValue();
|
57
|
+
|
58
|
+
byte[] buf = new byte[bufSize];
|
59
|
+
|
60
|
+
FACTORY.decompressor().decompress(inputBL.getUnsafeBytes(), inputBL.getBegin() + headerSize, buf, 0, buf.length);
|
61
|
+
|
62
|
+
return RubyString.newStringNoCopy(context.runtime, buf);
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
package com.headius.jruby.lz4;
|
2
|
+
|
3
|
+
import java.io.IOException;
|
4
|
+
import org.jruby.Ruby;
|
5
|
+
import org.jruby.RubyModule;
|
6
|
+
import org.jruby.runtime.load.Library;
|
7
|
+
|
8
|
+
public class LZ4Library implements Library {
|
9
|
+
|
10
|
+
public void load(Ruby runtime, boolean wrap) throws IOException {
|
11
|
+
RubyModule lz4Internal = runtime.defineModule("LZ4Internal");
|
12
|
+
|
13
|
+
lz4Internal.defineAnnotatedMethods(LZ4Internal.class);
|
14
|
+
|
15
|
+
lz4Internal.defineClassUnder("Error", runtime.getStandardError(), runtime.getStandardError().getAllocator());
|
16
|
+
}
|
17
|
+
|
18
|
+
}
|
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lz4-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 7
|
10
|
-
version: 0.1.7
|
4
|
+
version: 0.2.0
|
11
5
|
platform: x86-mingw32
|
12
6
|
authors:
|
13
7
|
- KOMIYA Atsushi
|
@@ -15,83 +9,55 @@ autorequire:
|
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
11
|
|
18
|
-
date:
|
12
|
+
date: 2013-12-02 00:00:00 Z
|
19
13
|
dependencies:
|
20
14
|
- !ruby/object:Gem::Dependency
|
21
|
-
type: :development
|
22
|
-
name: shoulda
|
23
|
-
prerelease: false
|
24
15
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
16
|
requirements:
|
27
|
-
-
|
17
|
+
- &id003
|
18
|
+
- ">="
|
28
19
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
20
|
version: "0"
|
33
|
-
requirement: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
21
|
type: :development
|
36
|
-
name:
|
22
|
+
name: rspec
|
37
23
|
prerelease: false
|
24
|
+
requirement: *id001
|
25
|
+
- !ruby/object:Gem::Dependency
|
38
26
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
27
|
requirements:
|
41
28
|
- - ~>
|
42
29
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 31
|
44
|
-
segments:
|
45
|
-
- 3
|
46
|
-
- 12
|
47
30
|
version: "3.12"
|
31
|
+
type: :development
|
32
|
+
name: rdoc
|
33
|
+
prerelease: false
|
48
34
|
requirement: *id002
|
49
35
|
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- *id003
|
50
39
|
type: :development
|
51
40
|
name: bundler
|
52
41
|
prerelease: false
|
53
|
-
|
54
|
-
|
42
|
+
requirement: *id004
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
55
45
|
requirements:
|
56
46
|
- - ~>
|
57
47
|
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 1
|
61
|
-
- 0
|
62
|
-
- 0
|
63
|
-
version: 1.0.0
|
64
|
-
requirement: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version: 1.8.3
|
66
49
|
type: :development
|
67
50
|
name: jeweler
|
68
51
|
prerelease: false
|
69
|
-
|
70
|
-
none: false
|
71
|
-
requirements:
|
72
|
-
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 49
|
75
|
-
segments:
|
76
|
-
- 1
|
77
|
-
- 8
|
78
|
-
- 3
|
79
|
-
version: 1.8.3
|
80
|
-
requirement: *id004
|
52
|
+
requirement: *id005
|
81
53
|
- !ruby/object:Gem::Dependency
|
54
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- *id003
|
82
57
|
type: :development
|
83
58
|
name: rake-compiler
|
84
59
|
prerelease: false
|
85
|
-
|
86
|
-
none: false
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
94
|
-
requirement: *id005
|
60
|
+
requirement: *id006
|
95
61
|
description: Ruby bindings for LZ4. LZ4 is a very fast lossless compression algorithm.
|
96
62
|
email: komiya.atsushi@gmail.com
|
97
63
|
executables: []
|
@@ -122,41 +88,36 @@ files:
|
|
122
88
|
- ext/lz4ruby/lz4ruby.c
|
123
89
|
- lib/1.8/lz4ruby.so
|
124
90
|
- lib/1.9/lz4ruby.so
|
91
|
+
- lib/lz4-jruby.rb
|
125
92
|
- lib/lz4-ruby.rb
|
126
|
-
-
|
127
|
-
-
|
93
|
+
- pom.xml
|
94
|
+
- spec/helper.rb
|
95
|
+
- spec/lz4_compressHC_spec.rb
|
96
|
+
- spec/lz4_compress_spec.rb
|
97
|
+
- src/main/java/com/headius/jruby/lz4/LZ4Internal.java
|
98
|
+
- src/main/java/com/headius/jruby/lz4/LZ4Library.java
|
128
99
|
homepage: http://github.com/komiya-atsushi/lz4-ruby
|
129
100
|
licenses:
|
130
101
|
- MIT
|
102
|
+
metadata: {}
|
103
|
+
|
131
104
|
post_install_message:
|
132
105
|
rdoc_options: []
|
133
106
|
|
134
107
|
require_paths:
|
135
108
|
- lib
|
136
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
110
|
requirements:
|
139
|
-
-
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
hash: 3
|
142
|
-
segments:
|
143
|
-
- 0
|
144
|
-
version: "0"
|
111
|
+
- *id003
|
145
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
113
|
requirements:
|
148
|
-
-
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
hash: 3
|
151
|
-
segments:
|
152
|
-
- 0
|
153
|
-
version: "0"
|
114
|
+
- *id003
|
154
115
|
requirements: []
|
155
116
|
|
156
117
|
rubyforge_project:
|
157
|
-
rubygems_version:
|
118
|
+
rubygems_version: 2.0.14
|
158
119
|
signing_key:
|
159
|
-
specification_version:
|
120
|
+
specification_version: 4
|
160
121
|
summary: Ruby bindings for LZ4 (Extremely Fast Compression algorithm).
|
161
122
|
test_files: []
|
162
123
|
|
data/test/test_lz4-ruby.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestLz4Ruby < Test::Unit::TestCase
|
4
|
-
LOOP_COUNT = 257
|
5
|
-
|
6
|
-
srand(123)
|
7
|
-
|
8
|
-
def self.random_bytes(len)
|
9
|
-
result = []
|
10
|
-
len.times do |t|
|
11
|
-
result << rand(256)
|
12
|
-
end
|
13
|
-
return result.pack("C*")
|
14
|
-
end
|
15
|
-
|
16
|
-
context "LZ4::compress" do
|
17
|
-
should "empty text" do
|
18
|
-
compressed = LZ4::compress("")
|
19
|
-
uncompressed = LZ4::uncompress(compressed)
|
20
|
-
assert_equal("", uncompressed)
|
21
|
-
end
|
22
|
-
|
23
|
-
should "long text" do
|
24
|
-
text = "a" * 131073
|
25
|
-
compressed = LZ4.compress(text)
|
26
|
-
uncompressed = LZ4.uncompress(compressed)
|
27
|
-
assert_equal(text, uncompressed)
|
28
|
-
end
|
29
|
-
|
30
|
-
LOOP_COUNT.times do |t|
|
31
|
-
len = t + 1
|
32
|
-
text = "a" * len
|
33
|
-
|
34
|
-
should "text of #{len} \"a\"'s" do
|
35
|
-
compressed = LZ4::compress(text)
|
36
|
-
uncompressed = LZ4::uncompress(compressed)
|
37
|
-
assert_equal(text, uncompressed)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
LOOP_COUNT.times do |t|
|
42
|
-
len = t + 1
|
43
|
-
text = random_bytes(len)
|
44
|
-
|
45
|
-
should "random text of #{len} bytes" do
|
46
|
-
compressed = LZ4::compress(text)
|
47
|
-
uncompressed = LZ4::uncompress(compressed)
|
48
|
-
assert_equal(text, uncompressed)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
text = "b" * LOOP_COUNT
|
53
|
-
LOOP_COUNT.times do |t|
|
54
|
-
len = t + 1
|
55
|
-
should "#{len} bytes substring of #{LOOP_COUNT} bytes \"b\"'s" do
|
56
|
-
compressed = LZ4::compress(text, len)
|
57
|
-
uncompressed = LZ4::uncompress(compressed)
|
58
|
-
assert_equal(text[0, len], uncompressed)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context "LZ4::compressHC" do
|
64
|
-
should "empty text" do
|
65
|
-
compressed = LZ4::compressHC("")
|
66
|
-
uncompressed = LZ4::uncompress(compressed)
|
67
|
-
assert_equal("", uncompressed)
|
68
|
-
end
|
69
|
-
|
70
|
-
should "long text" do
|
71
|
-
text = "a" * 131073
|
72
|
-
compressed = LZ4.compressHC(text)
|
73
|
-
uncompressed = LZ4.uncompress(compressed)
|
74
|
-
assert_equal(text, uncompressed)
|
75
|
-
end
|
76
|
-
|
77
|
-
LOOP_COUNT.times do |t|
|
78
|
-
len = t + 1
|
79
|
-
text = "a" * len
|
80
|
-
|
81
|
-
should "text of #{len} \"a\"'s" do
|
82
|
-
compressed = LZ4::compressHC(text)
|
83
|
-
uncompressed = LZ4::uncompress(compressed)
|
84
|
-
assert_equal(text, uncompressed)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
LOOP_COUNT.times do |t|
|
89
|
-
len = t + 1
|
90
|
-
text = random_bytes(len)
|
91
|
-
|
92
|
-
should "random text of #{len} bytes" do
|
93
|
-
compressed = LZ4::compressHC(text)
|
94
|
-
uncompressed = LZ4::uncompress(compressed)
|
95
|
-
assert_equal(text, uncompressed)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
text = "b" * LOOP_COUNT
|
100
|
-
LOOP_COUNT.times do |t|
|
101
|
-
len = t + 1
|
102
|
-
should "#{len} bytes substring of #{LOOP_COUNT} bytes \"b\"'s" do
|
103
|
-
compressed = LZ4::compressHC(text, len)
|
104
|
-
uncompressed = LZ4::uncompress(compressed)
|
105
|
-
assert_equal(text[0, len], uncompressed)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|