Sha256: 654e2c9b21e5ab0009059d7a9233994af779bfb92c7d8ac68da241f4538f5f33

Contents?: true

Size: 852 Bytes

Versions: 5

Compression:

Stored size: 852 Bytes

Contents

require 'spec_helper.rb'

describe Daru::Accessors::NMatrixWrapper do
  before :each do
    stub_context = Object.new
    @nm_wrapper = Daru::Accessors::NMatrixWrapper.new([1,2,3,4,5], stub_context, :float32)
  end

  it "checks for actual NMatrix creation" do
    expect(@nm_wrapper.data.class).to eq(NMatrix)
  end

  it "checks the actual size of the NMatrix object" do
    expect(@nm_wrapper.data.size).to eq(10)
  end

  it "checks that @size is the number of elements in the vector" do
    expect(@nm_wrapper.size).to eq(5)
  end

  it "checks for underlying NMatrix data type" do
    expect(@nm_wrapper.data.dtype).to eq(:float32)
  end

  it "resizes" do
    @nm_wrapper.resize(100)

    expect(@nm_wrapper.size).to eq(5)
    expect(@nm_wrapper.data.size).to eq(100)
    expect(@nm_wrapper.data).to eq(NMatrix.new [100], [1,2,3,4,5])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
daru-0.2.2 spec/accessors/nmatrix_wrapper_spec.rb
daru-0.2.1 spec/accessors/nmatrix_wrapper_spec.rb
daru-0.2.0 spec/accessors/nmatrix_wrapper_spec.rb
daru-0.1.6 spec/accessors/nmatrix_wrapper_spec.rb
daru-0.1.5 spec/accessors/nmatrix_wrapper_spec.rb