Sha256: ef45f485293fc13bd56e4cdc60e02e6882aeb7df21f12ebbe9fc1bbb1b49004e

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "../spec_helper.rb"))

describe MPFR::Matrix, "when marshaling" do
  before(:all) do
    MPFR.set_default_prec(128)
  end

  it "should be restore" do
    row = 8
    column = 3
    args = GenerateNumber.float_matrix_arguments(1000, row, column).map{ |a| MPFR::Matrix.new(a) }
    args.each do |m|
      m2 = Marshal.load(Marshal.dump(m))
      m2.should == m
    end
  end
end

describe MPFR::SquareMatrix, "when marshaling" do
  before(:all) do
    MPFR.set_default_prec(128)
  end

  it "should be restore" do
    row = 4
    column = 4
    args = GenerateNumber.float_matrix_arguments(1000, row, column).map{ |a| MPFR::SquareMatrix.new(a) }
    args.each do |m|
      m2 = Marshal.load(Marshal.dump(m))
      m2.should == m
    end
  end
end

describe MPFR::ColumnVector, "when marshaling" do
  before(:all) do
    MPFR.set_default_prec(128)
  end

  it "should be restore" do
    row = 1
    column = 6
    args = GenerateNumber.float_matrix_arguments(1000, row, column).map{ |a| MPFR::ColumnVector.new(a[0]) }
    args.each do |m|
      m2 = Marshal.load(Marshal.dump(m))
      m2.should == m
    end
  end
end

describe MPFR::RowVector, "when marshaling" do
  before(:all) do
    MPFR.set_default_prec(128)
  end

  it "should be restore" do
    row = 1
    column = 6
    args = GenerateNumber.float_matrix_arguments(1000, row, column).map{ |a| MPFR::RowVector.new(a[0]) }
    args.each do |m|
      m2 = Marshal.load(Marshal.dump(m))
      m2.should == m
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-mpfr-0.0.17 spec/mpfr_matrix/mpfr_matrix_marshal_spec.rb
ruby-mpfr-0.0.16 spec/mpfr_matrix/mpfr_matrix_marshal_spec.rb
ruby-mpfr-0.0.15 spec/mpfr_matrix/mpfr_matrix_marshal_spec.rb