spec/probability_spec.rb in games_dice-0.3.7 vs spec/probability_spec.rb in games_dice-0.3.8
- old
+ new
@@ -514,6 +514,14 @@
h[20].should be_within(1e-10).of 1/400.0
end
end # describe "#repeat_n_sum_k"
end # describe "instance methods"
+
+ describe "serialisation via Marshall" do
+ it "can load a saved GamesDice::Probabilities" do
+ pd6 = File.open( fixture('probs_fair_die_6.dat') ) { |file| Marshal.load(file) }
+ pd6.to_h.should be_valid_distribution
+ pd6.p_gt(4).should be_within(1e-10).of 1.0/3
+ end
+ end
end