Sha256: adc80b4cfc218453ffdabc5ef2add21d9844abbdea1063c236f74a32aa60211a

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

# -*- coding: utf-8 -*-

require File.dirname(__FILE__) + '/../../spec_helper'

describe Kmeans::Pair do
  context 'の Pair クラスにおいて' do
    describe '最小値と最大値を渡す場合' do
      it "ペアが返却される" do
        min = 0
        max = 4
        expect = [0, 4]
        result = Kmeans::Pair.new([min, max])
        result[0].should == expect[0]
        result[1].should == expect[1]
      end

      it "ペアが返却される" do
        min = 1
        max = 3
        expect = [1, 3]
        result = Kmeans::Pair.new([min, max])
        result[0].should == expect[0]
        result[1].should == expect[1]
      end
    end

    describe '最小値と最大値と余分な値を渡す場合' do
      it "ペアが返却される" do
        min = 2
        max = 4
        unexpected = 6
        expect = [2, 4]
        result = Kmeans::Pair.new([min, max, unexpected])
        result[0].should == expect[0]
        result[1].should == expect[1]
      end
    end

    describe '同一の値を渡す場合' do
      it "ペアが返却される" do
        min = 5
        max = 5
        expect = [5, 5]
        result = Kmeans::Pair.new([min, max])
        result[0].should == expect[0]
        result[1].should == expect[1]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kmeans-0.1.0 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.9 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.8 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.7 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.6 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.5 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.4 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.3 spec/lib/kmeans/pair_spec.rb
kmeans-0.0.2 spec/lib/kmeans/pair_spec.rb