Sha256: c89a0d5ca18161ed1dee0a65a54a8793aa3aa9397d7a51cec0341a58014ea1a3

Contents?: true

Size: 946 Bytes

Versions: 15

Compression:

Stored size: 946 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Quandl::Operation::Transform do
  
  subject{ Quandl::Operation::Transform }
  
  describe ".perform" do
    
    it "should handle empty data" do
      subject.perform( [], :rdiff ).should eq []
    end
  
    it "should handle empty data" do
      subject.perform( [nil], :cumul ).should eq [nil]
    end
  
    it "should rdiff_from" do
      data = [[1,3,5],[4,5,4],[5,15,20]]
      result = subject.perform(data, :rdiff_from)
      result.should eq [[1,4,3],[4,2,4],[5,0,0]]      
    end
    it "should cumul asc" do
      data = [[1000, 10], [1001, 20], [1002, 30]]
      result = subject.perform(data, :cumul)
      result.should eq [[1000, 10], [1001, 30], [1002, 60]]
    end
    it "should cumul desc" do
      data = [[1002, 30], [1001, 20], [1000, 10]]
      result = subject.perform(data, :cumul)
      result.should eq [[1002, 60], [1001, 30], [1000, 10]]
    end
    
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
quandl_operation-0.4.1 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.4.0 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.3.2 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.3.1 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.3.0 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.2.1 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.2.0 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.23 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.22 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.21 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.20 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.19 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.18 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.17 spec/lib/quandl/operation/transform_spec.rb
quandl_operation-0.1.16 spec/lib/quandl/operation/transform_spec.rb