@@ -1,6 +1,40 | |||||
1 | #include <QObject> |
|
1 | #include <QObject> | |
2 | #include <QtTest> |
|
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 | class TestVariableSync : public QObject { |
|
38 | class TestVariableSync : public QObject { | |
5 | Q_OBJECT |
|
39 | Q_OBJECT | |
6 |
|
40 |
General Comments 0
You need to be logged in to leave comments.
Login now