diff --git a/R/ParsePenalty.R b/R/ParsePenalty.R index fbfa81c..a6aaeb6 100644 --- a/R/ParsePenalty.R +++ b/R/ParsePenalty.R @@ -7,7 +7,7 @@ ParsePenalty <- function(x){ x <- cleanPlayers(x) - PENALTIES <- '(Pass interference|Illegal substitution|False start|Personal Foul|Delay of game|Ineligible player downfield during passing down|Unsportsmanlike conduct|Illegal formation|Offside|Holding|Intentional grounding|Roughing the kicker|Running into kicker|Facemask, Incidental|Fair catch interference|Illegal block in the back|Unnecessary roughness|Roughing the passer|Illegal use of hands|Clipping|Chop block|Facemasking|Illegal Forward Pass|12 players|Illegal motion|12 men in the huddle|Illegal shift|Offside on Free Kick|Tripping|First onside kickoff out of bounds|Delay of game at start of either half|Illegal Procedure), ' + PENALTIES <- '(Pass interference|Illegal substitution|False start|Personal Foul|Delay of game|Ineligible player downfield during passing down|Unsportsmanlike conduct|Illegal formation|Offside|Holding|Intentional grounding|Roughing the kicker|Running into kicker|Facemask, Incidental|Fair catch interference|Illegal block in the back|Unnecessary roughness|Roughing the passer|Illegal use of hands|Clipping|Chop block|Facemasking|Illegal Forward Pass|12 players|Illegal motion|12 men in the huddle|Illegal shift|Offside on Free Kick|Tripping|First onside kickoff out of bounds|Delay of game at start of either half|Illegal Procedure|Encroachment|Taunting), ' x$Penalty = FALSE x$NoPlay = FALSE diff --git a/tests/testthat/test_Penalty.R b/tests/testthat/test_Penalty.R index c6e85b8..e616a5f 100644 --- a/tests/testthat/test_Penalty.R +++ b/tests/testthat/test_Penalty.R @@ -42,6 +42,8 @@ TestFrame <- data.frame( ,"Penalty on LT 43-L.McPherson, First onside kickoff out of bounds, 5 yards, enforced at LT 48. No Play." ,"Penalty on UCLA 11-J.Neuheisel, Delay of game at start of either half, 5 yards, enforced at UNLV 22. No Play." ,"Team penalty on HOW, Illegal Procedure, 5 yards, enforced at HOW 25. No Play." + ,"Penalty on OKS 97-E.Davis, Encroachment, 5 yards, enforced at UCA 8. No Play." + ,"Penalty on UCONN 20-O.Melifonwu, Taunting, 15 yards, enforced at ARM 29. No Play." ) ) @@ -52,7 +54,7 @@ test_that("Penalties are correctly parsing", { expect_true(all(Penalties$Penalty)) expect_equal(Penalties$PenaltyYards, - c(15, 5, 5, 15, 5, 15, 15, 5, 5, 5, 5, 15, 10, 0, 7, 15, 0, 10, 15, 10, 15, 15, 15, 11, 15, 15, 5, 5, 5, 5, 5, 5, 5, 15, 15, 5, 5, 5) + c(15, 5, 5, 15, 5, 15, 15, 5, 5, 5, 5, 15, 10, 0, 7, 15, 0, 10, 15, 10, 15, 15, 15, 11, 15, 15, 5, 5, 5, 5, 5, 5, 5, 15, 15, 5, 5, 5, 5, 15) ) expect_true(all(Penalties$PenaltyPlayer == c("6-D.Payne" @@ -93,6 +95,8 @@ test_that("Penalties are correctly parsing", { ,"43-L.McPherson" ,"11-J.Neuheisel" ,"" + ,"97-E.Davis" + ,"20-O.Melifonwu" ) ) )