Instance Constructors
-
new
TableFor2
(heading: (String, String), rows: (A, B)*)
Value Members
-
def
!=
(arg0: AnyRef): Boolean
-
def
!=
(arg0: Any): Boolean
-
def
##
(): Int
-
def
++
[B >: (A, B), That]
(that: TraversableOnce[B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
++
[B >: (A, B), That]
(that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
++:
[B >: (A, B), That]
(that: Traversable[B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
++:
[B >: (A, B), That]
(that: TraversableOnce[B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
+:
[B >: (A, B), That]
(elem: B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
/:
[B]
(z: B)(op: (B, (A, B)) ⇒ B): B
-
def
/:\
[A1 >: (A, B)]
(z: A1)(op: (A1, A1) ⇒ A1): A1
-
def
:+
[B >: (A, B), That]
(elem: B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
:\
[B]
(z: B)(op: ((A, B), B) ⇒ B): B
-
def
==
(arg0: AnyRef): Boolean
-
def
==
(arg0: Any): Boolean
-
def
addString
(b: StringBuilder): StringBuilder
-
def
addString
(b: StringBuilder, sep: String): StringBuilder
-
def
addString
(b: StringBuilder, start: String, sep: String, end: String): StringBuilder
-
def
aggregate
[B]
(z: B)(seqop: (B, (A, B)) ⇒ B, combop: (B, B) ⇒ B): B
-
def
andThen
[C]
(k: ((A, B)) ⇒ C): PartialFunction[Int, C]
-
def
apply
(fun: (A, B) ⇒ Unit): Unit
-
def
apply
(idx: Int): (A, B)
-
def
asInstanceOf
[T0]
: T0
-
def
canEqual
(that: Any): Boolean
-
def
clone
(): AnyRef
-
def
collect
[B, That]
(pf: PartialFunction[(A, B), B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
collectFirst
[B]
(pf: PartialFunction[(A, B), B]): Option[B]
-
def
combinations
(n: Int): Iterator[TableFor2[A, B]]
-
def
companion
: GenericCompanion[IndexedSeq]
-
def
compose
[A]
(g: (A) ⇒ Int): (A) ⇒ (A, B)
-
def
contains
(elem: Any): Boolean
-
def
containsSlice
[B]
(that: Seq[B]): Boolean
-
def
containsSlice
[B]
(that: GenSeq[B]): Boolean
-
def
copyToArray
[B >: (A, B)]
(xs: Array[B], start: Int, len: Int): Unit
-
def
copyToArray
[B >: (A, B)]
(xs: Array[B]): Unit
-
def
copyToArray
[B >: (A, B)]
(xs: Array[B], start: Int): Unit
-
def
copyToBuffer
[B >: (A, B)]
(dest: Buffer[B]): Unit
-
def
corresponds
[B]
(that: Seq[B])(p: ((A, B), B) ⇒ Boolean): Boolean
-
def
corresponds
[B]
(that: GenSeq[B])(p: ((A, B), B) ⇒ Boolean): Boolean
-
def
count
(p: ((A, B)) ⇒ Boolean): Int
-
def
diff
[B >: (A, B)]
(that: Seq[B]): TableFor2[A, B]
-
def
diff
[B >: (A, B)]
(that: GenSeq[B]): TableFor2[A, B]
-
def
distinct
: TableFor2[A, B]
-
def
drop
(n: Int): TableFor2[A, B]
-
def
dropRight
(n: Int): TableFor2[A, B]
-
def
dropWhile
(p: ((A, B)) ⇒ Boolean): TableFor2[A, B]
-
def
endsWith
[B]
(that: Seq[B]): Boolean
-
def
endsWith
[B]
(that: GenSeq[B]): Boolean
-
def
eq
(arg0: AnyRef): Boolean
-
def
equals
(that: Any): Boolean
-
def
exists
(p: ((A, B)) ⇒ Boolean): Boolean
-
def
filter
(p: ((A, B)) ⇒ Boolean): TableFor2[A, B]
-
def
filterNot
(p: ((A, B)) ⇒ Boolean): TableFor2[A, B]
-
def
finalize
(): Unit
-
def
find
(p: ((A, B)) ⇒ Boolean): Option[(A, B)]
-
def
flatMap
[B, That]
(f: ((A, B)) ⇒ GenTraversableOnce[B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
flatten
[B]
(implicit asTraversable: ((A, B)) ⇒ TraversableOnce[B]): Traversable[B]
-
def
fold
[A1 >: (A, B)]
(z: A1)(op: (A1, A1) ⇒ A1): A1
-
def
foldLeft
[B]
(z: B)(op: (B, (A, B)) ⇒ B): B
-
def
foldRight
[B]
(z: B)(op: ((A, B), B) ⇒ B): B
-
def
forall
(p: ((A, B)) ⇒ Boolean): Boolean
-
def
foreach
[U]
(f: ((A, B)) ⇒ U): Unit
-
def
genericBuilder
[B]
: Builder[B, IndexedSeq[B]]
-
def
getClass
(): java.lang.Class[_]
-
def
groupBy
[K]
(f: ((A, B)) ⇒ K): Map[K, TableFor2[A, B]]
-
def
grouped
(size: Int): Iterator[TableFor2[A, B]]
-
def
hasDefiniteSize
: Boolean
-
def
hashCode
(): Int
-
def
head
: (A, B)
-
def
headOption
: Option[(A, B)]
-
val
heading
: (String, String)
-
def
indexOf
[B >: (A, B)]
(elem: B, from: Int): Int
-
def
indexOf
[B >: (A, B)]
(elem: B): Int
-
def
indexOfSlice
[B >: (A, B)]
(that: Seq[B], from: Int): Int
-
def
indexOfSlice
[B >: (A, B)]
(that: GenSeq[B], from: Int): Int
-
def
indexOfSlice
[B >: (A, B)]
(that: Seq[B]): Int
-
def
indexOfSlice
[B >: (A, B)]
(that: GenSeq[B]): Int
-
def
indexWhere
(p: ((A, B)) ⇒ Boolean, from: Int): Int
-
def
indexWhere
(p: ((A, B)) ⇒ Boolean): Int
-
def
indices
: Range
-
-
def
inits
: Iterator[TableFor2[A, B]]
-
def
intersect
[B >: (A, B)]
(that: Seq[B]): TableFor2[A, B]
-
def
intersect
[B >: (A, B)]
(that: GenSeq[B]): TableFor2[A, B]
-
def
isDefinedAt
(idx: Int): Boolean
-
def
isEmpty
: Boolean
-
def
isInstanceOf
[T0]
: Boolean
-
def
isTraversableAgain
: Boolean
-
def
iterator
: Iterator[(A, B)]
-
def
last
: (A, B)
-
def
lastIndexOf
[B >: (A, B)]
(elem: B, end: Int): Int
-
def
lastIndexOf
[B >: (A, B)]
(elem: B): Int
-
def
lastIndexOfSlice
[B >: (A, B)]
(that: Seq[B], end: Int): Int
-
def
lastIndexOfSlice
[B >: (A, B)]
(that: GenSeq[B], end: Int): Int
-
def
lastIndexOfSlice
[B >: (A, B)]
(that: Seq[B]): Int
-
def
lastIndexOfSlice
[B >: (A, B)]
(that: GenSeq[B]): Int
-
def
lastIndexWhere
(p: ((A, B)) ⇒ Boolean, end: Int): Int
-
def
lastIndexWhere
(p: ((A, B)) ⇒ Boolean): Int
-
def
lastOption
: Option[(A, B)]
-
def
length
: Int
-
def
lengthCompare
(len: Int): Int
-
def
lift
: (Int) ⇒ Option[(A, B)]
-
def
map
[B, That]
(f: ((A, B)) ⇒ B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
max
[B >: (A, B)]
(implicit cmp: Ordering[B]): (A, B)
-
def
maxBy
[B]
(f: ((A, B)) ⇒ B)(implicit cmp: Ordering[B]): (A, B)
-
def
min
[B >: (A, B)]
(implicit cmp: Ordering[B]): (A, B)
-
def
minBy
[B]
(f: ((A, B)) ⇒ B)(implicit cmp: Ordering[B]): (A, B)
-
def
mkString
: String
-
def
mkString
(sep: String): String
-
def
mkString
(start: String, sep: String, end: String): String
-
def
ne
(arg0: AnyRef): Boolean
-
def
newBuilder
: Builder[(A, B), TableFor2[A, B]]
-
def
nonEmpty
: Boolean
-
def
notify
(): Unit
-
def
notifyAll
(): Unit
-
def
orElse
[A1 <: Int, B1 >: (A, B)]
(that: PartialFunction[A1, B1]): PartialFunction[A1, B1]
-
def
padTo
[B >: (A, B), That]
(len: Int, elem: B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
par
: ParSeq[(A, B)]
-
def
parCombiner
: Combiner[(A, B), ParSeq[(A, B)]]
-
def
partition
(p: ((A, B)) ⇒ Boolean): (TableFor2[A, B], TableFor2[A, B])
-
def
patch
[B >: (A, B), That]
(from: Int, patch: Seq[B], replaced: Int)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
patch
[B >: (A, B), That]
(from: Int, patch: GenSeq[B], replaced: Int)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
permutations
: Iterator[TableFor2[A, B]]
-
def
prefixLength
(p: ((A, B)) ⇒ Boolean): Int
-
def
product
[B >: (A, B)]
(implicit num: Numeric[B]): B
-
def
reduce
[A1 >: (A, B)]
(op: (A1, A1) ⇒ A1): A1
-
def
reduceLeft
[B >: (A, B)]
(op: (B, (A, B)) ⇒ B): B
-
def
reduceLeftOption
[B >: (A, B)]
(op: (B, (A, B)) ⇒ B): Option[B]
-
def
reduceOption
[A1 >: (A, B)]
(op: (A1, A1) ⇒ A1): Option[A1]
-
def
reduceRight
[B >: (A, B)]
(op: ((A, B), B) ⇒ B): B
-
def
reduceRightOption
[B >: (A, B)]
(op: ((A, B), B) ⇒ B): Option[B]
-
-
def
reverse
: TableFor2[A, B]
-
def
reverseIterator
: Iterator[(A, B)]
-
def
reverseMap
[B, That]
(f: ((A, B)) ⇒ B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
reversed
: List[(A, B)]
-
def
sameElements
[B >: (A, B)]
(that: Iterable[B]): Boolean
-
def
sameElements
[B >: (A, B)]
(that: GenIterable[B]): Boolean
-
def
scan
[B >: (A, B), That]
(z: B)(op: (B, B) ⇒ B)(implicit cbf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
scanLeft
[B, That]
(z: B)(op: (B, (A, B)) ⇒ B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
scanRight
[B, That]
(z: B)(op: ((A, B), B) ⇒ B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
segmentLength
(p: ((A, B)) ⇒ Boolean, from: Int): Int
-
def
seq
: Seq[(A, B)]
-
def
size
: Int
-
def
slice
(from: Int, until: Int): TableFor2[A, B]
-
def
sliding
[B >: (A, B)]
(size: Int, step: Int): Iterator[TableFor2[A, B]]
-
def
sliding
[B >: (A, B)]
(size: Int): Iterator[TableFor2[A, B]]
-
def
sortBy
[B]
(f: ((A, B)) ⇒ B)(implicit ord: Ordering[B]): TableFor2[A, B]
-
def
sortWith
(lt: ((A, B), (A, B)) ⇒ Boolean): TableFor2[A, B]
-
def
sorted
[B >: (A, B)]
(implicit ord: Ordering[B]): TableFor2[A, B]
-
def
span
(p: ((A, B)) ⇒ Boolean): (TableFor2[A, B], TableFor2[A, B])
-
def
splitAt
(n: Int): (TableFor2[A, B], TableFor2[A, B])
-
def
startsWith
[B]
(that: Seq[B], offset: Int): Boolean
-
def
startsWith
[B]
(that: GenSeq[B], offset: Int): Boolean
-
def
startsWith
[B]
(that: Seq[B]): Boolean
-
def
startsWith
[B]
(that: GenSeq[B]): Boolean
-
def
stringPrefix
: String
-
def
sum
[B >: (A, B)]
(implicit num: Numeric[B]): B
-
def
synchronized
[T0]
(arg0: ⇒ T0): T0
-
-
def
tails
: Iterator[TableFor2[A, B]]
-
def
take
(n: Int): TableFor2[A, B]
-
def
takeRight
(n: Int): TableFor2[A, B]
-
def
takeWhile
(p: ((A, B)) ⇒ Boolean): TableFor2[A, B]
-
def
thisCollection
: IndexedSeq[(A, B)]
-
def
toArray
[B >: (A, B)]
(implicit arg0: ClassManifest[B]): Array[B]
-
def
toBuffer
[A1 >: (A, B)]
: Buffer[A1]
-
def
toCollection
(repr: TableFor2[A, B]): IndexedSeq[(A, B)]
-
def
toIndexedSeq
[B >: (A, B)]
: IndexedSeq[B]
-
def
toIterable
: Iterable[(A, B)]
-
def
toIterator
: Iterator[(A, B)]
-
def
toList
: List[(A, B)]
-
def
toMap
[T, U]
(implicit ev: <:<[(A, B), (T, U)]): Map[T, U]
-
def
toSeq
: Seq[(A, B)]
-
def
toSet
[B >: (A, B)]
: Set[B]
-
def
toStream
: Stream[(A, B)]
-
def
toString
(): String
-
def
toTraversable
: Traversable[(A, B)]
-
def
transpose
[B]
(implicit asTraversable: ((A, B)) ⇒ TraversableOnce[B]): Traversable[Traversable[B]]
-
def
union
[B >: (A, B), That]
(that: GenSeq[B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
union
[B >: (A, B), That]
(that: Seq[B])(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
unzip
[A1, A2]
(implicit asPair: ((A, B)) ⇒ (A1, A2)): (IndexedSeq[A1], IndexedSeq[A2])
-
def
unzip3
[A1, A2, A3]
(implicit asTriple: ((A, B)) ⇒ (A1, A2, A3)): (IndexedSeq[A1], IndexedSeq[A2], IndexedSeq[A3])
-
def
updated
[B >: (A, B), That]
(index: Int, elem: B)(implicit bf: CanBuildFrom[TableFor2[A, B], B, That]): That
-
def
view
(from: Int, until: Int): SeqView[(A, B), TableFor2[A, B]]
-
def
view
: SeqView[(A, B), TableFor2[A, B]]
-
def
wait
(): Unit
-
def
wait
(arg0: Long, arg1: Int): Unit
-
def
wait
(arg0: Long): Unit
-
def
withFilter
(p: ((A, B)) ⇒ Boolean): FilterMonadic[(A, B), TableFor2[A, B]]
-
def
zip
[A1 >: (A, B), B, That]
(that: Iterable[B])(implicit bf: CanBuildFrom[TableFor2[A, B], (A1, B), That]): That
-
def
zip
[A1 >: (A, B), B, That]
(that: GenIterable[B])(implicit bf: CanBuildFrom[TableFor2[A, B], (A1, B), That]): That
-
def
zipAll
[B, A1 >: (A, B), That]
(that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[TableFor2[A, B], (A1, B), That]): That
-
def
zipAll
[B, A1 >: (A, B), That]
(that: GenIterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[TableFor2[A, B], (A1, B), That]): That
-
def
zipWithIndex
[A1 >: (A, B), That]
(implicit bf: CanBuildFrom[TableFor2[A, B], (A1, Int), That]): That
-
def
elements
: Iterator[(A, B)]
-
def
equalsWith
[B]
(that: Seq[B])(f: ((A, B), B) ⇒ Boolean): Boolean
-
def
findIndexOf
(p: ((A, B)) ⇒ Boolean): Int
-
def
findLastIndexOf
(p: ((A, B)) ⇒ Boolean): Int
-
def
first
: (A, B)
-
def
firstOption
: Option[(A, B)]
-
def
projection
: SeqView[(A, B), TableFor2[A, B]]
-
def
reversedElements
: Iterator[(A, B)]
Inherited from IndexedSeq[(A, B)]
Inherited from IndexedSeqLike[(A, B), TableFor2[A, B]]
Inherited from Seq[(A, B)]
Inherited from SeqLike[(A, B), TableFor2[A, B]]
Inherited from GenSeq[(A, B)]
Inherited from GenSeqLike[(A, B), TableFor2[A, B]]
Inherited from Iterable[(A, B)]
Inherited from IterableLike[(A, B), TableFor2[A, B]]
Inherited from Equals
Inherited from GenIterable[(A, B)]
Inherited from GenIterableLike[(A, B), TableFor2[A, B]]
Inherited from Traversable[(A, B)]
Inherited from GenTraversable[(A, B)]
Inherited from GenericTraversableTemplate[(A, B), IndexedSeq]
Inherited from TraversableLike[(A, B), TableFor2[A, B]]
Inherited from GenTraversableLike[(A, B), TableFor2[A, B]]
Inherited from Parallelizable[(A, B), ParSeq[(A, B)]]
Inherited from TraversableOnce[(A, B)]
Inherited from GenTraversableOnce[(A, B)]
Inherited from FilterMonadic[(A, B), TableFor2[A, B]]
Inherited from HasNewBuilder[(A, B), TableFor2[A, B]]
Inherited from PartialFunction[Int, (A, B)]
Inherited from (Int) ⇒ (A, B)
Inherited from AnyRef
Inherited from Any
A table with 2 columns.
For an introduction to using tables, see the documentation for trait TableDrivenPropertyChecks.
This table is a sequence of
Tuple2
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
TableFor2
is via anapply
factory method in theTable
singleton object provided by theTables
trait. Here's an example:Because you supplied 2 members in each tuple, the type you'll get back will be a
TableFor2
.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. Theapply
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 theapply
method will complete abruptly with aTableDrivenPropertyCheckFailedException
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 aforAll
method provided by traitTableDrivenPropertyChecks
. TheforAll
method takes aTableFor2
as its first argument, then in a curried argument list takes the property check function. It invokesapply
on theTableFor2
, passing in the property check function. Here's an example:forAll (examples) { (a, b) => a + b should equal (a * 2) }
Because
TableFor2
is aSeq[(A, B)]
, you can use it as aSeq
. For example, here's how you could get a sequence of optional exceptions for each row of the table, indicating whether a property check succeeded or failed on each row of the table:Note: the
failureOf
method, contained in theFailureOf
trait, will execute the supplied code (a by-name parameter) and catch any exception. If no exception is thrown by the code,failureOf
will result inNone
, indicating the "property check" succeeded. If the supplied code completes abruptly in an exception that would normally cause a test to fail,failureOf
will result in aSome
wrapping that exception. For example, the previous for expression would give you:This shows that all the property checks succeeded, except for the one at index 7.