<commit_before>require 'table'
require 'card'
require 'rank'
require 'suit'

describe Table do
	describe "attributes" do
		table = Table.new
		it "can set community cards" do
			card = Card.new(Rank.is(:five), Suit.is(:hearts))
			table.add_community_card_at(card, 4)
			expect(table.community_cards[4]).to equal card
		end
	
		it "can set hole cards" do
			card = Card.new(Rank.is(:three), Suit.is(:diamonds))
			table.add_hole_card_at(card, 1)
			expect(table.hole_cards[1]).to equal card
		end

		it "can set number of opponents" do
			table.number_of_opponents= 5
			expect(table.number_of_opponents).to eq 5
		end
	end

	describe "add to community or hole cards" do
		context "given an invalid index or card" do
			it "raises an ArgumentError" do
				table = Table.new
				card = Card.new(Rank.is(:three), Suit.is(:spades))
				expect {table.add_community_card_at(card, 7)}
					.to raise_error(ArgumentError)
				expect {table.add_community_card_at(0, 3)}
					.to raise_error(ArgumentError)
				expect {table.add_hole_card_at(card, 7)}
					.to raise_error(ArgumentError)
				expect {table.add_hole_card_at(0, 1)}
					.to raise_error(ArgumentError)
			end
		end

		context "given a duplicate card" do
			it "removes the original and adds the new card" do
				table = Table.new
				card = Card.new(Rank.is(:five), Suit.is(:hearts))
				table.add_community_card_at(card, 4)
				expect { table.add_hole_card_at(card, 0) }
					.to change { table.community_cards[4] }
					.from(card)
					.to(nil)
			end
		end
	end

	describe "#cards_in_play" do
		context "when all card slots are filled" do<commit_msg>Add tests to ensure no overlap between Card.<=> and Card.==<commit_after>require 'table'
require 'card'
require 'rank'
require 'suit'

describe Table do
	describe "attributes" do
		table = Table.new
		it "can set community cards" do
			card = Card.new(Rank.is(:five), Suit.is(:hearts))
			table.add_community_card_at(card, 4)
			expect(table.community_cards[4]).to equal card
		end
	
		it "can set hole cards" do
			card = Card.new(Rank.is(:three), Suit.is(:diamonds))
			table.add_hole_card_at(card, 1)
			expect(table.hole_cards[1]).to equal card
		end

		it "can set number of opponents" do
			table.number_of_opponents= 5
			expect(table.number_of_opponents).to eq 5
		end
	end

	describe "add to community or hole cards" do
		context "given an invalid index or card" do
			it "raises an ArgumentError" do
				table = Table.new
				card = Card.new(Rank.is(:three), Suit.is(:spades))
				expect {table.add_community_card_at(card, 7)}
					.to raise_error(ArgumentError)
				expect {table.add_community_card_at(0, 3)}
					.to raise_error(ArgumentError)
				expect {table.add_hole_card_at(card, 7)}
					.to raise_error(ArgumentError)
				expect {table.add_hole_card_at(0, 1)}
					.to raise_error(ArgumentError)
			end
		end

		context "given a duplicate card" do
			it "removes the original and adds the new card" do
				table = Table.new
				card = Card.new(Rank.is(:five), Suit.is(:hearts))
				table.add_community_card_at(card, 4)
				expect { table.add_hole_card_at(card, 0) }
					.to change { table.community_cards[4] }
					.from(card)
					.to(nil)
			end
		end

		context "given a card that matches another in rank but not suit" do
			it "removes nothing" do
				table = Table.new
				card = Card.new(Rank.is(:five), Suit.is(:hearts))
				table.add_community_card_at(card, 4)
				card = Card.new(Rank.is(:five), Suit.is(:spades))
				expect { table.add_hole_card_at(card, 0) }
					.not_to change { table.community_cards[4] }
			end
		end

		context "given a card that matches another in suit but not rank" do
			it "removes nothing" do
				table = Table.new
				card = Card.new(Rank.is(:five), Suit.is(:hearts))
				table.add_community_card_at(card, 4)
				card = Card.new(Rank.is(:six), Suit.is(:hearts))
				expect { table.add_hole_card_at(card, 0) }
					.not_to change { table.community_cards[4] }
			end
		end
	end

	describe "#cards_in_play" do
		context "when all card slots are filled" do
{'fraction_non_alphanumeric': 0.11321224185120676, 'fraction_numerical': 0.008957452102513063, 'mean_word_length': 3.5372460496613995, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5130318', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1391, 'n_words': 384}