Sha256: b1db8f5eb4d9567b95eca07e5fa6ee68a5e996fd9494a769df20f64e5911cafc
Contents?: true
Size: 1.99 KB
Versions: 1
Compression:
Stored size: 1.99 KB
Contents
# Spec helper (must include first to track code coverage with SimpleCov) require File.expand_path('../support/spec_helper', __FILE__) require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/game_definition", __FILE__) require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/../acpc_poker_types", __FILE__) describe GameDefinition do include AcpcPokerTypes describe '::default_first_player_positions' do it 'works' do 100.times do |number_of_rounds| expected_positions = number_of_rounds.times.inject([]) do |list, j| list << 0 end GameDefinition.default_first_player_positions(number_of_rounds).should == expected_positions end end end describe '::default_max_number_of_wagers' do it 'works' do 100.times do |number_of_rounds| expected_number_of_wagers = number_of_rounds.times.inject([]) do |list, j| list << (2**8 - 1) end GameDefinition.default_max_number_of_wagers(number_of_rounds).should == expected_number_of_wagers end end end describe '::default_chip_stacks' do it 'works' do 100.times do |number_of_players| expected_chip_stacks = number_of_players.times.inject([]) do |list, j| list << ChipStack.new(2**31 - 1) end GameDefinition.default_chip_stacks(number_of_players).should == expected_chip_stacks end end end describe '#parse_file and #parse' do it "parses all available game definitions properly" do AcpcPokerTypes::GAME_DEFINITION_FILE_NAMES.values.each do |game_definition_file_name| @patient = GameDefinition.parse_file game_definition_file_name @expected = File.readlines(game_definition_file_name).map do |line| line.chomp end.reject { |line| line.match(/GAMEDEF/i) } check_patient patient = GameDefinition.parse @expected check_patient end end end def check_patient Set.new(@patient.to_a).superset?(Set.new(@expected)).should be true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acpc_poker_types-0.0.2 | spec/game_definition_spec.rb |