1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Test 5 match rule for bracket size 5-16

This commit is contained in:
2015-03-27 19:07:49 +00:00
parent 12b27ef3bc
commit 7146c401cf
6 changed files with 75 additions and 7 deletions

View File

@@ -9,3 +9,5 @@ two:
id: 2
name: Grove City
tournament_id: 1

View File

@@ -9,3 +9,5 @@ one:
matchups_array:

View File

@@ -27,4 +27,3 @@ five:

View File

@@ -7,6 +7,61 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
@genMatchups = @tournament.generateMatchups
end
def createTournament(numberOfWrestlers)
@count = 1
@id = 6000 + numberOfWrestlers
@tournament3 = Tournament.new
@tournament3.id = @id
@tournament3.name = "Something"
@tournament3.address = "Some Place"
@tournament3.director = "Some Guy"
@tournament3.director_email = "test@test.com"
@tournament3.save
@school3 = School.new
@school3.id = @id
@school3.name = "Shit Show"
@school3.tournament_id = @id
@school3.save
@weight3 = Weight.new
@weight3.id = @id
@weight3.max = 350
@weight3.tournament_id = @id
@weight3.save
until @count > numberOfWrestlers do
@wrestler2 = Wrestler.new
@wrestler2.name = "Guy #{@count}"
@wrestler2.school_id = @id
@wrestler2.weight_id = @id
@wrestler2.original_seed = @count
@wrestler2.season_loss = 0
@wrestler2.season_win = 0
@wrestler2.criteria = nil
@wrestler2.save
@count = @count + 1
end
return @tournament3
end
def checkForByeInPool(tournament)
@matchups = tournament.generateMatchups
tournament.weights.each do |w|
w.wrestlers.each do |wr|
@round = 1
if w.totalRounds(@matchups) > 5
until @round > w.poolRounds(@matchups) do
if wr.boutByRound(@round,@matchups) == "BYE"
@message = "BYE"
end
@round = @round + 1
end
assert_equal "BYE", @message
@message = nil
end
end
end
end
test "the truth" do
assert true
end
@@ -58,5 +113,14 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
assert_equal @genMatchup.w1_name, @matchup.w1_name
end
test "test if a wrestler can exceed five matches" do
@count = 5
until @count > 16 do
@tournament2 = createTournament(@count)
checkForByeInPool(@tournament2)
@count = @count + 1
end
end
#todo test crazy movements through each bracket?
end