RTXI  2.4
The Real-Time eXperiment Interface Documentation
core_plugins_tests.h
Go to the documentation of this file.
1 /*
2  The Real-Time eXperiment Interface (RTXI)
3  Copyright (C) 2011 Georgia Institute of Technology, University of Utah, Weill Cornell Medical College
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  */
19 
20 #ifndef CORE_PLUGINS_TESTS_H
21 #define CORE_PLUGINS_TESTS_H
22 
23 #include <filesystem>
24 #include <random>
25 #include <vector>
26 #include <plugin.h>
27 #include <gtest/gtest.h>
28 #include <math/runningstat.h>
29 
30 class PerformanceMeasurementPluginTests : public ::testing::Test
31 {
32 protected:
35  QString libraryPath(std::filesystem::current_path().string().c_str());
36  libraryPath += "/../plugins/performance_measurement/.libs/performance_measurement.so";
37  plugin = manager->load(libraryPath);
38  }
40 
43 };
44 
45 class RunningStatTests : public ::testing::Test
46 {
47 protected:
49  statobj = new RunningStat();
50  // generate 100 random numbers between 0 and 100
51  std::default_random_engine randgen;
52  std::uniform_real_distribution<double> dist(0.0, 100.0);
53  for(int i=0; i<100; ++i)
54  {
55  randnums.push_back(dist(randgen));
56  }
57  }
59 
60  RunningStat *statobj;
61  std::vector<double> randnums;
62 };
63 
64 class ConnectorPluginTests : public ::testing::Test
65 {
66 protected:
69  QString libraryPath(std::filesystem::current_path().string().c_str());
70  libraryPath += "/../plugins/connector/.libs/connector.so";
71  plugin = manager->load(libraryPath);
72  }
74 
77 };
78 
79 class DataRecorderPluginTests : public ::testing::Test
80 {
81 protected:
84  QString libraryPath(std::filesystem::current_path().string().c_str());
85  libraryPath += "/../plugins/data_recorder/.libs/data_recorder.so";
86  plugin = manager->load(libraryPath);
87  }
89 
92 
93 };
94 
95 class ModelLoaderPluginTests : public ::testing::Test
96 {
97 protected:
100  QString libraryPath(std::filesystem::current_path().string().c_str());
101  libraryPath += "/../plugins/model_loader/.libs/model_loader.so";
102  plugin = manager->load(libraryPath);
103  }
105 
108 
109 };
110 
111 
112 class ModuleInstallerPluginTests : public ::testing::Test
113 {
114 protected:
117  QString libraryPath(std::filesystem::current_path().string().c_str());
118  libraryPath += "/../plugins/module_installer/.libs/module_installer.so";
119  plugin = manager->load(libraryPath);
120  }
122 
125 
126 };
127 
128 class OscilloscopePluginTests : public ::testing::Test
129 {
130 protected:
133  QString libraryPath(std::filesystem::current_path().string().c_str());
134  libraryPath += "/../plugins/oscilloscope/.libs/oscilloscope.so";
135  plugin = manager->load(libraryPath);
136  }
138 
141 
142 };
143 
144 class SystemControlPluginTests : public ::testing::Test
145 {
146 protected:
149  QString libraryPath(std::filesystem::current_path().string().c_str());
150  libraryPath += "/../plugins/system_control/.libs/system_control.so";
151  plugin = manager->load(libraryPath);
152  }
154 
157 
158 };
159 
160 class UserPreferencesPluginTests : public ::testing::Test
161 {
162 protected:
165  QString libraryPath(std::filesystem::current_path().string().c_str());
166  libraryPath += "/../plugins/userprefs/.libs/userprefs.so";
167  plugin = manager->load(libraryPath);
168  }
170 
173 
174 };
175 
176 
177 #endif
DataRecorderPluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:90
PerformanceMeasurementPluginTests::~PerformanceMeasurementPluginTests
~PerformanceMeasurementPluginTests()
Definition: core_plugins_tests.h:39
RunningStatTests
Definition: core_plugins_tests.h:45
ConnectorPluginTests::~ConnectorPluginTests
~ConnectorPluginTests()
Definition: core_plugins_tests.h:73
SystemControlPluginTests::~SystemControlPluginTests
~SystemControlPluginTests()
Definition: core_plugins_tests.h:153
PerformanceMeasurementPluginTests
Definition: core_plugins_tests.h:30
Plugin::Manager::load
Object * load(const QString &library)
Definition: plugin.cpp:46
ModelLoaderPluginTests::~ModelLoaderPluginTests
~ModelLoaderPluginTests()
Definition: core_plugins_tests.h:104
SystemControlPluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:155
UserPreferencesPluginTests::~UserPreferencesPluginTests
~UserPreferencesPluginTests()
Definition: core_plugins_tests.h:169
UserPreferencesPluginTests
Definition: core_plugins_tests.h:160
Plugin::Object
Definition: plugin.h:145
RunningStatTests::~RunningStatTests
~RunningStatTests()
Definition: core_plugins_tests.h:58
ModuleInstallerPluginTests::~ModuleInstallerPluginTests
~ModuleInstallerPluginTests()
Definition: core_plugins_tests.h:121
OscilloscopePluginTests::OscilloscopePluginTests
OscilloscopePluginTests()
Definition: core_plugins_tests.h:131
ModuleInstallerPluginTests::ModuleInstallerPluginTests
ModuleInstallerPluginTests()
Definition: core_plugins_tests.h:115
plugin.h
ConnectorPluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:76
ModelLoaderPluginTests::ModelLoaderPluginTests
ModelLoaderPluginTests()
Definition: core_plugins_tests.h:98
OscilloscopePluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:140
Plugin::Manager
Definition: plugin.h:57
ModuleInstallerPluginTests
Definition: core_plugins_tests.h:112
ConnectorPluginTests
Definition: core_plugins_tests.h:64
ModuleInstallerPluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:124
RunningStatTests::RunningStatTests
RunningStatTests()
Definition: core_plugins_tests.h:48
OscilloscopePluginTests
Definition: core_plugins_tests.h:128
ModelLoaderPluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:106
DataRecorderPluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:91
ModuleInstallerPluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:123
SystemControlPluginTests
Definition: core_plugins_tests.h:144
ModelLoaderPluginTests
Definition: core_plugins_tests.h:95
DataRecorderPluginTests
Definition: core_plugins_tests.h:79
UserPreferencesPluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:172
ModelLoaderPluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:107
DataRecorderPluginTests::~DataRecorderPluginTests
~DataRecorderPluginTests()
Definition: core_plugins_tests.h:88
ConnectorPluginTests::ConnectorPluginTests
ConnectorPluginTests()
Definition: core_plugins_tests.h:67
OscilloscopePluginTests::~OscilloscopePluginTests
~OscilloscopePluginTests()
Definition: core_plugins_tests.h:137
SystemControlPluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:156
Plugin::Manager::getInstance
static Manager * getInstance(void)
Definition: plugin.cpp:188
PerformanceMeasurementPluginTests::manager
Plugin::Manager * manager
Definition: core_plugins_tests.h:42
OscilloscopePluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:139
DataRecorderPluginTests::DataRecorderPluginTests
DataRecorderPluginTests()
Definition: core_plugins_tests.h:82
UserPreferencesPluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:171
RunningStatTests::randnums
std::vector< double > randnums
Definition: core_plugins_tests.h:61
UserPreferencesPluginTests::UserPreferencesPluginTests
UserPreferencesPluginTests()
Definition: core_plugins_tests.h:163
SystemControlPluginTests::SystemControlPluginTests
SystemControlPluginTests()
Definition: core_plugins_tests.h:147
PerformanceMeasurementPluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:41
ConnectorPluginTests::plugin
Plugin::Object * plugin
Definition: core_plugins_tests.h:75
RunningStatTests::statobj
RunningStat * statobj
Definition: core_plugins_tests.h:60
PerformanceMeasurementPluginTests::PerformanceMeasurementPluginTests
PerformanceMeasurementPluginTests()
Definition: core_plugins_tests.h:33