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.

@@ -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