Sha256: 5342e5ef6898a2cd81ff087e7a193bea0ad9c05e6d6edf5441daf5dc729144a8

Contents?: true

Size: 794 Bytes

Versions: 4

Compression:

Stored size: 794 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe MPFR::Matrix, "when MPFR instance is converted to string by some methods." do
  
  before(:all) do
    MPFR.set_default_prec(128)
    @row = 2
    @column = 3
    @matrixes = ((0..100).map { |i| MPFR::Matrix.new(GenerateNumber.float_arguments(@column, @row)) })
  end

  it "should return array having strings." do
    @matrixes.each do |m|
      m.str_ary("%.Re").each_with_index do |s, i|
        s.to_s.should eql m[i % @row, i / @row].to_s
      end
    end
  end

  it "should return inspect string." do
    @matrixes.each do |m|
      ins = m.inspect
      ins.should match(/#{Regexp.escape(sprintf("%x", m.object_id))}/)
      m.each do |a|
        ins.should match(/#{Regexp.escape(a.to_s)}/)
      end
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-mpfr-0.0.7 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.6 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.5 spec/mpfr_matrix/mpfr_matrix_string_spec.rb
ruby-mpfr-0.0.4 spec/mpfr_matrix/mpfr_matrix_string_spec.rb