From 49d15be9d59079e1df0bca2008860023b3ae8b4d 2017-12-18 14:55:22 From: Alexandre Leroux Date: 2017-12-18 14:55:22 Subject: [PATCH] Adds variable controller and properties to test structure - Properties will be used to define test bounds, like the number of variables to manipulate or the number of random operations to make - Variable controller will be the object manipulated during the random operations --- diff --git a/plugins/amda/meson.build b/plugins/amda/meson.build index dbf80e3..1531a2f 100644 --- a/plugins/amda/meson.build +++ b/plugins/amda/meson.build @@ -66,12 +66,18 @@ tests = [ [['tests/TestAmdaFuzzing.cpp'],'test_amda_fuzzing','AMDA fuzzing test'] ] +tests_sources = [ + 'tests/FuzzingDefs.h', + 'tests/FuzzingDefs.cpp', +] + foreach unit_test : tests test_moc_files = qt5.preprocess(moc_sources : unit_test[0]) test_exe = executable(unit_test[1],unit_test[0] , test_moc_files, link_with : [sciqlop_amdaplugin], include_directories : [amdaplugin_inc], cpp_args : ['-DAMDA_TESTS_RESOURCES_DIR="'+meson.current_source_dir()+'/tests-resources"'], + sources : [tests_sources], dependencies : [sciqlop_core, sciqlop_gui, qt5test]) test(unit_test[2], test_exe, args: ['-teamcity', '-o', '@0@.teamcity.txt'.format(unit_test[1])], timeout: 3 * 60) endforeach diff --git a/plugins/amda/tests/FuzzingDefs.cpp b/plugins/amda/tests/FuzzingDefs.cpp new file mode 100644 index 0000000..c4928a6 --- /dev/null +++ b/plugins/amda/tests/FuzzingDefs.cpp @@ -0,0 +1,2 @@ +#include "FuzzingDefs.h" + diff --git a/plugins/amda/tests/FuzzingDefs.h b/plugins/amda/tests/FuzzingDefs.h new file mode 100644 index 0000000..aff3960 --- /dev/null +++ b/plugins/amda/tests/FuzzingDefs.h @@ -0,0 +1,10 @@ +#ifndef SCIQLOP_FUZZINGDEFS_H +#define SCIQLOP_FUZZINGDEFS_H + +// /////// // +// Aliases // +// /////// // + +using Properties = QVariantHash; + +#endif // SCIQLOP_FUZZINGDEFS_H diff --git a/plugins/amda/tests/TestAmdaFuzzing.cpp b/plugins/amda/tests/TestAmdaFuzzing.cpp index 65946a2..6de8712 100644 --- a/plugins/amda/tests/TestAmdaFuzzing.cpp +++ b/plugins/amda/tests/TestAmdaFuzzing.cpp @@ -18,11 +18,21 @@ namespace { */ class FuzzingTest { public: + explicit FuzzingTest(VariableController &variableController, Properties properties) + : m_VariableController{variableController}, + m_Properties{std::move(properties)}, + { + } + void execute() { /// @todo: complete qCInfo(LOG_TestAmdaFuzzing()) << "Execution of the test completed."; } + +private: + VariableController &m_VariableController; + Properties m_Properties; }; } // namespace @@ -42,7 +52,7 @@ void TestAmdaFuzzing::testFuzzing_data() // Test structure // // ////////////// // - /// @todo: complete + QTest::addColumn("properties"); // Properties for random test // ////////// // // Test cases // @@ -53,10 +63,12 @@ void TestAmdaFuzzing::testFuzzing_data() void TestAmdaFuzzing::testFuzzing() { + QFETCH(Properties, properties); + auto &variableController = sqpApp->variableController(); auto &timeController = sqpApp->timeController(); - FuzzingTest test{}; + FuzzingTest test{variableController, properties}; test.execute(); }