ccsv-e 0.1.0
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/ext/extconf.rb +4 -0
- data/lib/ccsv.bundle +0 -0
- data/test/unit/test_ccsv.rb +61 -0
- metadata +69 -0
data/ext/extconf.rb
ADDED
data/lib/ccsv.bundle
ADDED
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'ccsv'
|
4
|
+
require 'benchmark'
|
5
|
+
|
6
|
+
# Yeah, I know.
|
7
|
+
begin
|
8
|
+
require 'csv'
|
9
|
+
require 'rubygems'
|
10
|
+
require 'fastercsv'
|
11
|
+
require 'lightcsv'
|
12
|
+
require 'csvscan'
|
13
|
+
|
14
|
+
module CSVScan
|
15
|
+
def self.foreach(file, &block)
|
16
|
+
open(file) do |f|
|
17
|
+
scan(f, &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
rescue LoadError
|
23
|
+
end
|
24
|
+
|
25
|
+
class TestCcsv < Test::Unit::TestCase
|
26
|
+
|
27
|
+
def setup
|
28
|
+
@dir = "#{File.dirname(__FILE__)}/../"
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_should_raise
|
32
|
+
assert_raises(RuntimeError) do
|
33
|
+
Ccsv.foreach('fdssfd') do
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_accuracy
|
39
|
+
ccsv = []
|
40
|
+
file = @dir + "data_small.csv"
|
41
|
+
Ccsv.foreach(file) do |values|
|
42
|
+
ccsv << values.dup
|
43
|
+
end
|
44
|
+
csv = []
|
45
|
+
CSV.foreach(file) do |values|
|
46
|
+
csv << values
|
47
|
+
end
|
48
|
+
assert_equal csv, ccsv
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_speed
|
52
|
+
[Ccsv, FasterCSV, CSV].each do |klass| # CSVScan, LightCsv,
|
53
|
+
Benchmark.bm do |x|
|
54
|
+
x.report(klass.name) do
|
55
|
+
klass.foreach(@dir + "data.csv") do |values| end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ccsv-e
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Evan Weaver
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-06 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email:
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions:
|
27
|
+
- ext/extconf.rb
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/ccsv.bundle
|
32
|
+
- test/unit/test_ccsv.rb
|
33
|
+
- ext/extconf.rb
|
34
|
+
has_rdoc: true
|
35
|
+
homepage:
|
36
|
+
licenses: []
|
37
|
+
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
hash: 3
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.3.7
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: Pure-C CSV
|
68
|
+
test_files:
|
69
|
+
- test/unit/test_ccsv.rb
|