|
Scala example source code file (substringTests.scala)
The Scala substringTests.scala source codeimport 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)) 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 ) } Other Scala examples (source code examples)Here is a short list of links related to this Scala substringTests.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.