Sha256: 790718ef0a648476b1b1da7f0098020ba461b78ab211772498ed4ca3e8dc71d0

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

###############################################
####Pruebas Unitarias Matriz Dispersa##########
###############################################

require "test/unit"
require "./lib/matriz.rb"
require "./lib/racional.rb"

class TestMatrizDensa < Test::Unit::TestCase

    
   def testdensa
   
    assert_equal "[[2, 4, 6], [8, 10, 12], [14, 16, 18]]", (Densa.new(3,3,[1,2,3,4,5,6,7,8,9]) + Densa.new(3,3,[1,2,3,4,5,6,7,8,9])).to_s 
    assert_equal "[[0, 0, 0], [0, 0, 0], [0, 0, 0]]", (Densa.new(3,3,[1,2,3,4,5,6,7,8,9]) - Densa.new(3,3,[1,2,3,4,5,6,7,8,9])).to_s 
  
   end

   def fracciones

    assert_equal "[[1/1, 1/1], [1/1, 1/1]]", (MatrizDensa.new(2,2,[Fraccion.new(1,2),Fraccion.new(1,3),Fraccion.new(1,4),Fraccion.new(1,5)]) + MatrizDensa.new(2,2,[Fraccion.new(1,2),Fraccion.new(2,3),Fraccion.new(3,4),Fraccion.new(4,5)])).to_s

    assert_not_equal "[[3/6, 1/1], [1/1, 1/1]]", (MatrizDensa.new(2,2,[Fraccion.new(1,2),Fraccion.new(1,3),Fraccion.new(1,4),Fraccion.new(1,5)]) + MatrizDensa.new(2,2,[Fraccion.new(1,2),Fraccion.new(2,3),Fraccion.new(3,4),Fraccion.new(4,5)])).to_s    

end
   def testdispersa

    assert_equal "[[0,0,2][1,1,4][2,2,6]]", (Dispersa.new(3,3,[0,1,2],[0,1,2],[1,2,3]) + Dispersa.new(3,3,[0,1,2],[0,1,2],[1,2,3])).to_s


   end

   def maxmin
  
    assert_equal(@matrizden1.maximo,9)
    
    assert_equal(@matrizden2.minimo,1)

   end
 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
SparseMatrixProject-0.0.3 test/tc_Matrices.rb