object Tables extends Tables
Companion object that facilitates the importing of Tables
members as
an alternative to mixing it in. One use case is to import Tables
members so you can use
them in the Scala interpreter:
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22). Type in expressions to have them evaluated. Type :help for more information. scala> import org.scalatest.prop.Tables._ import org.scalatest.prop.Tables._ scala> val examples = | Table( | ("a", "b"), | ( 1, 2), | ( 3, 4) | ) examples: org.scalatest.prop.TableFor2[Int,Int] = TableFor2((1,2), (3,4))
- Source
- Tables.scala
- Alphabetic
- By Inheritance
- Tables
- Tables
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
object
Table
Object containing one
apply
factory method for eachTableFor<n>
class.Object containing one
apply
factory method for eachTableFor<n>
class.For example, you could create a table of 5 rows and 2 colums like this:
import org.scalatest.prop.Tables._ val examples = Table( ("a", "b"), ( 1, 2), ( 2, 4), ( 4, 8), ( 8, 16), ( 16, 32) )
Because you supplied 2 members in each tuple, the type you'll get back will be a
TableFor2
. If you wanted a table with just one column you could write this:val moreExamples = Table( "powerOfTwo", 1, 2, 4, 8, 16 )
Or if you wanted a table with 10 columns and 10 rows, you could do this:
val multiplicationTable = Table( ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"), ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), ( 2, 4, 6, 8, 10, 12, 14, 16, 18, 20), ( 3, 6, 9, 12, 15, 18, 21, 24, 27, 30), ( 4, 8, 12, 16, 20, 24, 28, 32, 36, 40), ( 5, 10, 15, 20, 25, 30, 35, 40, 45, 50), ( 6, 12, 18, 24, 30, 36, 42, 48, 54, 60), ( 7, 14, 21, 28, 35, 42, 49, 56, 63, 70), ( 8, 16, 24, 32, 40, 48, 56, 64, 72, 80), ( 9, 18, 27, 36, 45, 54, 63, 72, 81, 90), ( 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) )
The type of
multiplicationTable
would beTableFor10
. You can pass the resulting tables to aforAll
method (defined in traitPropertyChecks
), to perform a property check with the data in the table. Or, because tables are sequences of tuples, you can treat them as aSeq
.- Definition Classes
- Tables