File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
jvm/src/test/scala/org/scalacheck
src/main/scala/org/scalacheck Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 99
1010package org .scalacheck
1111
12+ import java .util .concurrent .TimeUnit
13+
1214import Prop ._
1315import Arbitrary ._
14- import java .util .concurrent .TimeUnit
1516
1617object ArbitrarySpecification extends Properties (" Arbitrary" ) {
1718 val genOptionUnits =
@@ -23,6 +24,11 @@ object ArbitrarySpecification extends Properties("Arbitrary") {
2324 property(" arbOption coverage" ) =
2425 exists(genOptionUnits) { case (a, b) => a.isDefined != b.isDefined }
2526
27+ property(" arbChar" ) =
28+ Prop .forAll { (c : Char ) =>
29+ 0x0000 <= c && c <= 0xD7FF || 0xE000 <= c && c <= 0xFFFD
30+ }
31+
2632 property(" arbString" ) =
2733 Prop .forAll { (s : String ) =>
2834 s ne new String (s)
Original file line number Diff line number Diff line change @@ -152,8 +152,8 @@ private[scalacheck] sealed trait ArbitraryLowPriority {
152152 implicit lazy val arbChar : Arbitrary [Char ] = Arbitrary {
153153 // valid ranges are [0x0000, 0xD7FF] and [0xE000, 0xFFFD].
154154 //
155- // ((0xFFFD + 1) - 0xE000) + ((0xD7FF + 1) - 0x0000)
156- choose(0 , 63486 ).map { i =>
155+ // ((0xFFFD + 1) - 0xE000) + ((0xD7FF + 1) - 0x0000) - 1
156+ choose(0 , 63485 ).map { i =>
157157 if (i <= 0xD7FF ) i.toChar
158158 else (i + 2048 ).toChar
159159 }
You can’t perform that action at this time.
0 commit comments