diff options
Diffstat (limited to 'test/files/scalacheck/substringTests.scala')
-rw-r--r-- | test/files/scalacheck/substringTests.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/files/scalacheck/substringTests.scala b/test/files/scalacheck/substringTests.scala new file mode 100644 index 0000000000..2cb5fc0498 --- /dev/null +++ b/test/files/scalacheck/substringTests.scala @@ -0,0 +1,21 @@ +import org.scalacheck._ + + +object Test extends Properties("String") { + property("startsWith") = Prop.forAll((a: String, b: String) => (a+b).startsWith(a)) + + property("endsWith") = Prop.forAll((a: String, b: String) => (a+b).endsWith(b)) + + // Is this really always true? + property("concat") = Prop.forAll((a: String, b: String) => + (a+b).length > a.length && (a+b).length > b.length + ) + + property("substring") = Prop.forAll((a: String, b: String) => + (a+b).substring(a.length) == b + ) + + property("substring") = Prop.forAll((a: String, b: String, c: String) => + (a+b+c).substring(a.length, a.length+b.length) == b + ) +} |