@@ -1,37 +1,71 | |||
|
1 | 1 | #include <QObject> |
|
2 | 2 | #include <QtTest> |
|
3 | 3 | |
|
4 | #include <Variable/Variable.h> | |
|
5 | #include <Variable/VariableController.h> | |
|
6 | namespace { | |
|
7 | ||
|
8 | /** | |
|
9 | * Interface representing an operation performed on a variable controller. | |
|
10 | * This interface is used in tests to apply a set of operations and check the status of the | |
|
11 | * controller after each operation | |
|
12 | */ | |
|
13 | struct IOperation { | |
|
14 | virtual ~IOperation() = default; | |
|
15 | /// Executes the operation on the variable controller | |
|
16 | virtual void exec(VariableController &variableController) const = 0; | |
|
17 | }; | |
|
18 | ||
|
19 | /** | |
|
20 | * Test Iteration | |
|
21 | * | |
|
22 | * A test iteration includes an operation to be performed, and a set of expected ranges after each | |
|
23 | * operation. Each range is tested after the operation to ensure that: | |
|
24 | * - the range of the variable is the expected range | |
|
25 | * - the data of the variable are those generated for the expected range | |
|
26 | */ | |
|
27 | struct Iteration { | |
|
28 | std::shared_ptr<IOperation> m_Operation; ///< Operation to perform | |
|
29 | std::map<int, SqpRange> m_ExpectedRanges; ///< Expected ranges (by variable index) | |
|
30 | }; | |
|
31 | ||
|
32 | using Iterations = std::vector<Iteration>; | |
|
33 | ||
|
34 | } // namespace | |
|
35 | ||
|
36 | Q_DECLARE_METATYPE(Iterations) | |
|
37 | ||
|
4 | 38 | class TestVariableSync : public QObject { |
|
5 | 39 | Q_OBJECT |
|
6 | 40 | |
|
7 | 41 | private slots: |
|
8 | 42 | /// Input data for @sa testSync() |
|
9 | 43 | void testSync_data(); |
|
10 | 44 | |
|
11 | 45 | /// Tests synchronization between variables through several operations |
|
12 | 46 | void testSync(); |
|
13 | 47 | }; |
|
14 | 48 | |
|
15 | 49 | void TestVariableSync::testSync_data() |
|
16 | 50 | { |
|
17 | 51 | // ////////////// // |
|
18 | 52 | // Test structure // |
|
19 | 53 | // ////////////// // |
|
20 | 54 | |
|
21 | 55 | /// @todo |
|
22 | 56 | |
|
23 | 57 | // ////////// // |
|
24 | 58 | // Test cases // |
|
25 | 59 | // ////////// // |
|
26 | 60 | |
|
27 | 61 | /// @todo |
|
28 | 62 | } |
|
29 | 63 | |
|
30 | 64 | void TestVariableSync::testSync() |
|
31 | 65 | { |
|
32 | 66 | /// @todo |
|
33 | 67 | } |
|
34 | 68 | |
|
35 | 69 | QTEST_MAIN(TestVariableSync) |
|
36 | 70 | |
|
37 | 71 | #include "TestVariableSync.moc" |
General Comments 0
You need to be logged in to leave comments.
Login now