RoboidControl-cpp/test/thing_test.cc
2025-01-02 11:53:46 +01:00

54 lines
1.2 KiB
C++

#if GTEST
// #include <gmock/gmock.h>
// not supported using Visual Studio 2022 compiler...
#include <gtest/gtest.h>
#include <chrono>
#include "Participant.h"
#include "Thing.h"
namespace Passer {
// Function to get the current time in milliseconds as unsigned long
unsigned long get_time_ms() {
auto now = std::chrono::steady_clock::now();
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
now.time_since_epoch());
return static_cast<unsigned long>(ms.count());
}
class ControlCoreSuite : public ::testing::Test {
protected:
// SetUp and TearDown can be used to set up and clean up before/after each
// test
void SetUp() override {
// Initialize test data here
}
void TearDown() override {
// Clean up test data here
}
};
TEST_F(ControlCoreSuite, Dummytest) {
// Participant participant = Participant("127.0.0.1", 7681);
ASSERT_EQ(1, 1);
}
TEST_F(ControlCoreSuite, Participant) {
Participant participant = Participant("127.0.0.1", 7681);
unsigned long milliseconds = get_time_ms();
unsigned long startTime = milliseconds;
while (milliseconds < startTime + 7000) {
participant.Update(milliseconds);
milliseconds = get_time_ms();
}
ASSERT_EQ(1, 1);
}
} // namespace Passer
#endif