A table with 5 columns.
For an introduction to using tables, see the documentation for trait TableDrivenPropertyChecks.
This table is a sequence of Tuple5
objects, where each tuple represents one row of the table. The first element of each tuple comprise the first column of the table, the second element of each tuple comprise the second column, and so on. This table also carries with it a heading tuple that gives string names to the columns of the table.
A handy way to create a TableFor5
is via an apply
factory method in the Table
singleton object provided by the Tables
trait. Here's an example:
val examples = Table( ("a", "b", "c", "d", "e"), ( 0, 0, 0, 0, 0), ( 1, 1, 1, 1, 1), ( 2, 2, 2, 2, 2), ( 3, 3, 3, 3, 3), ( 4, 4, 4, 4, 4), ( 5, 5, 5, 5, 5), ( 6, 6, 6, 6, 6), ( 7, 7, 7, 7, 7), ( 8, 8, 8, 8, 8), ( 9, 9, 9, 9, 9) )
Because you supplied 5 members in each tuple, the type you'll get back will be a TableFor5
.
The table provides an apply
method that takes a function with a parameter list that matches the types and arity of the tuples contained in this table. The apply
method will invoke the function with the members of each row tuple passed as arguments, in ascending order by index. (I.e., the zeroth tuple is checked first, then the tuple with index 1, then index 2, and so on until all the rows have been checked (or until a failure occurs). The function represents a property of the code under test that should succeed for every row of the table. If the function returns normally, that indicates the property check succeeded for that row. If the function completes abruptly with an exception, that indicates the property check failed and the apply
method will complete abruptly with a TableDrivenPropertyCheckFailedException
that wraps the exception thrown by the supplied property function.
The usual way you'd invoke the apply
method that checks a property is via a forAll
method provided by trait TableDrivenPropertyChecks
. The forAll
method takes a TableFor5
as its first argument, then in a curried argument list takes the property check function. It invokes apply
on the TableFor5
, passing in the property check function. Here's an example:
forAll (examples) { (a, b, c, d, e) => a + b + c + d + e should equal (a * 5) }
Because TableFor5
is a Seq[(A, B, C, D, E)]
, you can use it as a Seq
. For example, here's how you could get a sequence of Outcome
s for each row of the table, indicating whether a property check succeeded or failed on each row of the table:
for (row <- examples) yield { outcomeOf { row._1 should not equal (7) } }
Note: the outcomeOf
method, contained in the OutcomeOf
trait, will execute the supplied code (a by-name parameter) and transform it to an Outcome
. If no exception is thrown by the code, outcomeOf
will result in a Succeeded
, indicating the "property check" succeeded. If the supplied code completes abruptly in an exception that would normally cause a test to fail, outcomeOf
will result in in a Failed
instance containing that exception. For example, the previous for expression would give you:
Vector(Succeeded, Succeeded, Succeeded, Succeeded, Succeeded, Succeeded, Succeeded, Failed(org.scalatest.TestFailedException: 7 equaled 7), Succeeded, Succeeded)
This shows that all the property checks succeeded, except for the one at index 7.
Value parameters
- heading
-
a tuple containing string names of the columns in this table
- rows
-
a variable length parameter list of
Tuple5
s containing the data of this table
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait IndexedSeq[(A, B, C, D, E)]trait IndexedSeqOps[(A, B, C, D, E), IndexedSeq, IndexedSeq[(A, B, C, D, E)]]trait IndexedSeq[(A, B, C, D, E)]trait IndexedSeqOps[(A, B, C, D, E), IndexedSeq, IndexedSeq[(A, B, C, D, E)]]trait Seq[(A, B, C, D, E)]trait SeqOps[(A, B, C, D, E), IndexedSeq, IndexedSeq[(A, B, C, D, E)]]trait Seq[(A, B, C, D, E)]trait Equalstrait SeqOps[(A, B, C, D, E), IndexedSeq, IndexedSeq[(A, B, C, D, E)]]trait PartialFunction[Int, (A, B, C, D, E)]trait Int => (A, B, C, D, E)trait Iterable[(A, B, C, D, E)]trait Iterable[(A, B, C, D, E)]trait IterableFactoryDefaults[(A, B, C, D, E), IndexedSeq]trait IterableOps[(A, B, C, D, E), IndexedSeq, IndexedSeq[(A, B, C, D, E)]]trait IterableOnceOps[(A, B, C, D, E), IndexedSeq, IndexedSeq[(A, B, C, D, E)]]trait IterableOnce[(A, B, C, D, E)]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Selects a row of data by its index.
Selects a row of data by its index.
Attributes
Applies the passed property check function to each row of this TableFor5
.
Applies the passed property check function to each row of this TableFor5
.
If the property checks for all rows succeed (the property check function returns normally when passed the data for each row), this apply
method returns normally. If the property check function completes abruptly with an exception for any row, this apply
method wraps that exception in a TableDrivenPropertyCheckFailedException
and completes abruptly with that exception. Once the property check function throws an exception for a row, this apply
method will complete abruptly immediately and subsequent rows will not be checked against the function.
Value parameters
- fun
-
the property check function to apply to each row of this
TableFor5
Attributes
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
The number of rows of data in the table. (This does not include the heading
tuple)
The number of rows of data in the table. (This does not include the heading
tuple)
Attributes
A string representation of this object, which includes the heading strings as well as the rows of data.
A string representation of this object, which includes the heading strings as well as the rows of data.
Attributes
- Definition Classes
-
Seq -> Function1 -> Iterable -> Any
Inherited methods
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
SeqOps -> IterableOps
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
PartialFunction -> Function1
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
IndexedSeq -> Seq -> Equals
- Inherited from:
- IndexedSeq
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- Function1
Attributes
- Definition Classes
-
SeqOps -> IterableOps
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps -> IterableOnceOps
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
IterableFactoryDefaults -> IterableOps
- Inherited from:
- IterableFactoryDefaults
Attributes
- Inherited from:
- SeqOps
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance
x
of typeAny
,x.equals(x)
should returntrue
. - It is symmetric: for any instances
x
andy
of typeAny
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any instances
x
,y
, andz
of typeAny
ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode
to ensure that objects which are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)
).
Value parameters
- that
-
the object to compare against this object for equality.
Attributes
- Returns
-
true
if the receiver object is equivalent to the argument;false
otherwise. - Definition Classes
-
Seq -> Equals -> Any
- Inherited from:
- Seq
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOnceOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableFactoryDefaults
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Calculate a hash code value for the object.
Calculate a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)
) yet not be equal (o1.equals(o2)
returns false
). A degenerate implementation could always return 0
. However, it is required that if two objects are equal (o1.equals(o2)
returns true
) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)
). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals
method.
Attributes
- Returns
-
the hash code value for this object.
- Definition Classes
-
Seq -> Any
- Inherited from:
- Seq
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
SeqOps -> IterableOnceOps
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IndexedSeq -> IndexedSeq -> Seq -> Seq -> Iterable -> Iterable -> IterableOps
- Inherited from:
- IndexedSeq
Attributes
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOnce
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- Iterable
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps -> IterableOnceOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableFactoryDefaults
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOnceOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
IndexedSeq -> SeqOps
- Inherited from:
- IndexedSeq
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IndexedSeq
Attributes
- Inherited from:
- IndexedSeq
Attributes
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
SeqOps -> IterableOnceOps
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
SeqOps -> IterableOps
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
SeqOps -> IterableOps
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IndexedSeqOps -> IterableOps -> IterableOnceOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOnce
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps -> IterableOnceOps
- Inherited from:
- IndexedSeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> IterableOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
IndexedSeq -> IterableOnceOps
- Inherited from:
- IndexedSeq
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
Seq -> IterableOnceOps
- Inherited from:
- Seq
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- SeqOps
Attributes
- Definition Classes
-
IndexedSeqOps -> SeqOps -> IterableOps
- Inherited from:
- IndexedSeqOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Deprecated and Inherited methods
Attributes
- Deprecated
-
[Since version 2.13.0]
Use foldLeft instead of /: - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use foldRight instead of :\\ - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
`aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead. - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use iterableFactory instead - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use `dest ++= coll` instead - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details) - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use segmentLength instead of prefixLength - Inherited from:
- SeqOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use coll instead of repr in a collection implementation, use the collection value itself from the outside - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .reverseIterator.map(f).to(...) instead of .reverseMap(f) - Inherited from:
- SeqOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Iterable.seq always returns the iterable itself - Inherited from:
- Iterable
Attributes
- Deprecated
-
[Since version 2.13.7]
toIterable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections - Inherited from:
- Iterable
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .iterator instead of .toIterator - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .to(LazyList) instead of .toStream - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
toTraversable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use `concat` instead - Inherited from:
- SeqOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .view.slice(from, until) instead of .view(from, until) - Definition Classes
-
IndexedSeqOps -> IterableOps
- Inherited from:
- IndexedSeqOps