From 4e2f8659fb36a5cb6e047323e4e31c961cc01c22 Mon Sep 17 00:00:00 2001 From: Archivist Date: Sat, 11 Aug 2018 12:17:12 +0200 Subject: [PATCH] Slicing confiremed to work in tests --- spec/crystal-scatter_spec.cr | 15 +++++++++++++++ src/crystal-scatter/metaring.cr | 12 ++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/spec/crystal-scatter_spec.cr b/spec/crystal-scatter_spec.cr index e759233..3ae5c40 100644 --- a/spec/crystal-scatter_spec.cr +++ b/spec/crystal-scatter_spec.cr @@ -3,6 +3,21 @@ require "./spec_helper" describe Crystal::Scatter do # TODO: Write tests + it "slices data into multiple pods" do + mr = Crystal::Scatter::MetaRing.new(3) + mr.add Crystal::Scatter::Daemon.new(1,[0,0,0,0,0,0],"OSD0") + mr.add [Crystal::Scatter::Daemon.new(1,[0,0,0,0,0,1],"OSD1"),Crystal::Scatter::Daemon.new(1,[0,0,0,0,0,2],"OSD2")] + + (1..1000).each do |numb| + slices = mr.get_slices_for(numb.to_s) + set = Set(String).new + slices.each do |sl| + set<