mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Reorganized directory structure for tests and src
This commit is contained in:
parent
21fda96978
commit
b86ea67563
@ -174,7 +174,7 @@ public:
|
||||
|
||||
UtcTime& operator=(const Timestamp& ts)
|
||||
{
|
||||
*this = UtcTime::fromUSec(ts.husec * Timestamp::USEC_PER_LSB);
|
||||
*this = fromUSec(ts.husec * Timestamp::USEC_PER_LSB);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/can_driver.hpp>
|
||||
#include <uavcan/system_clock.hpp>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
@ -83,14 +82,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
enum FrameType { STD, EXT };
|
||||
static uavcan::CanFrame makeCanFrame(uint32_t id, const std::string& str_data, FrameType type)
|
||||
{
|
||||
id |= (type == EXT) ? uavcan::CanFrame::FlagEFF : 0;
|
||||
return uavcan::CanFrame(id, reinterpret_cast<const uint8_t*>(str_data.c_str()), str_data.length());
|
||||
}
|
||||
|
||||
static bool areTimestampsClose(int64_t a, int64_t b, int64_t precision_usec = 10000)
|
||||
{
|
||||
return std::abs(a - b) < precision_usec;
|
||||
@ -5,8 +5,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <uavcan/timer.hpp>
|
||||
#include <uavcan/util/method_binder.hpp>
|
||||
#include "../common.hpp"
|
||||
#include "../transport/can/iface_mock.hpp"
|
||||
#include "../../clock.hpp"
|
||||
#include "../transport/can/can.hpp"
|
||||
|
||||
struct TimerCallCounter
|
||||
{
|
||||
@ -4,12 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include <gtest/gtest.h>
|
||||
#include <uavcan/internal/transport/can_io.hpp>
|
||||
#include <uavcan/internal/transport/transfer.hpp>
|
||||
#include "../../common.hpp"
|
||||
#include <uavcan/can_driver.hpp>
|
||||
#include <uavcan/system_clock.hpp>
|
||||
#include "../../../clock.hpp"
|
||||
|
||||
|
||||
class CanIfaceMock : public uavcan::ICanIface
|
||||
@ -155,3 +158,10 @@ public:
|
||||
uavcan::ICanIface* getIface(int iface_index) { return &ifaces.at(iface_index); }
|
||||
int getNumIfaces() const { return ifaces.size(); }
|
||||
};
|
||||
|
||||
enum FrameType { STD, EXT };
|
||||
static uavcan::CanFrame makeCanFrame(uint32_t id, const std::string& str_data, FrameType type)
|
||||
{
|
||||
id |= (type == EXT) ? uavcan::CanFrame::FlagEFF : 0;
|
||||
return uavcan::CanFrame(id, reinterpret_cast<const uint8_t*>(str_data.c_str()), str_data.length());
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "common.hpp"
|
||||
#include "can.hpp"
|
||||
#include <uavcan/can_driver.hpp>
|
||||
|
||||
TEST(CanFrame, FrameProperties)
|
||||
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "iface_mock.hpp"
|
||||
#include "can.hpp"
|
||||
|
||||
TEST(CanIOManager, CanDriverMock)
|
||||
{
|
||||
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "iface_mock.hpp"
|
||||
#include "can.hpp"
|
||||
|
||||
|
||||
static bool rxFrameEquals(const uavcan::CanRxFrame& rxframe, const uavcan::CanFrame& frame,
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <uavcan/internal/transport/can_io.hpp>
|
||||
#include "../../common.hpp"
|
||||
#include "can.hpp"
|
||||
|
||||
|
||||
static int getQueueLength(uavcan::CanTxQueue& queue)
|
||||
@ -5,7 +5,7 @@
|
||||
#include <memory>
|
||||
#include <gtest/gtest.h>
|
||||
#include "transfer_test_helpers.hpp"
|
||||
#include "can/iface_mock.hpp"
|
||||
#include "can/can.hpp"
|
||||
#include <uavcan/internal/transport/dispatcher.hpp>
|
||||
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
#include <string>
|
||||
#include <gtest/gtest.h>
|
||||
#include <uavcan/internal/transport/transfer.hpp>
|
||||
#include "../common.hpp"
|
||||
#include "../../clock.hpp"
|
||||
#include "can/can.hpp"
|
||||
|
||||
|
||||
TEST(Transfer, TransferID)
|
||||
@ -5,7 +5,7 @@
|
||||
#include <algorithm>
|
||||
#include <gtest/gtest.h>
|
||||
#include "transfer_test_helpers.hpp"
|
||||
#include "can/iface_mock.hpp"
|
||||
#include "can/can.hpp"
|
||||
#include <uavcan/internal/transport/transfer_sender.hpp>
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <uavcan/publisher.hpp>
|
||||
#include <uavcan/mavlink/Message.hpp>
|
||||
#include "common.hpp"
|
||||
#include "transport/can/iface_mock.hpp"
|
||||
#include "clock.hpp"
|
||||
#include "internal/transport/can/can.hpp"
|
||||
|
||||
|
||||
TEST(Publisher, Basic)
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#include <uavcan/util/method_binder.hpp>
|
||||
#include <uavcan/mavlink/Message.hpp>
|
||||
#include <root_ns_a/EmptyMessage.hpp>
|
||||
#include "common.hpp"
|
||||
#include "transport/can/iface_mock.hpp"
|
||||
#include "clock.hpp"
|
||||
#include "internal/transport/can/can.hpp"
|
||||
|
||||
|
||||
template <typename DataType>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user