RTXI  2.4
The Real-Time eXperiment Interface Documentation
workspace_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 WORKSPACE_TESTS_H
21 #define WORKSPACE_TESTS_H
22 
23 #include <gtest/gtest.h>
24 #include <gmock/gmock.h>
25 #include <workspace.h>
26 
27 class WorkspaceInstanceTest : public ::testing::Test
28 {
29 public:
30  std::string defaultWorkspaceName;
31  std::string defaultInputChannelName = "CHANNEL INPUT";
32  std::string defaultInputChannelDescription = "DEFAULT INPUT CHANNEL DESCRIPTION";
33  std::string defaultOutputChannelName = "CHANNEL OUTPUT";
34  std::string defaultOutputChannelDescription = "DEFAULT OUTPUT CHANNEL DESCRIPTION";
35  std::string defaultParameterChannelName = "DEFAULT PARAMETER CHANNEL NAME";
36  std::string defaultParameterChannelDescription = "DEFAULT PARAMETER CHANNEL DESCRIPTION";
37  std::string defaultStateChannelName = "DEFAULT STATE CHANNEL NAME";
38  std::string defaultStateChannelDescription = "DEFAULT STATE CHANNEL DESCRIPTION";
39  std::string defaultEventChannelName = "DEFAULT EVENT CHANNEL NAME";
40  std::string defaultEventChannelDescription = "DEFAULT EVENT CHANNEL DESCRIPTION";
41  std::string defaultCommentChannelName = "DEFAULT COMMENT CHANNEL NAME";
42  std::string defaultCommentChannelDescription = "DEFAULT COMMENT CHANNEL DESCRIPTION";
44 
45 protected:
47  // Generates a default workspace with single input and output channel
48  defaultWorkspaceName = "DEFAULT:INSTANCE:NAME";
49  IO::channel_t defaultInputChannel_t = {
52  Workspace::INPUT
53  };
54  IO::channel_t defaultOutputChannel_t = {
57  Workspace::OUTPUT
58  };
59  IO::channel_t defaultParameterChannel_t {
62  Workspace::PARAMETER
63  };
64  IO::channel_t defaultStateChannel_t {
67  Workspace::STATE
68  };
69  IO::channel_t defaultEventChannel_t {
72  Workspace::EVENT
73  };
74  IO::channel_t defaultCommentChannel_t {
77  Workspace::COMMENT
78  };
80  defaultChannelList[0] = defaultInputChannel_t;
81  defaultChannelList[1] = defaultOutputChannel_t;
82  defaultChannelList[2] = defaultParameterChannel_t;
83  defaultChannelList[3] = defaultStateChannel_t;
84  defaultChannelList[4] = defaultEventChannel_t;
85  defaultChannelList[5] = defaultCommentChannel_t;
87  }
89 
91  std::vector<IO::flags_t> flagsList = {Workspace::INPUT, Workspace::OUTPUT, Workspace::PARAMETER,
92  Workspace::STATE, Workspace::EVENT, Workspace::COMMENT};
93 };
94 
95 class WorkspaceManagerTest : public ::testing::Test
96 {
97 protected:
100 
102 };
103 
105 {
106 public:
107  MOCK_METHOD(size_t, getCount, (IO::flags_t), (const));
108  MOCK_METHOD(std::string, getName, (IO::flags_t, size_t), (const));
109  MOCK_METHOD(std::string, getDescription, (IO::flags_t, size_t), (const));
110  MOCK_METHOD(double, getValue, (IO::flags_t, size_t), (const));
111  MOCK_METHOD(std::string, getValueString, (IO::flags_t, size_t), (const));
112  MOCK_METHOD(void, setValue, (size_t, double), (const));
113  MOCK_METHOD(void, setComment, (size_t, std::string), (const));
114 };
115 #endif
Workspace::Instance
Definition: workspace.h:76
WorkspaceInstanceTest::defaultStateChannelDescription
std::string defaultStateChannelDescription
Definition: workspace_tests.h:38
WorkspaceInstanceTest::defaultParameterChannelDescription
std::string defaultParameterChannelDescription
Definition: workspace_tests.h:36
WorkspaceInstanceTest::defaultChannelList
IO::channel_t * defaultChannelList
Definition: workspace_tests.h:43
Workspace::Instance::getDescription
std::string getDescription(IO::flags_t type, size_t index) const
Definition: workspace.cpp:168
WorkspaceManagerTest::manager
Workspace::Manager * manager
Definition: workspace_tests.h:101
WorkspaceInstanceTest::WorkspaceInstanceTest
WorkspaceInstanceTest()
Definition: workspace_tests.h:46
IO::flags_t
unsigned long flags_t
Definition: io.h:40
WorkspaceInstanceTest::defaultEventChannelName
std::string defaultEventChannelName
Definition: workspace_tests.h:39
workspace.h
Workspace::Manager
Definition: workspace.h:224
WorkspaceInstanceTest::defaultWorkspaceName
std::string defaultWorkspaceName
Definition: workspace_tests.h:30
Workspace::Instance::getCount
size_t getCount(IO::flags_t type) const
Definition: workspace.cpp:136
WorkspaceInstanceTest::defaultEventChannelDescription
std::string defaultEventChannelDescription
Definition: workspace_tests.h:40
Workspace::Instance::getValueString
std::string getValueString(IO::flags_t type, size_t index) const
Definition: workspace.cpp:204
Workspace::Instance::getValue
double getValue(IO::flags_t type, size_t index) const
Definition: workspace.cpp:182
WorkspaceInstanceTest::instance
Workspace::Instance * instance
Definition: workspace_tests.h:90
WorkspaceInstanceTest::flagsList
std::vector< IO::flags_t > flagsList
Definition: workspace_tests.h:91
WorkspaceInstanceTest::defaultOutputChannelDescription
std::string defaultOutputChannelDescription
Definition: workspace_tests.h:34
WorkspaceInstanceTest::~WorkspaceInstanceTest
~WorkspaceInstanceTest()
Definition: workspace_tests.h:88
WorkspaceInstanceTest::defaultParameterChannelName
std::string defaultParameterChannelName
Definition: workspace_tests.h:35
WorkspaceInstanceTest::defaultOutputChannelName
std::string defaultOutputChannelName
Definition: workspace_tests.h:33
WorkspaceInstanceTest::defaultCommentChannelDescription
std::string defaultCommentChannelDescription
Definition: workspace_tests.h:42
IO::Block::getName
std::string getName(void) const
Definition: io.h:215
WorkspaceInstanceTest::defaultCommentChannelName
std::string defaultCommentChannelName
Definition: workspace_tests.h:41
MockWorkspaceInstance::MOCK_METHOD
MOCK_METHOD(size_t, getCount,(IO::flags_t),(const))
WorkspaceInstanceTest::defaultInputChannelName
std::string defaultInputChannelName
Definition: workspace_tests.h:31
MockWorkspaceInstance
Definition: workspace_tests.h:104
IO::channel_t
Definition: io.h:56
WorkspaceManagerTest::~WorkspaceManagerTest
~WorkspaceManagerTest()
Definition: workspace_tests.h:99
WorkspaceInstanceTest::defaultInputChannelDescription
std::string defaultInputChannelDescription
Definition: workspace_tests.h:32
WorkspaceManagerTest::WorkspaceManagerTest
WorkspaceManagerTest()
Definition: workspace_tests.h:98
Workspace::Instance::setValue
void setValue(size_t index, double value)
Definition: workspace.cpp:231
WorkspaceInstanceTest
Definition: workspace_tests.h:27
Workspace::Instance::setComment
void setComment(size_t index, std::string comment)
Definition: workspace.cpp:253
WorkspaceManagerTest
Definition: workspace_tests.h:95
WorkspaceInstanceTest::defaultStateChannelName
std::string defaultStateChannelName
Definition: workspace_tests.h:37