##// END OF EJS Templates
Creates validator interface
Alexandre Leroux -
r1226:1e58f6535bdb
parent child
Show More
@@ -0,0 +1,26
1 #include "FuzzingValidators.h"
2
3 #include <functional>
4
5 Q_LOGGING_CATEGORY(LOG_FuzzingValidators, "FuzzingValidators")
6
7 namespace {
8
9 /**
10 * Default implementation of @sa IFuzzingValidator. This validator takes as parameter of its
11 * construction a function of validation which is called in the validate() method
12 */
13 class FuzzingValidator : public IFuzzingValidator {
14 public:
15 /// Signature of a validation function
16 using ValidationFunction = std::function<void(const VariableState &variableState)>;
17
18 explicit FuzzingValidator(ValidationFunction fun) : m_Fun(std::move(fun)) {}
19
20 void validate(const VariableState &variableState) const override { m_Fun(variableState); }
21
22 private:
23 ValidationFunction m_Fun;
24 };
25
26 } // namespace
@@ -0,0 +1,21
1 #ifndef SCIQLOP_FUZZINGVALIDATORS_H
2 #define SCIQLOP_FUZZINGVALIDATORS_H
3
4 #include <QLoggingCategory>
5
6 Q_DECLARE_LOGGING_CATEGORY(LOG_FuzzingValidators)
7
8 class VariableState;
9
10 /**
11 * Struct that represents a validator. A validator checks if the state of a variable is valid at the
12 * moment it is called during a fuzzing test
13 */
14 struct IFuzzingValidator {
15 virtual ~IFuzzingValidator() noexcept = default;
16
17 /// Validates the variable's state passed in parameter
18 virtual void validate(const VariableState &variableState) const = 0;
19 };
20
21 #endif // SCIQLOP_FUZZINGVALIDATORS_H
@@ -1,87 +1,89
1
1
2 amdaplugin_moc_headers = [
2 amdaplugin_moc_headers = [
3 'include/AmdaPlugin.h',
3 'include/AmdaPlugin.h',
4 'include/AmdaProvider.h'
4 'include/AmdaProvider.h'
5 ]
5 ]
6
6
7 amdaplugin_sources = [
7 amdaplugin_sources = [
8 'src/AmdaDefs.cpp',
8 'src/AmdaDefs.cpp',
9 'src/AmdaParser.cpp',
9 'src/AmdaParser.cpp',
10 'src/AmdaPlugin.cpp',
10 'src/AmdaPlugin.cpp',
11 'src/AmdaProvider.cpp',
11 'src/AmdaProvider.cpp',
12 'src/AmdaResultParser.cpp',
12 'src/AmdaResultParser.cpp',
13 'src/AmdaResultParserDefs.cpp',
13 'src/AmdaResultParserDefs.cpp',
14 'src/AmdaResultParserHelper.cpp',
14 'src/AmdaResultParserHelper.cpp',
15 'src/AmdaServer.cpp'
15 'src/AmdaServer.cpp'
16 ]
16 ]
17
17
18 amdaplugin_ui_files = []
18 amdaplugin_ui_files = []
19 amdaplugin_resources_files = [
19 amdaplugin_resources_files = [
20 'resources/amdaresources.qrc'
20 'resources/amdaresources.qrc'
21 ]
21 ]
22
22
23 amdaplugin_inc = include_directories(['include', '../../plugin/include'])
23 amdaplugin_inc = include_directories(['include', '../../plugin/include'])
24
24
25 moc_gen = generator(moc,
25 moc_gen = generator(moc,
26 output : 'moc_@BASENAME@.cpp',
26 output : 'moc_@BASENAME@.cpp',
27 arguments : ['@INPUT@',
27 arguments : ['@INPUT@',
28 '-DSCIQLOP_PLUGIN_JSON_FILE_PATH="'+meson.source_root()+'/plugins/amda/resources/amda.json"',
28 '-DSCIQLOP_PLUGIN_JSON_FILE_PATH="'+meson.source_root()+'/plugins/amda/resources/amda.json"',
29 '-I', meson.current_source_dir()+'/include',
29 '-I', meson.current_source_dir()+'/include',
30 '-I', meson.current_source_dir()+'/../../plugin/include',
30 '-I', meson.current_source_dir()+'/../../plugin/include',
31 '-o', '@OUTPUT@'])
31 '-o', '@OUTPUT@'])
32
32
33 rcc_gen = generator(rcc,
33 rcc_gen = generator(rcc,
34 output : 'qrc_@BASENAME@.cpp',
34 output : 'qrc_@BASENAME@.cpp',
35 arguments : ['--name=@BASENAME@"',
35 arguments : ['--name=@BASENAME@"',
36 '--output',
36 '--output',
37 '@OUTPUT@',
37 '@OUTPUT@',
38 '@INPUT@'])
38 '@INPUT@'])
39
39
40 amdaplugin_moc_plugin_files = moc_gen.process(amdaplugin_moc_headers)
40 amdaplugin_moc_plugin_files = moc_gen.process(amdaplugin_moc_headers)
41
41
42 amdaplugin_rcc_plugin_files = rcc_gen.process(amdaplugin_resources_files)
42 amdaplugin_rcc_plugin_files = rcc_gen.process(amdaplugin_resources_files)
43
43
44 #amdaplugin_rcc_plugin_files = qt5.preprocess(
44 #amdaplugin_rcc_plugin_files = qt5.preprocess(
45 # qresources : amdaplugin_resources_files)
45 # qresources : amdaplugin_resources_files)
46
46
47 amdaplugin_moc_files = qt5.preprocess(
47 amdaplugin_moc_files = qt5.preprocess(
48 ui_files : amdaplugin_ui_files)
48 ui_files : amdaplugin_ui_files)
49
49
50 sciqlop_amdaplugin = library('amdaplugin',
50 sciqlop_amdaplugin = library('amdaplugin',
51 amdaplugin_sources,
51 amdaplugin_sources,
52 amdaplugin_moc_files,
52 amdaplugin_moc_files,
53 amdaplugin_rcc_plugin_files,
53 amdaplugin_rcc_plugin_files,
54 amdaplugin_moc_plugin_files,
54 amdaplugin_moc_plugin_files,
55 cpp_args : ['-DAMDA_LIB','-DQT_PLUGIN'],
55 cpp_args : ['-DAMDA_LIB','-DQT_PLUGIN'],
56 include_directories : [amdaplugin_inc],
56 include_directories : [amdaplugin_inc],
57 dependencies : [sciqlop_core, sciqlop_gui],
57 dependencies : [sciqlop_core, sciqlop_gui],
58 install : true
58 install : true
59 )
59 )
60
60
61
61
62 tests = [
62 tests = [
63 [['tests/TestAmdaParser.cpp'],'test_amda_parser','AMDA parser test'],
63 [['tests/TestAmdaParser.cpp'],'test_amda_parser','AMDA parser test'],
64 [['tests/TestAmdaResultParser.cpp'],'test_amda_result_parser','AMDA result parser test'],
64 [['tests/TestAmdaResultParser.cpp'],'test_amda_result_parser','AMDA result parser test'],
65 [['tests/TestAmdaAcquisition.cpp'],'test_amda_acquisition','AMDA Acquisition test'],
65 [['tests/TestAmdaAcquisition.cpp'],'test_amda_acquisition','AMDA Acquisition test'],
66 [['tests/TestAmdaFuzzing.cpp'],'test_amda_fuzzing','AMDA fuzzing test']
66 [['tests/TestAmdaFuzzing.cpp'],'test_amda_fuzzing','AMDA fuzzing test']
67 ]
67 ]
68
68
69 tests_sources = [
69 tests_sources = [
70 'tests/FuzzingDefs.h',
70 'tests/FuzzingDefs.h',
71 'tests/FuzzingDefs.cpp',
71 'tests/FuzzingDefs.cpp',
72 'tests/FuzzingOperations.h',
72 'tests/FuzzingOperations.h',
73 'tests/FuzzingOperations.cpp',
73 'tests/FuzzingOperations.cpp',
74 'tests/FuzzingUtils.h',
74 'tests/FuzzingUtils.h',
75 'tests/FuzzingUtils.cpp'
75 'tests/FuzzingUtils.cpp',
76 'tests/FuzzingValidators.h',
77 'tests/FuzzingValidators.cpp'
76 ]
78 ]
77
79
78 foreach unit_test : tests
80 foreach unit_test : tests
79 test_moc_files = qt5.preprocess(moc_sources : unit_test[0])
81 test_moc_files = qt5.preprocess(moc_sources : unit_test[0])
80 test_exe = executable(unit_test[1],unit_test[0] , test_moc_files,
82 test_exe = executable(unit_test[1],unit_test[0] , test_moc_files,
81 link_with : [sciqlop_amdaplugin],
83 link_with : [sciqlop_amdaplugin],
82 include_directories : [amdaplugin_inc],
84 include_directories : [amdaplugin_inc],
83 cpp_args : ['-DAMDA_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/tests-resources"'],
85 cpp_args : ['-DAMDA_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/tests-resources"'],
84 sources : [tests_sources],
86 sources : [tests_sources],
85 dependencies : [sciqlop_core, sciqlop_gui, qt5test])
87 dependencies : [sciqlop_core, sciqlop_gui, qt5test])
86 test(unit_test[2], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test[1])], timeout: 3 * 60)
88 test(unit_test[2], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test[1])], timeout: 3 * 60)
87 endforeach
89 endforeach
General Comments 0
You need to be logged in to leave comments. Login now