Skip to content

Commit

Permalink
Funciona el benchmark y el ordenar el menu por lo tanto fin de la prá…
Browse files Browse the repository at this point in the history
…ctica
  • Loading branch information
alu0100799101 committed Dec 21, 2018
1 parent 6558e4c commit ae7dd78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion spec/lista_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@
end
it "Prueba para ordenar menus sort_for,sort_each,sort " do
expect(@array_menu.sort_for).to eq([355.66, 373.02000000000004, 373.66, 437.96000000000004, 438.6, 450.6, 668.96, 669.6, 681.6, 699.6])

expect(@array_menu.sort_each).to eq([355.66, 373.02000000000004, 373.66, 437.96000000000004, 438.6, 450.6, 668.96, 669.6, 681.6, 699.6])
expect(@array_menu.map{|x| x.reduce(:+)}.sort).to eq([355.66, 373.02000000000004, 373.66, 437.96000000000004, 438.6, 450.6, 668.96, 669.6, 681.6, 699.6])
end

it "Benchmark para Array y ListValue" do
Expand All @@ -315,7 +316,13 @@
x.report("for -> Lista:") {n.times do @lista_individuos.sort_for; end}
x.report("each -> Lista:"){n.times do @lista_individuos.sort_each; end}
x.report("sort -> Lista:"){n.times do @lista_individuos.map{ |x| x.geT}.sort;end}

x.report("for -> Array:") {n.times do @array_menu.sort_for; end}
x.report("each -> Array:"){n.times do @array_menu.sort_each; end}
x.report("sort -> Array:"){n.times do @array_menu.map{ |x| x.reduce(:+)}.sort; end}



end


Expand Down
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "coveralls"
Coveralls.wear!
require"gema"
require"gema/lista"
require"gema/nutricion"
Expand Down Expand Up @@ -105,4 +106,4 @@
Kernel.srand config.seed
=end
end
Coveralls.wear!

0 comments on commit ae7dd78

Please sign in to comment.