Sha256: 8392dcd63a1a54517172ad09ddb2a5afb3720f068cd5449793aa9dc1a8b4d354

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

require File.dirname(__FILE__)+'/../lib/statsample'
	require 'tmpdir'
require 'test/unit'

class StatsampleCSVTestCase < Test::Unit::TestCase
	def initialize(*args)
        @ds=Statsample::CSV.read(File.dirname(__FILE__)+"/test_csv.csv")
		super
	end
    def test_read
        assert_equal(6,@ds.cases)
        assert_equal(%w{id name age city a1},@ds.fields)
    end
    def test_nil
        assert_equal(nil,@ds['age'][5])
    end
    def test_write
        filename=Dir::tmpdir+"/test_write.csv"
        Statsample::CSV.write(@ds,filename)
        ds2=Statsample::CSV.read(filename)
        i=0
        ds2.each_array{|row|
            assert_equal(@ds.case_as_array(i),row)
               i+=1
        }
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
statsample-0.3.0 test/test_csv.rb
statsample-0.3.1 test/test_csv.rb
statsample-0.3.2 test/test_csv.rb