mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-09-11 11:45:42 +00:00
Merge branch 'feature/signal_source_interface' of https://github.com/jwmelto/gnss-sdr into jwmelto-feature/signal_source_interface
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "in_memory_configuration.h"
|
||||
#include "observables_interface.h"
|
||||
#include "pvt_interface.h"
|
||||
#include "signal_source_interface.h"
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include "tracking_interface.h"
|
||||
#include <gtest/gtest.h>
|
||||
@@ -45,7 +46,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFileSignalSource)
|
||||
// Example of a factory as a shared_ptr
|
||||
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
|
||||
// Example of a block as a shared_ptr
|
||||
std::shared_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
auto signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
EXPECT_STREQ("SignalSource", signal_source->role().c_str());
|
||||
EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str());
|
||||
}
|
||||
@@ -59,7 +60,7 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongSignalSource)
|
||||
// Example of a factory as a unique_ptr
|
||||
std::unique_ptr<GNSSBlockFactory> factory = std::make_unique<GNSSBlockFactory>();
|
||||
// Example of a block as a unique_ptr
|
||||
std::unique_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
auto signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
EXPECT_EQ(nullptr, signal_source);
|
||||
}
|
||||
|
||||
@@ -350,8 +351,8 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongPvt)
|
||||
{
|
||||
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||
configuration->set_property("PVT.implementation", "Pepito");
|
||||
std::unique_ptr<GNSSBlockFactory> factory = std::make_unique<GNSSBlockFactory>();
|
||||
auto factory = std::make_unique<GNSSBlockFactory>();
|
||||
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration.get());
|
||||
std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_);
|
||||
auto pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_);
|
||||
EXPECT_EQ(nullptr, pvt);
|
||||
}
|
||||
|
||||
@@ -53,5 +53,9 @@ TEST(FileSignalSource, InstantiateFileNotExists)
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.repeat", "false");
|
||||
|
||||
EXPECT_THROW({ auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 0, 1, queue.get()); }, std::exception);
|
||||
// the file existence test was moved from the ctor to the connect() call. The argument to
|
||||
// connect doesn't matter, since the exception should be thrown sooner than any connections
|
||||
auto top = gr::make_top_block("GNSSUnitTest");
|
||||
auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 0, 1, queue.get());
|
||||
EXPECT_THROW({ uptr->connect(top); }, std::exception);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user