Sha256: 270d02cceb3eb0257cc51473e805ac74c55d86d414651e2b1e2d9390e1cea324
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require_relative "../../../lib/stati_stica/pca/cpk" module StatiStica module PCA describe Cpk do describe "new" do context "paramaters contains other than objects convertible to float" do it "raises an ArgumentError" do expect { StatiStica::PCA::Cpk.new(lsl: 1, usl: 1, mean: 1, sd: "2x") }.to raise_error(ArgumentError) end end context "when a paramater is misssing" do it "raises an ArgumentError" do expect { StatiStica::PCA::Cpk.new(lsl: 1, usl: 2, mean: 3) }.to raise_error(ArgumentError) expect { StatiStica::PCA::Cpk.new(lsl: 1, usl: 2, sd: 3) }.to raise_error(ArgumentError) expect { StatiStica::PCA::Cpk.new(lsl: 1, mean: 2, sd: 3) }.to raise_error(ArgumentError) expect { StatiStica::PCA::Cpk.new(usl: 1, mean: 2, sd: 3) }.to raise_error(ArgumentError) end end end describe "#value" do context "when parameters contains only objects convertible to float" do it "returns the ratio between distance from the mean to nearest specification limit and the distance from the mean to the process edge" do # 24 - 9 / 3 * 2 = 15 / 6 = 2.5 # 9 - 0 / 3 * 2 = 9 / 6 = 1.5 # min(2.5, 1.5) = 1.5 expect(StatiStica::PCA::Cpk.new(lsl: 0, usl: 24, mean: 9, sd: 2).value).to eq(1.5) end it "returns the index as float" do expect(StatiStica::PCA::Cpk.new(lsl: 0, usl: 24, mean: 9, sd: 2).value).to be_a(Float) end end context "when standard deviation is zero" do it "returns Infinity" do expect(StatiStica::PCA::Cpk.new(lsl: 0, usl: 24, mean: 9, sd: 0).value).to eq(Float::INFINITY) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stati_stica-0.2.0 | spec/stati_stica/pca/cpk_spec.rb |