Table
Object containing one apply factory method for each TableFor<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 be TableFor10. You can pass the resulting
tables to a forAll method (defined in trait PropertyChecks), to perform a property
check with the data in the table. Or, because tables are sequences of tuples, you can treat them as a Seq.
Value members
Concrete methods
Factory method for creating a new TableFor1.
Factory method for creating a new TableFor1.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple1s containing the data of this table
Factory method for creating a new TableFor2.
Factory method for creating a new TableFor2.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple2s containing the data of this table
Factory method for creating a new TableFor3.
Factory method for creating a new TableFor3.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple3s containing the data of this table
Factory method for creating a new TableFor4.
Factory method for creating a new TableFor4.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple4s containing the data of this table
Factory method for creating a new TableFor5.
Factory method for creating a new TableFor5.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple5s containing the data of this table
Factory method for creating a new TableFor6.
Factory method for creating a new TableFor6.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple6s containing the data of this table
Factory method for creating a new TableFor7.
Factory method for creating a new TableFor7.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple7s containing the data of this table
Factory method for creating a new TableFor8.
Factory method for creating a new TableFor8.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple8s containing the data of this table
Factory method for creating a new TableFor9.
Factory method for creating a new TableFor9.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple9s containing the data of this table
Factory method for creating a new TableFor10.
Factory method for creating a new TableFor10.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple10s containing the data of this table
Factory method for creating a new TableFor11.
Factory method for creating a new TableFor11.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple11s containing the data of this table
Factory method for creating a new TableFor12.
Factory method for creating a new TableFor12.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple12s containing the data of this table
Factory method for creating a new TableFor13.
Factory method for creating a new TableFor13.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple13s containing the data of this table
Factory method for creating a new TableFor14.
Factory method for creating a new TableFor14.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple14s containing the data of this table
Factory method for creating a new TableFor15.
Factory method for creating a new TableFor15.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple15s containing the data of this table
Factory method for creating a new TableFor16.
Factory method for creating a new TableFor16.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple16s containing the data of this table
Factory method for creating a new TableFor17.
Factory method for creating a new TableFor17.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple17s containing the data of this table
Factory method for creating a new TableFor18.
Factory method for creating a new TableFor18.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple18s containing the data of this table
Factory method for creating a new TableFor19.
Factory method for creating a new TableFor19.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple19s containing the data of this table
Factory method for creating a new TableFor20.
Factory method for creating a new TableFor20.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple20s containing the data of this table
Factory method for creating a new TableFor21.
Factory method for creating a new TableFor21.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple21s containing the data of this table
Factory method for creating a new TableFor22.
Factory method for creating a new TableFor22.
- Value parameters:
- heading
a tuple containing string names of the columns in this table
- rows
a variable length parameter list of
Tuple22s containing the data of this table