cpp-unit-testing-with-qt-test-advanced/UnitTests/TestCalculator/TestCalculator.cpp
void TestCalculator::testDiff_data()
{
	QTest::addColumn<int>("a");
	QTest::addColumn<int>("b");
	QTest::addColumn<int>("result");

	//Then you add rows of values.Each row contains a name and a list of values:
	QTest::newRow("all 0") << 0 << 0 << 0;
	QTest::newRow("same number") << 10 << 10 << 0;
	QTest::newRow("opposite number") << 10 << -10 << 20;
	QTest::newRow("positive res") << 10 << 5 << 5;
	QTest::newRow("negative res") << 5 << 10 << -5;
}
// -- tests data --
//Implementing a data function is a bit like inserting data into a database. 
//First you define your data like if you were defining a table:
tests data
Implementing a data function is a bit like inserting data into a database.
First you define your data like if you were defining a table.
tests data Implementing a data function is a bit like inserting data into a database . First you define your data like if you were defining a table .
void TestCalculator::testDiff_data()
{
	QTest::addColumn<int>("a");
	QTest::addColumn<int>("b");
	QTest::addColumn<int>("result");
	QTest::newRow("all 0") << 0 << 0 << 0;
	QTest::newRow("same number") << 10 << 10 << 0;
	QTest::newRow("opposite number") << 10 << -10 << 20;
	QTest::newRow("positive res") << 10 << 5 << 5;
	QTest::newRow("negative res") << 5 << 10 << -5;
}
void TestCalculator :: testDiff_data ( ) { QTest :: addColumn < int > ( " " ) ; QTest :: addColumn < int > ( " " ) ; QTest :: addColumn < int > ( " " ) ; QTest :: newRow ( " " ) << 0 << 0 << 0 ; QTest :: newRow ( " " ) << 10 << 10 << 0 ; QTest :: newRow ( " " ) << 10 << -10 << 20 ; QTest :: newRow ( " " ) << 10 << 5 << 5 ; QTest :: newRow ( " " ) << 5 << 10 << -5 ; }
tests data
Implementing a data function is a bit like inserting data into a database.
tests data Implementing a data function is a bit like inserting data into a database .
//Then you add rows of values.Each row contains a name and a list of values: