Skip to content

Commit

Permalink
Merge pull request #797 from jbenoit2011/incorrect-matches-rfc1918cla…
Browse files Browse the repository at this point in the history
…ssbprivatespec

Rfc1918 class B IP must start from 172.16 and not 172.15
  • Loading branch information
fthomas authored Aug 14, 2020
2 parents 1c09e58 + de1d98c commit 60a71b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object net {

type Rfc1918ClassBPrivateSpec =
IPv4 And MatchesRegex[
W.`"^172\\\\.(15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\\\\..+"`.T
W.`"^172\\\\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\\\\..+"`.T
]

type Rfc1918ClassCPrivateSpec =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class NetTypesSpec extends Properties("NetTypes") {
}

property("Rfc1918ClassBPrivateSpec.before") = secure {
showResult[Rfc1918ClassBPrivateSpec]("172.14.255.255") ?=
"""Right predicate of (172.14.255.255 is a valid IPv4 && "172.14.255.255".matches("^172\.(15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")) failed: Predicate failed: "172.14.255.255".matches("^172\.(15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")."""
showResult[Rfc1918ClassBPrivateSpec]("172.15.255.255") ?=
"""Right predicate of (172.15.255.255 is a valid IPv4 && "172.15.255.255".matches("^172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")) failed: Predicate failed: "172.15.255.255".matches("^172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")."""
}

property("Rfc1918ClassBPrivateSpec.isValid.first") = secure {
isValid[Rfc1918ClassBPrivateSpec]("172.15.0.0")
isValid[Rfc1918ClassBPrivateSpec]("172.16.0.0")
}

property("Rfc1918ClassBPrivateSpec.isValid.inside") = secure {
Expand All @@ -48,12 +48,12 @@ class NetTypesSpec extends Properties("NetTypes") {

property("Rfc1918ClassBPrivateSpec.after") = secure {
showResult[Rfc1918ClassBPrivateSpec]("172.32.0.0") ?=
"""Right predicate of (172.32.0.0 is a valid IPv4 && "172.32.0.0".matches("^172\.(15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")) failed: Predicate failed: "172.32.0.0".matches("^172\.(15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")."""
"""Right predicate of (172.32.0.0 is a valid IPv4 && "172.32.0.0".matches("^172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")) failed: Predicate failed: "172.32.0.0".matches("^172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")."""
}

property("Rfc1918ClassBPrivateSpec.issue795") = secure {
showResult[Rfc1918ClassBPrivateSpec]("172.222.255.255") ?=
"""Right predicate of (172.222.255.255 is a valid IPv4 && "172.222.255.255".matches("^172\.(15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")) failed: Predicate failed: "172.222.255.255".matches("^172\.(15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")."""
"""Right predicate of (172.222.255.255 is a valid IPv4 && "172.222.255.255".matches("^172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")) failed: Predicate failed: "172.222.255.255".matches("^172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\..+")."""
}

property("Rfc1918ClassCPrivateSpec.before") = secure {
Expand Down

0 comments on commit 60a71b8

Please sign in to comment.