Skip to content

Commit d01a085

Browse files
committed
Update readme. Code cleanup.
1 parent 72cd8a2 commit d01a085

File tree

10 files changed

+271
-260
lines changed

10 files changed

+271
-260
lines changed

IntegrationTest/IT_Util.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515

1616
// Helper function to simplify asynchronous function invoke within a test
1717
template <typename C, typename F, typename T, typename M = std::chrono::milliseconds, typename... Args>
18-
auto AsyncInvoke(C obj, F func, T& thread, M timeout, Args&&... args)
18+
auto AsyncInvoke(C obj, F func, T& thread, M timeout, Args&&... args)
1919
{
20-
// Asynchronously call target function and wait up to timeout milliseconds to complete
21-
auto retVal = MakeDelegate(obj, func, thread, timeout).AsyncInvoke(std::forward<Args>(args)...);
20+
// Asynchronously call target function and wait up to timeout milliseconds to complete
21+
auto retVal = MakeDelegate(obj, func, thread, timeout).AsyncInvoke(std::forward<Args>(args)...);
2222

23-
// Check that the target function call succeeded within the timeout specified
24-
EXPECT_TRUE(retVal.has_value());
23+
// Check that the target function call succeeded within the timeout specified
24+
EXPECT_TRUE(retVal.has_value());
2525

26-
return retVal;
26+
return retVal;
2727
}
2828

2929
#endif

IntegrationTest/IntegrationTest.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,46 @@
1212
//----------------------------------------------------------------------------
1313
IntegrationTest& IntegrationTest::GetInstance()
1414
{
15-
static IntegrationTest instance;
16-
return instance;
15+
static IntegrationTest instance;
16+
return instance;
1717
}
1818

1919
//----------------------------------------------------------------------------
2020
// Constructor
2121
//----------------------------------------------------------------------------
2222
IntegrationTest::IntegrationTest() :
23-
m_thread("IntegrationTestThread")
23+
m_thread("IntegrationTestThread")
2424
{
25-
m_thread.CreateThread();
25+
m_thread.CreateThread();
2626

27-
// Start integration tests 500mS after system startup
28-
m_timer.Expired = MakeDelegate(this, &IntegrationTest::Run, m_thread);
29-
m_timer.Start(std::chrono::milliseconds(500));
27+
// Start integration tests 500mS after system startup
28+
m_timer.Expired = MakeDelegate(this, &IntegrationTest::Run, m_thread);
29+
m_timer.Start(std::chrono::milliseconds(500));
3030
}
3131

3232
//----------------------------------------------------------------------------
3333
// Destructor
3434
//----------------------------------------------------------------------------
3535
IntegrationTest::~IntegrationTest()
3636
{
37-
m_timer.Expired = 0;
37+
m_timer.Expired = 0;
3838
}
3939

4040
//----------------------------------------------------------------------------
4141
// Run
4242
//----------------------------------------------------------------------------
4343
void IntegrationTest::Run()
4444
{
45-
m_timer.Stop();
45+
m_timer.Stop();
4646

47-
// Initialize Google Test
48-
::testing::InitGoogleTest();
47+
// Initialize Google Test
48+
::testing::InitGoogleTest();
4949

50-
// Run all tests and return the result
51-
int retVal = RUN_ALL_TESTS();
50+
// Run all tests and return the result
51+
int retVal = RUN_ALL_TESTS();
5252

53-
std::cout << "RUN_ALL_TESTS() return value: " << retVal << std::endl;
53+
std::cout << "RUN_ALL_TESTS() return value: " << retVal << std::endl;
5454

55-
m_complete = true;
55+
m_complete = true;
5656
}
5757

