org.scalatest.prop.TableFor1.scala Maven / Gradle / Ivy
/*
* Copyright 2001-2024 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.scalatest.prop
import scala.collection.mutable.Builder
import scala.collection.mutable.ListBuffer
import org.scalactic.ColCompatHelper.IndexedSeqLike
import scala.collection.generic.CanBuildFrom
import org.scalatest.exceptions.StackDepth
import org.scalatest.exceptions.DiscardedEvaluationException
import org.scalatest.exceptions.TableDrivenPropertyCheckFailedException
import org.scalatest.enablers.TableAsserting
import org.scalactic._
/**
* A table with 1 column.
*
*
* For an overview of using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of objects, where each object represents one row of the (one-column) table.
* This table also carries with it a heading tuple that gives a string name to the
* lone column of the table.
*
*
*
* A handy way to create a TableFor1
is via an apply
factory method in the Table
* singleton object provided by the Tables
trait. Here's an example:
*
*
*
* val examples =
* Table(
* "a",
* 0,
* 1,
* 2,
* 3,
* 4,
* 5,
* 6,
* 7,
* 8,
* 9
* )
*
*
*
* Because you supplied a list of non-tuple objects, the type you'll get back will be a TableFor1
.
*
*
*
* The table provides an apply
method that takes a function with a parameter list that matches
* the type of the objects contained in this table. The apply
method will invoke the
* function with the object in each row passed as the lone argument, in ascending order by index. (I.e.,
* the zeroth object is checked first, then the object 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 TableFor1
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor1
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a) =>
* a should equal (a * 1)
* }
*
*
*
* Because TableFor1
is a Seq[(A)]
, 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.
*
*
*
* One other way to use a TableFor1
is to test subsequent return values
* of a stateful function. Imagine, for example, you had an object named FiboGen
* whose next
method returned the next fibonacci number, where next
* means the next number in the series following the number previously returned by next
.
* So the first time next
was called, it would return 0. The next time it was called
* it would return 1. Then 1. Then 2. Then 3, and so on. FiboGen
would need to
* be stateful, because it has to remember where it is in the series. In such a situation,
* you could create a TableFor1
(a table with one column, which you could alternatively
* think of as one row), in which each row represents
* the next value you expect.
*
*
*
* val first14FiboNums =
* Table("n", 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233)
*
*
*
* Then in your forAll
simply call the function and compare it with the
* expected return value, like this:
*
*
*
* forAll (first14FiboNums) { n =>
* FiboGen.next should equal (n)
* }
*
*
* @param heading a string name for the lone column of this table
* @param rows a variable length parameter list of objects containing the data of this table
*
* @author Bill Venners
*/
class TableFor1[A](val heading: (String), rows: (A)*) extends IndexedSeq[(A)] with scala.collection.IndexedSeqOps[(A), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A)) => Boolean): TableFor1[A] = new TableFor1[A](heading, rows.filter(p): _*)
def ++(others: Iterable[(A)]): TableFor1[A] = new TableFor1[A](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor1
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor1
*/
def apply[ASSERTION](fun: (A) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor1
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor1
to return another TableFor1
.
*
* @author Bill Venners
*/
object TableFor1 {
/**
* Implicit method enabling higher order functions of TableFor1
to return sequences of type TableFor1
.
*/
implicit def canBuildFrom[A]: scala.collection.BuildFrom[TableFor1[A], (A), TableFor1[A]] =
new scala.collection.BuildFrom[TableFor1[A], (A), TableFor1[A]] {
def apply(): Builder[(A), TableFor1[A]] =
new ListBuffer mapResult { (buf: Seq[(A)]) =>
new TableFor1(("arg0"))
}
def newBuilder(from: org.scalatest.prop.TableFor1[A]): scala.collection.mutable.Builder[(A), TableFor1[A]] =
new ListBuffer mapResult { (buf: Seq[(A)]) =>
new TableFor1(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor1[A])(it: IterableOnce[(A)]): org.scalatest.prop.TableFor1[A] =
new TableFor1(from.heading, it.toSeq: _*)
}
}
/**
* 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 an apply
factory method in the Table
* singleton object provided by the Tables
trait. Here's an example:
*
*
*
* val examples =
* Table(
* ("a", "b"),
* ( 0, 0),
* ( 1, 1),
* ( 2, 2),
* ( 3, 3),
* ( 4, 4),
* ( 5, 5),
* ( 6, 6),
* ( 7, 7),
* ( 8, 8),
* ( 9, 9)
* )
*
*
*
* 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. 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 TableFor2
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor2
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b) =>
* a + b should equal (a * 2)
* }
*
*
*
* Because TableFor2
is a Seq[(A, B)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple2
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor2[A, B](val heading: (String, String), rows: (A, B)*) extends IndexedSeq[(A, B)] with scala.collection.IndexedSeqOps[(A, B), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B)) => Boolean): TableFor2[A, B] = new TableFor2[A, B](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B)]): TableFor2[A, B] = new TableFor2[A, B](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor2
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor2
*/
def apply[ASSERTION](fun: (A, B) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor2
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor2
to return another TableFor2
.
*
* @author Bill Venners
*/
object TableFor2 {
/**
* Implicit method enabling higher order functions of TableFor2
to return sequences of type TableFor2
.
*/
implicit def canBuildFrom[A, B]: scala.collection.BuildFrom[TableFor2[A, B], (A, B), TableFor2[A, B]] =
new scala.collection.BuildFrom[TableFor2[A, B], (A, B), TableFor2[A, B]] {
def apply(): Builder[(A, B), TableFor2[A, B]] =
new ListBuffer mapResult { (buf: Seq[(A, B)]) =>
new TableFor2(("arg0","arg1"))
}
def newBuilder(from: org.scalatest.prop.TableFor2[A, B]): scala.collection.mutable.Builder[(A, B), TableFor2[A, B]] =
new ListBuffer mapResult { (buf: Seq[(A, B)]) =>
new TableFor2(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor2[A, B])(it: IterableOnce[(A, B)]): org.scalatest.prop.TableFor2[A, B] =
new TableFor2(from.heading, it.toSeq: _*)
}
}
/**
* A table with 3 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple3
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 TableFor3
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"),
* ( 0, 0, 0),
* ( 1, 1, 1),
* ( 2, 2, 2),
* ( 3, 3, 3),
* ( 4, 4, 4),
* ( 5, 5, 5),
* ( 6, 6, 6),
* ( 7, 7, 7),
* ( 8, 8, 8),
* ( 9, 9, 9)
* )
*
*
*
* Because you supplied 3 members in each tuple, the type you'll get back will be a TableFor3
.
*
*
*
* 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 TableFor3
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor3
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c) =>
* a + b + c should equal (a * 3)
* }
*
*
*
* Because TableFor3
is a Seq[(A, B, C)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple3
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor3[A, B, C](val heading: (String, String, String), rows: (A, B, C)*) extends IndexedSeq[(A, B, C)] with scala.collection.IndexedSeqOps[(A, B, C), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C)) => Boolean): TableFor3[A, B, C] = new TableFor3[A, B, C](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C)]): TableFor3[A, B, C] = new TableFor3[A, B, C](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor3
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor3
*/
def apply[ASSERTION](fun: (A, B, C) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor3
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor3
to return another TableFor3
.
*
* @author Bill Venners
*/
object TableFor3 {
/**
* Implicit method enabling higher order functions of TableFor3
to return sequences of type TableFor3
.
*/
implicit def canBuildFrom[A, B, C]: scala.collection.BuildFrom[TableFor3[A, B, C], (A, B, C), TableFor3[A, B, C]] =
new scala.collection.BuildFrom[TableFor3[A, B, C], (A, B, C), TableFor3[A, B, C]] {
def apply(): Builder[(A, B, C), TableFor3[A, B, C]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C)]) =>
new TableFor3(("arg0","arg1","arg2"))
}
def newBuilder(from: org.scalatest.prop.TableFor3[A, B, C]): scala.collection.mutable.Builder[(A, B, C), TableFor3[A, B, C]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C)]) =>
new TableFor3(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor3[A, B, C])(it: IterableOnce[(A, B, C)]): org.scalatest.prop.TableFor3[A, B, C] =
new TableFor3(from.heading, it.toSeq: _*)
}
}
/**
* A table with 4 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple4
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 TableFor4
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"),
* ( 0, 0, 0, 0),
* ( 1, 1, 1, 1),
* ( 2, 2, 2, 2),
* ( 3, 3, 3, 3),
* ( 4, 4, 4, 4),
* ( 5, 5, 5, 5),
* ( 6, 6, 6, 6),
* ( 7, 7, 7, 7),
* ( 8, 8, 8, 8),
* ( 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 4 members in each tuple, the type you'll get back will be a TableFor4
.
*
*
*
* 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 TableFor4
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor4
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d) =>
* a + b + c + d should equal (a * 4)
* }
*
*
*
* Because TableFor4
is a Seq[(A, B, C, D)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple4
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor4[A, B, C, D](val heading: (String, String, String, String), rows: (A, B, C, D)*) extends IndexedSeq[(A, B, C, D)] with scala.collection.IndexedSeqOps[(A, B, C, D), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D)) => Boolean): TableFor4[A, B, C, D] = new TableFor4[A, B, C, D](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D)]): TableFor4[A, B, C, D] = new TableFor4[A, B, C, D](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor4
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor4
*/
def apply[ASSERTION](fun: (A, B, C, D) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor4
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor4
to return another TableFor4
.
*
* @author Bill Venners
*/
object TableFor4 {
/**
* Implicit method enabling higher order functions of TableFor4
to return sequences of type TableFor4
.
*/
implicit def canBuildFrom[A, B, C, D]: scala.collection.BuildFrom[TableFor4[A, B, C, D], (A, B, C, D), TableFor4[A, B, C, D]] =
new scala.collection.BuildFrom[TableFor4[A, B, C, D], (A, B, C, D), TableFor4[A, B, C, D]] {
def apply(): Builder[(A, B, C, D), TableFor4[A, B, C, D]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D)]) =>
new TableFor4(("arg0","arg1","arg2","arg3"))
}
def newBuilder(from: org.scalatest.prop.TableFor4[A, B, C, D]): scala.collection.mutable.Builder[(A, B, C, D), TableFor4[A, B, C, D]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D)]) =>
new TableFor4(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor4[A, B, C, D])(it: IterableOnce[(A, B, C, D)]): org.scalatest.prop.TableFor4[A, B, C, D] =
new TableFor4(from.heading, it.toSeq: _*)
}
}
/**
* 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple5
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor5[A, B, C, D, E](val heading: (String, String, String, String, String), rows: (A, B, C, D, E)*) extends IndexedSeq[(A, B, C, D, E)] with scala.collection.IndexedSeqOps[(A, B, C, D, E), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E)) => Boolean): TableFor5[A, B, C, D, E] = new TableFor5[A, B, C, D, E](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E)]): TableFor5[A, B, C, D, E] = new TableFor5[A, B, C, D, E](heading, (rows ++ others): _*)
/**
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor5
*/
def apply[ASSERTION](fun: (A, B, C, D, E) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor5
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor5
to return another TableFor5
.
*
* @author Bill Venners
*/
object TableFor5 {
/**
* Implicit method enabling higher order functions of TableFor5
to return sequences of type TableFor5
.
*/
implicit def canBuildFrom[A, B, C, D, E]: scala.collection.BuildFrom[TableFor5[A, B, C, D, E], (A, B, C, D, E), TableFor5[A, B, C, D, E]] =
new scala.collection.BuildFrom[TableFor5[A, B, C, D, E], (A, B, C, D, E), TableFor5[A, B, C, D, E]] {
def apply(): Builder[(A, B, C, D, E), TableFor5[A, B, C, D, E]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E)]) =>
new TableFor5(("arg0","arg1","arg2","arg3","arg4"))
}
def newBuilder(from: org.scalatest.prop.TableFor5[A, B, C, D, E]): scala.collection.mutable.Builder[(A, B, C, D, E), TableFor5[A, B, C, D, E]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E)]) =>
new TableFor5(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor5[A, B, C, D, E])(it: IterableOnce[(A, B, C, D, E)]): org.scalatest.prop.TableFor5[A, B, C, D, E] =
new TableFor5(from.heading, it.toSeq: _*)
}
}
/**
* A table with 6 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple6
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 TableFor6
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", "f"),
* ( 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 6 members in each tuple, the type you'll get back will be a TableFor6
.
*
*
*
* 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 TableFor6
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor6
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f) =>
* a + b + c + d + e + f should equal (a * 6)
* }
*
*
*
* Because TableFor6
is a Seq[(A, B, C, D, E, F)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple6
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor6[A, B, C, D, E, F](val heading: (String, String, String, String, String, String), rows: (A, B, C, D, E, F)*) extends IndexedSeq[(A, B, C, D, E, F)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F)) => Boolean): TableFor6[A, B, C, D, E, F] = new TableFor6[A, B, C, D, E, F](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F)]): TableFor6[A, B, C, D, E, F] = new TableFor6[A, B, C, D, E, F](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor6
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor6
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor6
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor6
to return another TableFor6
.
*
* @author Bill Venners
*/
object TableFor6 {
/**
* Implicit method enabling higher order functions of TableFor6
to return sequences of type TableFor6
.
*/
implicit def canBuildFrom[A, B, C, D, E, F]: scala.collection.BuildFrom[TableFor6[A, B, C, D, E, F], (A, B, C, D, E, F), TableFor6[A, B, C, D, E, F]] =
new scala.collection.BuildFrom[TableFor6[A, B, C, D, E, F], (A, B, C, D, E, F), TableFor6[A, B, C, D, E, F]] {
def apply(): Builder[(A, B, C, D, E, F), TableFor6[A, B, C, D, E, F]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F)]) =>
new TableFor6(("arg0","arg1","arg2","arg3","arg4","arg5"))
}
def newBuilder(from: org.scalatest.prop.TableFor6[A, B, C, D, E, F]): scala.collection.mutable.Builder[(A, B, C, D, E, F), TableFor6[A, B, C, D, E, F]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F)]) =>
new TableFor6(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor6[A, B, C, D, E, F])(it: IterableOnce[(A, B, C, D, E, F)]): org.scalatest.prop.TableFor6[A, B, C, D, E, F] =
new TableFor6(from.heading, it.toSeq: _*)
}
}
/**
* A table with 7 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple7
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 TableFor7
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", "f", "g"),
* ( 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 7 members in each tuple, the type you'll get back will be a TableFor7
.
*
*
*
* 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 TableFor7
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor7
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g) =>
* a + b + c + d + e + f + g should equal (a * 7)
* }
*
*
*
* Because TableFor7
is a Seq[(A, B, C, D, E, F, G)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple7
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor7[A, B, C, D, E, F, G](val heading: (String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G)*) extends IndexedSeq[(A, B, C, D, E, F, G)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G)) => Boolean): TableFor7[A, B, C, D, E, F, G] = new TableFor7[A, B, C, D, E, F, G](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G)]): TableFor7[A, B, C, D, E, F, G] = new TableFor7[A, B, C, D, E, F, G](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor7
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor7
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor7
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor7
to return another TableFor7
.
*
* @author Bill Venners
*/
object TableFor7 {
/**
* Implicit method enabling higher order functions of TableFor7
to return sequences of type TableFor7
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G]: scala.collection.BuildFrom[TableFor7[A, B, C, D, E, F, G], (A, B, C, D, E, F, G), TableFor7[A, B, C, D, E, F, G]] =
new scala.collection.BuildFrom[TableFor7[A, B, C, D, E, F, G], (A, B, C, D, E, F, G), TableFor7[A, B, C, D, E, F, G]] {
def apply(): Builder[(A, B, C, D, E, F, G), TableFor7[A, B, C, D, E, F, G]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G)]) =>
new TableFor7(("arg0","arg1","arg2","arg3","arg4","arg5","arg6"))
}
def newBuilder(from: org.scalatest.prop.TableFor7[A, B, C, D, E, F, G]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G), TableFor7[A, B, C, D, E, F, G]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G)]) =>
new TableFor7(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor7[A, B, C, D, E, F, G])(it: IterableOnce[(A, B, C, D, E, F, G)]): org.scalatest.prop.TableFor7[A, B, C, D, E, F, G] =
new TableFor7(from.heading, it.toSeq: _*)
}
}
/**
* A table with 8 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple8
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 TableFor8
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", "f", "g", "h"),
* ( 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 8 members in each tuple, the type you'll get back will be a TableFor8
.
*
*
*
* 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 TableFor8
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor8
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h) =>
* a + b + c + d + e + f + g + h should equal (a * 8)
* }
*
*
*
* Because TableFor8
is a Seq[(A, B, C, D, E, F, G, H)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple8
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor8[A, B, C, D, E, F, G, H](val heading: (String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H)*) extends IndexedSeq[(A, B, C, D, E, F, G, H)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H)) => Boolean): TableFor8[A, B, C, D, E, F, G, H] = new TableFor8[A, B, C, D, E, F, G, H](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H)]): TableFor8[A, B, C, D, E, F, G, H] = new TableFor8[A, B, C, D, E, F, G, H](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor8
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor8
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor8
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor8
to return another TableFor8
.
*
* @author Bill Venners
*/
object TableFor8 {
/**
* Implicit method enabling higher order functions of TableFor8
to return sequences of type TableFor8
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H]: scala.collection.BuildFrom[TableFor8[A, B, C, D, E, F, G, H], (A, B, C, D, E, F, G, H), TableFor8[A, B, C, D, E, F, G, H]] =
new scala.collection.BuildFrom[TableFor8[A, B, C, D, E, F, G, H], (A, B, C, D, E, F, G, H), TableFor8[A, B, C, D, E, F, G, H]] {
def apply(): Builder[(A, B, C, D, E, F, G, H), TableFor8[A, B, C, D, E, F, G, H]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H)]) =>
new TableFor8(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7"))
}
def newBuilder(from: org.scalatest.prop.TableFor8[A, B, C, D, E, F, G, H]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H), TableFor8[A, B, C, D, E, F, G, H]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H)]) =>
new TableFor8(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor8[A, B, C, D, E, F, G, H])(it: IterableOnce[(A, B, C, D, E, F, G, H)]): org.scalatest.prop.TableFor8[A, B, C, D, E, F, G, H] =
new TableFor8(from.heading, it.toSeq: _*)
}
}
/**
* A table with 9 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple9
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 TableFor9
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", "f", "g", "h", "i"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 9 members in each tuple, the type you'll get back will be a TableFor9
.
*
*
*
* 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 TableFor9
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor9
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i) =>
* a + b + c + d + e + f + g + h + i should equal (a * 9)
* }
*
*
*
* Because TableFor9
is a Seq[(A, B, C, D, E, F, G, H, I)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple9
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor9[A, B, C, D, E, F, G, H, I](val heading: (String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I)) => Boolean): TableFor9[A, B, C, D, E, F, G, H, I] = new TableFor9[A, B, C, D, E, F, G, H, I](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I)]): TableFor9[A, B, C, D, E, F, G, H, I] = new TableFor9[A, B, C, D, E, F, G, H, I](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor9
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor9
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor9
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor9
to return another TableFor9
.
*
* @author Bill Venners
*/
object TableFor9 {
/**
* Implicit method enabling higher order functions of TableFor9
to return sequences of type TableFor9
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I]: scala.collection.BuildFrom[TableFor9[A, B, C, D, E, F, G, H, I], (A, B, C, D, E, F, G, H, I), TableFor9[A, B, C, D, E, F, G, H, I]] =
new scala.collection.BuildFrom[TableFor9[A, B, C, D, E, F, G, H, I], (A, B, C, D, E, F, G, H, I), TableFor9[A, B, C, D, E, F, G, H, I]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I), TableFor9[A, B, C, D, E, F, G, H, I]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I)]) =>
new TableFor9(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8"))
}
def newBuilder(from: org.scalatest.prop.TableFor9[A, B, C, D, E, F, G, H, I]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I), TableFor9[A, B, C, D, E, F, G, H, I]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I)]) =>
new TableFor9(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor9[A, B, C, D, E, F, G, H, I])(it: IterableOnce[(A, B, C, D, E, F, G, H, I)]): org.scalatest.prop.TableFor9[A, B, C, D, E, F, G, H, I] =
new TableFor9(from.heading, it.toSeq: _*)
}
}
/**
* A table with 10 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple10
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 TableFor10
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", "f", "g", "h", "i", "j"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 10 members in each tuple, the type you'll get back will be a TableFor10
.
*
*
*
* 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 TableFor10
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor10
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j) =>
* a + b + c + d + e + f + g + h + i + j should equal (a * 10)
* }
*
*
*
* Because TableFor10
is a Seq[(A, B, C, D, E, F, G, H, I, J)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple10
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor10[A, B, C, D, E, F, G, H, I, J](val heading: (String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J)) => Boolean): TableFor10[A, B, C, D, E, F, G, H, I, J] = new TableFor10[A, B, C, D, E, F, G, H, I, J](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J)]): TableFor10[A, B, C, D, E, F, G, H, I, J] = new TableFor10[A, B, C, D, E, F, G, H, I, J](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor10
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor10
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor10
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor10
to return another TableFor10
.
*
* @author Bill Venners
*/
object TableFor10 {
/**
* Implicit method enabling higher order functions of TableFor10
to return sequences of type TableFor10
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J]: scala.collection.BuildFrom[TableFor10[A, B, C, D, E, F, G, H, I, J], (A, B, C, D, E, F, G, H, I, J), TableFor10[A, B, C, D, E, F, G, H, I, J]] =
new scala.collection.BuildFrom[TableFor10[A, B, C, D, E, F, G, H, I, J], (A, B, C, D, E, F, G, H, I, J), TableFor10[A, B, C, D, E, F, G, H, I, J]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J), TableFor10[A, B, C, D, E, F, G, H, I, J]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J)]) =>
new TableFor10(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"))
}
def newBuilder(from: org.scalatest.prop.TableFor10[A, B, C, D, E, F, G, H, I, J]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J), TableFor10[A, B, C, D, E, F, G, H, I, J]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J)]) =>
new TableFor10(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor10[A, B, C, D, E, F, G, H, I, J])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J)]): org.scalatest.prop.TableFor10[A, B, C, D, E, F, G, H, I, J] =
new TableFor10(from.heading, it.toSeq: _*)
}
}
/**
* A table with 11 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple11
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 TableFor11
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", "f", "g", "h", "i", "j", "k"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 11 members in each tuple, the type you'll get back will be a TableFor11
.
*
*
*
* 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 TableFor11
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor11
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k) =>
* a + b + c + d + e + f + g + h + i + j + k should equal (a * 11)
* }
*
*
*
* Because TableFor11
is a Seq[(A, B, C, D, E, F, G, H, I, J, K)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple11
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor11[A, B, C, D, E, F, G, H, I, J, K](val heading: (String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K)) => Boolean): TableFor11[A, B, C, D, E, F, G, H, I, J, K] = new TableFor11[A, B, C, D, E, F, G, H, I, J, K](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K)]): TableFor11[A, B, C, D, E, F, G, H, I, J, K] = new TableFor11[A, B, C, D, E, F, G, H, I, J, K](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor11
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor11
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor11
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor11
to return another TableFor11
.
*
* @author Bill Venners
*/
object TableFor11 {
/**
* Implicit method enabling higher order functions of TableFor11
to return sequences of type TableFor11
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K]: scala.collection.BuildFrom[TableFor11[A, B, C, D, E, F, G, H, I, J, K], (A, B, C, D, E, F, G, H, I, J, K), TableFor11[A, B, C, D, E, F, G, H, I, J, K]] =
new scala.collection.BuildFrom[TableFor11[A, B, C, D, E, F, G, H, I, J, K], (A, B, C, D, E, F, G, H, I, J, K), TableFor11[A, B, C, D, E, F, G, H, I, J, K]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K), TableFor11[A, B, C, D, E, F, G, H, I, J, K]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K)]) =>
new TableFor11(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10"))
}
def newBuilder(from: org.scalatest.prop.TableFor11[A, B, C, D, E, F, G, H, I, J, K]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K), TableFor11[A, B, C, D, E, F, G, H, I, J, K]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K)]) =>
new TableFor11(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor11[A, B, C, D, E, F, G, H, I, J, K])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K)]): org.scalatest.prop.TableFor11[A, B, C, D, E, F, G, H, I, J, K] =
new TableFor11(from.heading, it.toSeq: _*)
}
}
/**
* A table with 12 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple12
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 TableFor12
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", "f", "g", "h", "i", "j", "k", "l"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 12 members in each tuple, the type you'll get back will be a TableFor12
.
*
*
*
* 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 TableFor12
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor12
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l) =>
* a + b + c + d + e + f + g + h + i + j + k + l should equal (a * 12)
* }
*
*
*
* Because TableFor12
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple12
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor12[A, B, C, D, E, F, G, H, I, J, K, L](val heading: (String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L)) => Boolean): TableFor12[A, B, C, D, E, F, G, H, I, J, K, L] = new TableFor12[A, B, C, D, E, F, G, H, I, J, K, L](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L)]): TableFor12[A, B, C, D, E, F, G, H, I, J, K, L] = new TableFor12[A, B, C, D, E, F, G, H, I, J, K, L](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor12
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor12
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor12
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor12
to return another TableFor12
.
*
* @author Bill Venners
*/
object TableFor12 {
/**
* Implicit method enabling higher order functions of TableFor12
to return sequences of type TableFor12
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L]: scala.collection.BuildFrom[TableFor12[A, B, C, D, E, F, G, H, I, J, K, L], (A, B, C, D, E, F, G, H, I, J, K, L), TableFor12[A, B, C, D, E, F, G, H, I, J, K, L]] =
new scala.collection.BuildFrom[TableFor12[A, B, C, D, E, F, G, H, I, J, K, L], (A, B, C, D, E, F, G, H, I, J, K, L), TableFor12[A, B, C, D, E, F, G, H, I, J, K, L]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L), TableFor12[A, B, C, D, E, F, G, H, I, J, K, L]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L)]) =>
new TableFor12(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11"))
}
def newBuilder(from: org.scalatest.prop.TableFor12[A, B, C, D, E, F, G, H, I, J, K, L]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L), TableFor12[A, B, C, D, E, F, G, H, I, J, K, L]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L)]) =>
new TableFor12(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor12[A, B, C, D, E, F, G, H, I, J, K, L])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L)]): org.scalatest.prop.TableFor12[A, B, C, D, E, F, G, H, I, J, K, L] =
new TableFor12(from.heading, it.toSeq: _*)
}
}
/**
* A table with 13 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple13
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 TableFor13
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", "f", "g", "h", "i", "j", "k", "l", "m"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 13 members in each tuple, the type you'll get back will be a TableFor13
.
*
*
*
* 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 TableFor13
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor13
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m should equal (a * 13)
* }
*
*
*
* Because TableFor13
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple13
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M)) => Boolean): TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M] = new TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M)]): TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M] = new TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor13
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor13
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor13
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor13
to return another TableFor13
.
*
* @author Bill Venners
*/
object TableFor13 {
/**
* Implicit method enabling higher order functions of TableFor13
to return sequences of type TableFor13
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M]: scala.collection.BuildFrom[TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M], (A, B, C, D, E, F, G, H, I, J, K, L, M), TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M]] =
new scala.collection.BuildFrom[TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M], (A, B, C, D, E, F, G, H, I, J, K, L, M), TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M), TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M)]) =>
new TableFor13(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12"))
}
def newBuilder(from: org.scalatest.prop.TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M), TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M)]) =>
new TableFor13(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M)]): org.scalatest.prop.TableFor13[A, B, C, D, E, F, G, H, I, J, K, L, M] =
new TableFor13(from.heading, it.toSeq: _*)
}
}
/**
* A table with 14 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple14
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 TableFor14
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", "f", "g", "h", "i", "j", "k", "l", "m", "n"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 14 members in each tuple, the type you'll get back will be a TableFor14
.
*
*
*
* 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 TableFor14
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor14
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n should equal (a * 14)
* }
*
*
*
* Because TableFor14
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple14
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N)) => Boolean): TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N] = new TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]): TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N] = new TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor14
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor14
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor14
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor14
to return another TableFor14
.
*
* @author Bill Venners
*/
object TableFor14 {
/**
* Implicit method enabling higher order functions of TableFor14
to return sequences of type TableFor14
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N]: scala.collection.BuildFrom[TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N], (A, B, C, D, E, F, G, H, I, J, K, L, M, N), TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N]] =
new scala.collection.BuildFrom[TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N], (A, B, C, D, E, F, G, H, I, J, K, L, M, N), TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N), TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]) =>
new TableFor14(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13"))
}
def newBuilder(from: org.scalatest.prop.TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N), TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]) =>
new TableFor14(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N)]): org.scalatest.prop.TableFor14[A, B, C, D, E, F, G, H, I, J, K, L, M, N] =
new TableFor14(from.heading, it.toSeq: _*)
}
}
/**
* A table with 15 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple15
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 TableFor15
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 15 members in each tuple, the type you'll get back will be a TableFor15
.
*
*
*
* 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 TableFor15
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor15
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o should equal (a * 15)
* }
*
*
*
* Because TableFor15
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple15
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)) => Boolean): TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] = new TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]): TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] = new TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor15
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor15
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor15
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor15
to return another TableFor15
.
*
* @author Bill Venners
*/
object TableFor15 {
/**
* Implicit method enabling higher order functions of TableFor15
to return sequences of type TableFor15
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]: scala.collection.BuildFrom[TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] =
new scala.collection.BuildFrom[TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]) =>
new TableFor15(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14"))
}
def newBuilder(from: org.scalatest.prop.TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O), TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]) =>
new TableFor15(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)]): org.scalatest.prop.TableFor15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] =
new TableFor15(from.heading, it.toSeq: _*)
}
}
/**
* A table with 16 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple16
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 TableFor16
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 16 members in each tuple, the type you'll get back will be a TableFor16
.
*
*
*
* 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 TableFor16
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor16
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p should equal (a * 16)
* }
*
*
*
* Because TableFor16
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple16
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)) => Boolean): TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] = new TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]): TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] = new TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor16
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor16
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor16
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor16
to return another TableFor16
.
*
* @author Bill Venners
*/
object TableFor16 {
/**
* Implicit method enabling higher order functions of TableFor16
to return sequences of type TableFor16
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]: scala.collection.BuildFrom[TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] =
new scala.collection.BuildFrom[TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]) =>
new TableFor16(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14","arg15"))
}
def newBuilder(from: org.scalatest.prop.TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P), TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]) =>
new TableFor16(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)]): org.scalatest.prop.TableFor16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] =
new TableFor16(from.heading, it.toSeq: _*)
}
}
/**
* A table with 17 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple17
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 TableFor17
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 17 members in each tuple, the type you'll get back will be a TableFor17
.
*
*
*
* 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 TableFor17
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor17
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q should equal (a * 17)
* }
*
*
*
* Because TableFor17
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple17
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)) => Boolean): TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] = new TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]): TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] = new TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor17
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor17
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor17
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor17
to return another TableFor17
.
*
* @author Bill Venners
*/
object TableFor17 {
/**
* Implicit method enabling higher order functions of TableFor17
to return sequences of type TableFor17
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]: scala.collection.BuildFrom[TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q), TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] =
new scala.collection.BuildFrom[TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q), TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q), TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]) =>
new TableFor17(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14","arg15","arg16"))
}
def newBuilder(from: org.scalatest.prop.TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q), TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]) =>
new TableFor17(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]): org.scalatest.prop.TableFor17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] =
new TableFor17(from.heading, it.toSeq: _*)
}
}
/**
* A table with 18 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple18
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 TableFor18
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 18 members in each tuple, the type you'll get back will be a TableFor18
.
*
*
*
* 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 TableFor18
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor18
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r should equal (a * 18)
* }
*
*
*
* Because TableFor18
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple18
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)) => Boolean): TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] = new TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]): TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] = new TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor18
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor18
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor18
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor18
to return another TableFor18
.
*
* @author Bill Venners
*/
object TableFor18 {
/**
* Implicit method enabling higher order functions of TableFor18
to return sequences of type TableFor18
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]: scala.collection.BuildFrom[TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R), TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] =
new scala.collection.BuildFrom[TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R), TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R), TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]) =>
new TableFor18(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14","arg15","arg16","arg17"))
}
def newBuilder(from: org.scalatest.prop.TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R), TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]) =>
new TableFor18(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)]): org.scalatest.prop.TableFor18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] =
new TableFor18(from.heading, it.toSeq: _*)
}
}
/**
* A table with 19 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple19
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 TableFor19
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 19 members in each tuple, the type you'll get back will be a TableFor19
.
*
*
*
* 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 TableFor19
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor19
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s should equal (a * 19)
* }
*
*
*
* Because TableFor19
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple19
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)) => Boolean): TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] = new TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]): TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] = new TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor19
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor19
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor19
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor19
to return another TableFor19
.
*
* @author Bill Venners
*/
object TableFor19 {
/**
* Implicit method enabling higher order functions of TableFor19
to return sequences of type TableFor19
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]: scala.collection.BuildFrom[TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S), TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] =
new scala.collection.BuildFrom[TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S), TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S), TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]) =>
new TableFor19(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14","arg15","arg16","arg17","arg18"))
}
def newBuilder(from: org.scalatest.prop.TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S), TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]) =>
new TableFor19(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)]): org.scalatest.prop.TableFor19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] =
new TableFor19(from.heading, it.toSeq: _*)
}
}
/**
* A table with 20 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple20
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 TableFor20
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 20 members in each tuple, the type you'll get back will be a TableFor20
.
*
*
*
* 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 TableFor20
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor20
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t should equal (a * 20)
* }
*
*
*
* Because TableFor20
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple20
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)) => Boolean): TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] = new TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]): TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] = new TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor20
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor20
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor20
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor20
to return another TableFor20
.
*
* @author Bill Venners
*/
object TableFor20 {
/**
* Implicit method enabling higher order functions of TableFor20
to return sequences of type TableFor20
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]: scala.collection.BuildFrom[TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T), TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] =
new scala.collection.BuildFrom[TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T), TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T), TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]) =>
new TableFor20(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14","arg15","arg16","arg17","arg18","arg19"))
}
def newBuilder(from: org.scalatest.prop.TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T), TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]) =>
new TableFor20(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)]): org.scalatest.prop.TableFor20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] =
new TableFor20(from.heading, it.toSeq: _*)
}
}
/**
* A table with 21 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple21
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 TableFor21
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 21 members in each tuple, the type you'll get back will be a TableFor21
.
*
*
*
* 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 TableFor21
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor21
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u should equal (a * 21)
* }
*
*
*
* Because TableFor21
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple21
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)) => Boolean): TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] = new TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]): TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] = new TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor21
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor21
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor21
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor21
to return another TableFor21
.
*
* @author Bill Venners
*/
object TableFor21 {
/**
* Implicit method enabling higher order functions of TableFor21
to return sequences of type TableFor21
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]: scala.collection.BuildFrom[TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U), TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] =
new scala.collection.BuildFrom[TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U), TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U), TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]) =>
new TableFor21(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14","arg15","arg16","arg17","arg18","arg19","arg20"))
}
def newBuilder(from: org.scalatest.prop.TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U), TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]) =>
new TableFor21(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)]): org.scalatest.prop.TableFor21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] =
new TableFor21(from.heading, it.toSeq: _*)
}
}
/**
* A table with 22 columns.
*
*
* For an introduction to using tables, see the documentation for trait
* TableDrivenPropertyChecks.
*
*
*
* This table is a sequence of Tuple22
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 TableFor22
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", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v"),
* ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
* ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
* ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
* ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
* ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),
* ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5),
* ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6),
* ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7),
* ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8),
* ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
* )
*
*
*
* Because you supplied 22 members in each tuple, the type you'll get back will be a TableFor22
.
*
*
*
* 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 TableFor22
as its
* first argument, then in a curried argument list takes the property check function. It invokes apply
on
* the TableFor22
, passing in the property check function. Here's an example:
*
*
*
* forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) =>
* a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u + v should equal (a * 22)
* }
*
*
*
* Because TableFor22
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]
, 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.
*
*
* @param heading a tuple containing string names of the columns in this table
* @param rows a variable length parameter list of Tuple22
s containing the data of this table
*
* @author Bill Venners
*/
class TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](val heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)*) extends IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)] with scala.collection.IndexedSeqOps[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V), scala.collection.IndexedSeq, scala.collection.IndexedSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]] {
/**
* Selects a row of data by its index.
*/
def apply(idx: Int): (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) = rows(idx)
/**
* The number of rows of data in the table. (This does not include the heading
tuple)
*/
def length: Int = rows.length
override def filter(p: ((A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)) => Boolean): TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] = new TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading, rows.filter(p): _*)
def ++(others: Iterable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]): TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] = new TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading, (rows ++ others): _*)
/**
* Applies the passed property check function to each row of this TableFor22
.
*
*
* 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.
*
*
* @param fun the property check function to apply to each row of this TableFor22
*/
def apply[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forAll(heading, rows: _*)(fun)
}
def forEvery[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.forEvery(heading, rows: _*)(fun)
}
def exists[ASSERTION](fun: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) => ASSERTION)(implicit asserting: TableAsserting[ASSERTION], prettifier: Prettifier, pos: source.Position): asserting.Result = {
asserting.exists(heading, rows: _*)(fun)
}
/**
* A string representation of this object, which includes the heading strings as well as the rows of data.
*/
override def toString: String = stringPrefix + "(" + heading.toString + ", " + rows.mkString(", ") + ")"
}
/**
* Companion object for class TableFor22
that provides an implicit canBuildFrom
method
* that enables higher order functions defined on TableFor22
to return another TableFor22
.
*
* @author Bill Venners
*/
object TableFor22 {
/**
* Implicit method enabling higher order functions of TableFor22
to return sequences of type TableFor22
.
*/
implicit def canBuildFrom[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]: scala.collection.BuildFrom[TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V), TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] =
new scala.collection.BuildFrom[TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V], (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V), TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] {
def apply(): Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V), TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]) =>
new TableFor22(("arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9","arg10","arg11","arg12","arg13","arg14","arg15","arg16","arg17","arg18","arg19","arg20","arg21"))
}
def newBuilder(from: org.scalatest.prop.TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]): scala.collection.mutable.Builder[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V), TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] =
new ListBuffer mapResult { (buf: Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]) =>
new TableFor22(from.heading, buf: _*)
}
def fromSpecific(from: org.scalatest.prop.TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V])(it: IterableOnce[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)]): org.scalatest.prop.TableFor22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] =
new TableFor22(from.heading, it.toSeq: _*)
}
}