~ubuntu-branches/ubuntu/hardy/libtioga-ruby/hardy

« back to all changes in this revision

Viewing changes to tests/tc_Dvector.rb

  • Committer: Bazaar Package Importer
  • Author(s): Vincent Fourmond
  • Date: 2007-06-03 21:11:47 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20070603211147-fcvoehrkf95k1fzl
Tags: upstream-1.6
ImportĀ upstreamĀ versionĀ 1.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        return "#{dir}/#{file_name}"
17
17
      end
18
18
    end
 
19
 
 
20
    # Checks if the internal Is_Dvector is working properly,
 
21
    # as it seems problematic in Ruby 1.9
 
22
    def test_isa_dvector
 
23
      a = Dvector.new
 
24
      assert(Dvector.is_a_dvector(a))
 
25
    end
19
26
    
20
27
    def test_read_nasty_fortran_data
21
28
        row = Dvector.read_row(real_file_name("dvector_read_test.data"))
771
778
      assert_equal(v, v_bis)
772
779
    end
773
780
 
 
781
    NB_NUMBERS = 10000
 
782
    def test_stress_marshall
 
783
      1.times do 
 
784
        v = Dvector.new
 
785
        1.upto(NB_NUMBERS) do 
 
786
          v << rand * 10 ** (100 - 100 * rand)
 
787
        end
 
788
        s = Marshal.dump(v)
 
789
        v_bis = Marshal.restore(s)
 
790
        assert_equal(v, v_bis)
 
791
      end
 
792
    end
 
793
 
774
794
    def test_bounds
775
795
      v = Dvector[0.0/0.0, 0.0/0.0, 1,2,4,5,9,0.0/0.0,0.1]
776
796
      assert_equal(v.bounds, [0.1, 9])
787
807
      assert_equal(a,c)
788
808
      assert_equal(b,d)
789
809
    end
 
810
 
790
811
    
791
812
end