ccsv 0.1.2 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ccsv might be problematic. Click here for more details.
- data/CHANGELOG +4 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +23 -0
- data/Manifest +4 -3
- data/README.rdoc +32 -5
- data/Rakefile +11 -1
- data/ccsv.gemspec +15 -18
- data/compile +7 -0
- data/ext/ccsv.c +145 -12
- data/ext/ccsv.h +4 -1
- data/spec/ccsv_spec.rb +134 -0
- metadata +12 -54
- data.tar.gz.sig +0 -1
- data/test/data.csv +0 -1000000
- data/test/data_small.csv +0 -1000
- data/test/unit/test_ccsv.rb +0 -60
- metadata.gz.sig +0 -0
data/test/unit/test_ccsv.rb
DELETED
@@ -1,60 +0,0 @@
|
|
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 'lightcsv'
|
11
|
-
require 'csvscan'
|
12
|
-
|
13
|
-
module CSVScan
|
14
|
-
def self.foreach(file, &block)
|
15
|
-
open(file) do |f|
|
16
|
-
scan(f, &block)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
rescue LoadError
|
22
|
-
end
|
23
|
-
|
24
|
-
class TestCcsv < Test::Unit::TestCase
|
25
|
-
|
26
|
-
def setup
|
27
|
-
@dir = "#{File.dirname(__FILE__)}/../"
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_should_raise
|
31
|
-
assert_raises(RuntimeError) do
|
32
|
-
Ccsv.foreach('fdssfd') do
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_accuracy
|
38
|
-
ccsv = []
|
39
|
-
file = @dir + "data_small.csv"
|
40
|
-
Ccsv.foreach(file) do |values|
|
41
|
-
ccsv << values.dup
|
42
|
-
end
|
43
|
-
csv = []
|
44
|
-
CSV.foreach(file) do |values|
|
45
|
-
csv << values
|
46
|
-
end
|
47
|
-
assert_equal csv, ccsv
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_speed
|
51
|
-
Benchmark.bm(5) do |x|
|
52
|
-
[Ccsv, CSV].each do |klass| # CSVScan, LightCsv,
|
53
|
-
x.report(klass.name) do
|
54
|
-
klass.foreach(@dir + "data.csv") do |values| end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
metadata.gz.sig
DELETED
Binary file
|