Sha256: 06a8b12d1d955d6e8b7570d411456faf226df21f827cc81fbc33523bdb621d96

Contents?: true

Size: 824 Bytes

Versions: 3

Compression:

Stored size: 824 Bytes

Contents

require File.expand_path(File.join(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

3 entries across 3 versions & 1 rubygems

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