IntegrationTest/IntegrationTest.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@
1212
class IntegrationTest
1313
{
1414
public:
15-
/// Get singleton instance of this class
16-
static IntegrationTest& GetInstance();
15+
/// Get singleton instance of this class
16+
static IntegrationTest& GetInstance();
1717

18-
// Return true if integration test is complete
19-
std::atomic<bool>& IsComplete() { return m_complete; }
18+
// Return true if integration test is complete
19+
std::atomic<bool>& IsComplete() { return m_complete; }
2020

2121
private:
22-
IntegrationTest();
23-
~IntegrationTest();
22+
IntegrationTest();
23+
~IntegrationTest();
2424

25-
// Called to run all integration tests
26-
void Run();
25+
// Called to run all integration tests
26+
void Run();
2727

28-
// The integration test worker thread that executes Google Test
29-
Thread m_thread;
28+
// The integration test worker thread that executes Google Test
29+
Thread m_thread;
3030

31-
// Timer to start integration tests
32-
Timer m_timer;
31+
// Timer to start integration tests
32+
Timer m_timer;
3333

34-
std::atomic<bool> m_complete = false;
34+
std::atomic<bool> m_complete = false;
3535
};
3636

3737
#endif

IntegrationTest/SignalThread.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,34 @@ class SignalThread
1414
{
1515
public:
1616
// Constructor initializes the signal to false
17-
SignalThread() : m_signalSet(false) { }
17+
SignalThread() : m_signalSet(false) {}
1818

1919
// This function waits for the signal for a maximum of milliseconds. It
2020
// returns true if the signal was set within the timeout, false otherwise.
2121
// @param[in] ms - milliseconds to wait for signal
2222
// @return Returns true if signalled, false otherwise.
23-
bool WaitForSignal(int ms)
23+
bool WaitForSignal(int ms)
2424
{
2525
std::unique_lock<std::mutex> lock(m_mutex);
2626

2727
// Wait until the signal is set or the timeout expires
28-
if (m_cv.wait_for(lock, std::chrono::milliseconds(ms), [this] { return m_signalSet; }))
28+
if (m_cv.wait_for(lock, std::chrono::milliseconds(ms), [this] { return m_signalSet; }))
2929
{
3030
// Reset the signal
31-
m_signalSet = false;
31+
m_signalSet = false;
3232

3333
// Signal was set within the timeout
3434
return true;
3535
}
36-
else
36+
else
3737
{
3838
// Timeout expired
3939
return false;
4040
}
4141
}
4242

4343
// This function sets the signal and notifies the waiting thread.
44-
void SetSignal()
44+
void SetSignal()
4545
{
4646
std::lock_guard<std::mutex> lock(m_mutex);
4747
m_signalSet = true;

Logger/src/LogData.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ using namespace std;
1111
//----------------------------------------------------------------------------
1212
void LogData::Write(const std::string& msg)
1313
{
14-
m_msgData.push_back(msg);
14+
m_msgData.push_back(msg);
1515
}
1616

1717
//----------------------------------------------------------------------------
@@ -25,9 +25,9 @@ bool LogData::Flush()
2525

2626
// Write log data to disk
2727
std::ofstream logFile("LogData.txt", std::ios::app);
28-
if (logFile.is_open())
28+
if (logFile.is_open())
2929
{
30-
for (const std::string& str : m_msgData)
30+
for (const std::string& str : m_msgData)
3131
{
3232
logFile << str << std::endl;
3333
}

Logger/src/LogData.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ class LogData
1212
{
1313
public:
1414
#ifdef IT_ENABLE
15-
dmq::MulticastDelegateSafe<void(std::chrono::milliseconds)> FlushTimeDelegate;
15+
dmq::MulticastDelegateSafe<void(std::chrono::milliseconds)> FlushTimeDelegate;
1616
#endif
1717

18-
LogData() { }
19-
~LogData() { m_msgData.clear(); }
18+
LogData() {}
19+
~LogData() { m_msgData.clear(); }
2020

21-
/// Write log data
22-
/// @param[in] msg - data to log
23-
void Write(const std::string& msg);
21+
/// Write log data
22+
/// @param[in] msg - data to log
23+
void Write(const std::string& msg);
2424

25-
/// Flush log data to disk
26-
/// @return True if success.
27-
bool Flush();
25+
/// Flush log data to disk
26+
/// @return True if success.
27+
bool Flush();
2828

2929
private:
30-
IT_PRIVATE_ACCESS:
30+
IT_PRIVATE_ACCESS :
3131

32-
/// List to hold log data messages
33-
std::list<std::string> m_msgData;
32+
/// List to hold log data messages
33+
std::list<std::string> m_msgData;
3434
};
3535

3636
#endif

0 commit comments

Comments
 (0)