Skip to content

Commit

Permalink
2 more penalties
Browse files Browse the repository at this point in the history
  • Loading branch information
JackStat committed Sep 18, 2015
1 parent 07b1f13 commit c5c44fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/ParsePenalty.R
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/test_Penalty.R
Expand Up @@ -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."
)
)

Expand All @@ -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"
Expand Down Expand Up @@ -93,6 +95,8 @@ test_that("Penalties are correctly parsing", {
,"43-L.McPherson"
,"11-J.Neuheisel"
,""
,"97-E.Davis"
,"20-O.Melifonwu"
)
)
)
Expand Down

0 comments on commit c5c44fa

Please sign in to comment.