Skip to content

Commit c20bde1

Browse files
committed
Add GlobalModule class
1 parent 0718a2e commit c20bde1

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

src/global/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set(MODULE global)
22
set(MODULE_URI Global)
33
set(MODULE_SRC
4+
globalmodule.cpp
5+
globalmodule.h
46
modularity/ioc.h
57
modularity/modulesioc.h
68
modularity/imoduleexportinterface.h

src/global/globalmodule.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
3+
#include "globalmodule.h"
4+
5+
using namespace scratchcpp;
6+
7+
std::string GlobalModule::moduleName() const
8+
{
9+
return "global";
10+
}

src/global/globalmodule.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
3+
#pragma once
4+
5+
#include "modularity/imodulesetup.h"
6+
7+
namespace scratchcpp
8+
{
9+
10+
class GlobalModule : public modularity::IModuleSetup
11+
{
12+
public:
13+
std::string moduleName() const override;
14+
};
15+
16+
} // namespace scratchcpp

src/global/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(MODULE_TEST_SRC
22
modularity.cpp
3+
setup.cpp
34
fakeexport.h
45
fakedependency.h
56
mocks/moduleexportinterfacemock.h

src/global/test/setup.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <gtest/gtest.h>
2+
3+
#include "globalmodule.h"
4+
5+
using namespace scratchcpp;
6+
7+
TEST(GlobalSetupTest, ModuleName)
8+
{
9+
GlobalModule module;
10+
ASSERT_EQ(module.moduleName(), "global");
11+
}

0 commit comments

Comments
 (0)