##// END OF EJS Templates
Tests specific methods of 1-dim array data
Alexandre Leroux -
r519:766a3018077c
parent child
Show More
@@ -5,6 +5,10
5 class TestOneDimArrayData : public QObject {
5 class TestOneDimArrayData : public QObject {
6 Q_OBJECT
6 Q_OBJECT
7 private slots:
7 private slots:
8 /// Tests @sa ArrayData::data()
9 void testData_data();
10 void testData();
11
8 /// Tests @sa ArrayData::data(int componentIndex)
12 /// Tests @sa ArrayData::data(int componentIndex)
9 void testDataByComponentIndex_data();
13 void testDataByComponentIndex_data();
10 void testDataByComponentIndex();
14 void testDataByComponentIndex();
@@ -13,6 +17,10 private slots:
13 void testAdd_data();
17 void testAdd_data();
14 void testAdd();
18 void testAdd();
15
19
20 /// Tests @sa ArrayData::at(int index)
21 void testAt_data();
22 void testAt();
23
16 /// Tests @sa ArrayData::clear()
24 /// Tests @sa ArrayData::clear()
17 void testClear_data();
25 void testClear_data();
18 void testClear();
26 void testClear();
@@ -102,6 +110,37 void TestOneDimArrayData::testAdd()
102 QVERIFY(arrayData.data() == expectedData);
110 QVERIFY(arrayData.data() == expectedData);
103 }
111 }
104
112
113 void TestOneDimArrayData::testAt_data()
114 {
115 // Test structure
116 QTest::addColumn<QVector<double> >("inputData"); // array data's input
117 QTest::addColumn<int>("index"); // index to retrieve data
118 QTest::addColumn<double>("expectedData"); // expected data at index
119
120 // Test cases
121 QTest::newRow("data1") << QVector<double>{1., 2., 3., 4., 5.} << 0 << 1.;
122 QTest::newRow("data2") << QVector<double>{1., 2., 3., 4., 5.} << 3 << 4.;
123 }
124
125 void TestOneDimArrayData::testAt()
126 {
127 QFETCH(QVector<double>, inputData);
128 QFETCH(int, index);
129 QFETCH(double, expectedData);
130
131 ArrayData<1> arrayData{inputData};
132 QVERIFY(arrayData.at(index) == expectedData);
133 }
134
135 void TestOneDimArrayData::testClear_data()
136 {
137 // Test structure
138 QTest::addColumn<QVector<double> >("inputData"); // array data's input
139
140 // Test cases
141 QTest::newRow("data1") << QVector<double>{1., 2., 3., 4., 5.};
142 }
143
105 void TestOneDimArrayData::testClear()
144 void TestOneDimArrayData::testClear()
106 {
145 {
107 QFETCH(QVector<double>, inputData);
146 QFETCH(QVector<double>, inputData);
General Comments 0
You need to be logged in to leave comments. Login now