From 2b5d6e45f57c3817da5d4eee06ab2dcfaa63f05e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 17 Feb 2013 09:54:41 +0000 Subject: [PATCH] Adapting tests to the new GNU Radio 3.7 API. The component gr-analog, required by some tests, is now found by CMake. Some code cleaning git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@340 64b25241-fba3-4117-9849-534c7e92360d --- src/tests/CMakeLists.txt | 14 +- .../configuration/file_configuration_test.cc | 40 +- .../in_memory_configuration_test.cc | 160 +++--- .../control_thread/control_thread_test.cc | 217 +++++---- .../flowgraph/file_output_filter_test.cc | 44 -- .../flowgraph/file_signal_source_test.cc | 87 ---- .../flowgraph/gnss_block_factory_test.cc | 179 ------- src/tests/flowgraph/gnss_flowgraph_test.cc | 53 +- src/tests/gnss_block/fir_filter_test.cc | 123 ++--- .../galileo_e1_dll_pll_veml_tracking_test.cc | 193 ++++---- ...e1_pcps_ambiguous_acquisition_gsoc_test.cc | 221 ++++----- ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 5 +- .../gnss_block/gnss_block_factory_test.cc | 454 +++++++++--------- .../gps_l1_ca_pcps_acquisition_test.cc | 255 +++++----- .../direct_resampler_conditioner_cc_test.cc | 55 +-- .../gnuradio_block/gnss_sdr_valve_test.cc | 6 +- src/tests/test_main.cc | 27 +- 17 files changed, 957 insertions(+), 1176 deletions(-) delete mode 100644 src/tests/flowgraph/file_output_filter_test.cc delete mode 100644 src/tests/flowgraph/file_signal_source_test.cc delete mode 100644 src/tests/flowgraph/gnss_block_factory_test.cc diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 7ee8f8943..51c6fcf5d 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -67,7 +67,11 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs ${CMAKE_SOURCE_DIR}/src/algorithms/libs ${CMAKE_SOURCE_DIR}/src/algorithms/resampler/gnuradio_blocks + ${CMAKE_SOURCE_DIR}/src/algorithms/channel/adapters + ${CMAKE_SOURCE_DIR}/src/algorithms/channel/libs ${CMAKE_SOURCE_DIR}/src/algorithms/tracking/libs + ${CMAKE_SOURCE_DIR}/src/algorithms/tracking/adapters + ${CMAKE_SOURCE_DIR}/src/algorithms/tracking/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/input_filter/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/adapters @@ -80,9 +84,17 @@ include_directories( ${Boost_INCLUDE_DIRS} ) +find_library( + GR_ANALOG_LIBRARIES + NAMES gnuradio-analog + PATHS /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 +) add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc) -target_link_libraries(run_tests ${Boost_LIBRARIES} ${GFLAGS_LIBS} ${GLOG_LIBRARIES} ${GTEST_LIBRARIES} gnss_sp_libs gnss_rx) +target_link_libraries(run_tests ${Boost_LIBRARIES} ${GFLAGS_LIBS} ${GLOG_LIBRARIES} ${GTEST_LIBRARIES} ${GR_ANALOG_LIBRARIES} gnss_sp_libs gnss_rx) install(TARGETS run_tests DESTINATION ${CMAKE_SOURCE_DIR}/install) diff --git a/src/tests/configuration/file_configuration_test.cc b/src/tests/configuration/file_configuration_test.cc index 15ccb7c6d..dbf8d75d0 100644 --- a/src/tests/configuration/file_configuration_test.cc +++ b/src/tests/configuration/file_configuration_test.cc @@ -1,12 +1,12 @@ /*! * \file file_configuration_test.cc - * \brief This file implements tests for the ControlMessageFactory. + * \brief This file implements tests for the file_configuration. * \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es * * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -40,18 +40,18 @@ TEST(File_Configuration_Test, OverridedProperties) { - ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt"); - std::string default_value = "default_value"; - std::string value = configuration->property("NotThere", default_value); + ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt"); + std::string default_value = "default_value"; + std::string value = configuration->property("NotThere", default_value); - EXPECT_STREQ("default_value", value.c_str()); + EXPECT_STREQ("default_value", value.c_str()); - configuration->set_property("NotThere", "Yes!"); - value = configuration->property("NotThere", default_value); + configuration->set_property("NotThere", "Yes!"); + value = configuration->property("NotThere", default_value); - EXPECT_STREQ("Yes!", value.c_str()); + EXPECT_STREQ("Yes!", value.c_str()); - delete configuration; + delete configuration; } @@ -59,13 +59,13 @@ TEST(File_Configuration_Test, OverridedProperties) TEST(File_Configuration_Test, LoadFromNonExistentFile) { - ConfigurationInterface *configuration = new FileConfiguration("./i_dont_exist.conf"); - std::string default_value = "default_value"; - std::string value = configuration->property("whatever.whatever", default_value); + ConfigurationInterface *configuration = new FileConfiguration("./i_dont_exist.conf"); + std::string default_value = "default_value"; + std::string value = configuration->property("whatever.whatever", default_value); - EXPECT_STREQ("default_value", value.c_str()); + EXPECT_STREQ("default_value", value.c_str()); - delete configuration; + delete configuration; } @@ -73,11 +73,11 @@ TEST(File_Configuration_Test, LoadFromNonExistentFile) TEST(File_Configuration_Test, PropertyDoesNotExist) { - ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt"); - std::string default_value = "default_value"; - std::string value = configuration->property("whatever.whatever", default_value); + ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt"); + std::string default_value = "default_value"; + std::string value = configuration->property("whatever.whatever", default_value); - EXPECT_STREQ("default_value", value.c_str()); + EXPECT_STREQ("default_value", value.c_str()); - delete configuration; + delete configuration; } diff --git a/src/tests/configuration/in_memory_configuration_test.cc b/src/tests/configuration/in_memory_configuration_test.cc index 6aed5934f..1ccca74ae 100644 --- a/src/tests/configuration/in_memory_configuration_test.cc +++ b/src/tests/configuration/in_memory_configuration_test.cc @@ -1,115 +1,143 @@ - -/** - * Copyright notice - */ - -/** - * Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com - */ - -/** - * This class implements a Unit Test for the class InMemoryConfiguration. +/*! + * \file in_memory_configuration_test.cc + * \brief This file implements tests for the in_memory_configuration. + * \author Carles Fernandez-Prades, 2013. cfernandez(at)cttc.es * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- */ #include - #include "configuration_interface.h" #include "in_memory_configuration.h" -TEST(InMemoryConfiguration, IsPresent) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); +TEST(InMemoryConfiguration, IsPresent) +{ + InMemoryConfiguration *configuration = new InMemoryConfiguration(); - EXPECT_FALSE(configuration->is_present("NotThere")); + EXPECT_FALSE(configuration->is_present("NotThere")); - configuration->set_property("NotThere", "Yes!"); - EXPECT_TRUE(configuration->is_present("NotThere")); + configuration->set_property("NotThere", "Yes!"); + EXPECT_TRUE(configuration->is_present("NotThere")); - delete configuration; + delete configuration; } -TEST(InMemoryConfiguration, StoreAndRetrieve) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); +TEST(InMemoryConfiguration, StoreAndRetrieve) +{ + ConfigurationInterface *configuration = new InMemoryConfiguration(); - ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "value"); - std::string default_value = "default_value"; - std::string value = configuration->property("Foo.property1", default_value); + ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "value"); + std::string default_value = "default_value"; + std::string value = configuration->property("Foo.property1", default_value); - EXPECT_STREQ("value", value.c_str()); + EXPECT_STREQ("value", value.c_str()); - delete configuration; + delete configuration; } -TEST(InMemoryConfiguration, NoStoringAndRetrieve) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); - std::string default_value = "default_value"; - std::string value = configuration->property("Foo.property1", default_value); +TEST(InMemoryConfiguration, NoStoringAndRetrieve) +{ + ConfigurationInterface *configuration = new InMemoryConfiguration(); + std::string default_value = "default_value"; + std::string value = configuration->property("Foo.property1", default_value); - EXPECT_STREQ("default_value", value.c_str()); + EXPECT_STREQ("default_value", value.c_str()); - delete configuration; + delete configuration; } -TEST(InMemoryConfiguration, RetrieveBool) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); +TEST(InMemoryConfiguration, RetrieveBool) +{ + ConfigurationInterface *configuration = new InMemoryConfiguration(); - ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "true"); - bool value = configuration->property("Foo.property1", false); + ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "true"); + bool value = configuration->property("Foo.property1", false); + bool expectedtrue = true; + EXPECT_EQ(expectedtrue, value); - EXPECT_EQ(true, value); - - delete configuration; + delete configuration; } -TEST(InMemoryConfiguration, RetrieveBoolFail) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); +TEST(InMemoryConfiguration, RetrieveBoolFail) +{ + ConfigurationInterface *configuration = new InMemoryConfiguration(); - ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "tru"); - bool value = configuration->property("Foo.property1", false); + ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "tru"); + bool value = configuration->property("Foo.property1", false); - EXPECT_EQ(false, value); + bool expectedfalse = false; + EXPECT_EQ(expectedfalse, value); - delete configuration; + delete configuration; } -TEST(InMemoryConfiguration, RetrieveBoolNoDefine) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); +TEST(InMemoryConfiguration, RetrieveBoolNoDefine) +{ + ConfigurationInterface *configuration = new InMemoryConfiguration(); - bool value = configuration->property("Foo.property1", false); + bool value = configuration->property("Foo.property1", false); - EXPECT_EQ(false, value); + bool expectedfalse = false; + EXPECT_EQ(expectedfalse, value); - delete configuration; + delete configuration; } -TEST(InMemoryConfiguration, RetrieveSizeT) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); +TEST(InMemoryConfiguration, RetrieveSizeT) +{ + ConfigurationInterface *configuration = new InMemoryConfiguration(); - ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "8"); - unsigned int value = configuration->property("Foo.property1", 4); + ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "8"); + unsigned int value = configuration->property("Foo.property1", 4); - EXPECT_EQ(8, value); + unsigned int expected8 = 8; + EXPECT_EQ(expected8, value); - delete configuration; + delete configuration; } -TEST(InMemoryConfiguration, RetrieveSizeTFail) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); +TEST(InMemoryConfiguration, RetrieveSizeTFail) +{ + ConfigurationInterface *configuration = new InMemoryConfiguration(); - ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "true"); - unsigned int value = configuration->property("Foo.property1", 4); + ((InMemoryConfiguration*)configuration)->set_property("Foo.property1", "true"); + unsigned int value = configuration->property("Foo.property1", 4); - EXPECT_EQ(4, value); + unsigned int expected4 = 4; + EXPECT_EQ(expected4, value); - delete configuration; + delete configuration; } TEST(InMemoryConfiguration, RetrieveSizeTNoDefine) { - ConfigurationInterface *configuration = new InMemoryConfiguration(); + ConfigurationInterface *configuration = new InMemoryConfiguration(); - unsigned int value = configuration->property("Foo.property1", 4); + unsigned int value = configuration->property("Foo.property1", 4); + unsigned int expected4 = 4; + EXPECT_EQ(expected4, value); - EXPECT_EQ(4, value); - - delete configuration; + delete configuration; } diff --git a/src/tests/control_thread/control_thread_test.cc b/src/tests/control_thread/control_thread_test.cc index 99c2960df..e37fea655 100644 --- a/src/tests/control_thread/control_thread_test.cc +++ b/src/tests/control_thread/control_thread_test.cc @@ -1,15 +1,33 @@ - -/** - * Copyright notice - */ - -/** - * Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com - */ - -/** - * This class implements a Unit Tests for the class ControlThread. +/*! + * \file control_thread_test.cc + * \brief This file implements tests for the ControlThread. + * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com + * Carles Fernandez-Prades, 2013. cfernandez(at)cttc.es * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- */ #include @@ -18,109 +36,116 @@ #include "in_memory_configuration.h" -TEST(Control_Thread_Test, InstantiateRunControlMessages) { +TEST(Control_Thread_Test, InstantiateRunControlMessages) +{ + InMemoryConfiguration *config = new InMemoryConfiguration(); - InMemoryConfiguration *config = new InMemoryConfiguration(); - config->set_property("SignalSource.implementation", "File_Signal_Source"); - config->set_property("SignalSource.filename", "/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat"); - config->set_property("SignalSource.item_type", "gr_complex"); - config->set_property("SignalConditioner.implementation", "Pass_Through"); - config->set_property("SignalConditioner.item_type", "gr_complex"); - config->set_property("Channels.count", "12"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); - config->set_property("Tracking.item_type", "gr_complex"); - config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("Navigation.item_type", "gr_complex"); - config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables"); - config->set_property("Pseudorange.item_type", "gr_complex"); - config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); - config->set_property("PVT.item_type", "gr_complex"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); + config->set_property("SignalSource.implementation", "File_Signal_Source"); + config->set_property("SignalSource.filename", "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat"); + config->set_property("SignalSource.item_type", "gr_complex"); + config->set_property("SignalSource.sampling_frequency", "4000000"); + config->set_property("SignalSource.repeat", "true"); + config->set_property("SignalConditioner.implementation", "Pass_Through"); + config->set_property("SignalConditioner.item_type", "gr_complex"); + config->set_property("Channels.count", "12"); + config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition.item_type", "gr_complex"); + config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); + config->set_property("Tracking.item_type", "gr_complex"); + config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder"); + config->set_property("Navigation.item_type", "gr_complex"); + config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables"); + config->set_property("Pseudorange.item_type", "gr_complex"); + config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); + config->set_property("PVT.item_type", "gr_complex"); + config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); + config->set_property("OutputFilter.item_type", "gr_complex"); - ControlThread *control_thread = new ControlThread(config); + ControlThread *control_thread = new ControlThread(config); - gr_msg_queue_sptr control_queue = gr_make_msg_queue(0); - ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); + gr_msg_queue_sptr control_queue = gr_make_msg_queue(0); + ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); - control_queue->handle(control_msg_factory->GetQueueMessage(0,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(1,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(2,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(3,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(4,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(5,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(6,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(7,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(8,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(9,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(10,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(11,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(12,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(13,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(14,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(15,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(16,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(200,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(0,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(1,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(2,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(3,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(4,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(5,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(6,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(7,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(8,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(9,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(10,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(11,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(12,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(13,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(14,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(15,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(16,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(200,0)); - control_thread->set_control_queue(control_queue); + control_thread->set_control_queue(control_queue); - control_thread->run(); + control_thread->run(); - EXPECT_EQ(18, control_thread->processed_control_messages()); - EXPECT_EQ(1, control_thread->applied_actions()); + unsigned int expected18 = 18; + unsigned int expected1 = 1; + EXPECT_EQ(expected18, control_thread->processed_control_messages()); + EXPECT_EQ(expected1, control_thread->applied_actions()); - delete config; - delete control_thread; - delete control_msg_factory; + delete config; + delete control_thread; + delete control_msg_factory; } -TEST(Control_Thread_Test, InstantiateRunControlMessages2) { +TEST(Control_Thread_Test, InstantiateRunControlMessages2) +{ + InMemoryConfiguration *config = new InMemoryConfiguration(); + config->set_property("SignalSource.implementation", "File_Signal_Source"); + config->set_property("SignalSource.filename", "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat"); + config->set_property("SignalSource.item_type", "gr_complex"); + config->set_property("SignalSource.sampling_frequency", "4000000"); + config->set_property("SignalConditioner.implementation", "Pass_Through"); + config->set_property("SignalConditioner.item_type", "gr_complex"); + config->set_property("Channels.count", "12"); + config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition.item_type", "gr_complex"); + config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); + config->set_property("Tracking.item_type", "gr_complex"); + config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder"); + config->set_property("Navigation.item_type", "gr_complex"); + config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables"); + config->set_property("Pseudorange.item_type", "gr_complex"); + config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); + config->set_property("PVT.item_type", "gr_complex"); + config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); + config->set_property("OutputFilter.item_type", "gr_complex"); - InMemoryConfiguration *config = new InMemoryConfiguration(); - config->set_property("SignalSource.implementation", "File_Signal_Source"); - config->set_property("SignalSource.filename", "/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat"); - config->set_property("SignalSource.item_type", "gr_complex"); - config->set_property("SignalConditioner.implementation", "Pass_Through"); - config->set_property("SignalConditioner.item_type", "gr_complex"); - config->set_property("Channels.count", "12"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); - config->set_property("Tracking.item_type", "gr_complex"); - config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("Navigation.item_type", "gr_complex"); - config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables"); - config->set_property("Pseudorange.item_type", "gr_complex"); - config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); - config->set_property("PVT.item_type", "gr_complex"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); + ControlThread *control_thread = new ControlThread(config); - ControlThread *control_thread = new ControlThread(config); + gr_msg_queue_sptr control_queue = gr_make_msg_queue(0); + ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); - gr_msg_queue_sptr control_queue = gr_make_msg_queue(0); - ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); + control_queue->handle(control_msg_factory->GetQueueMessage(0,0)); + control_queue->handle(control_msg_factory->GetQueueMessage(0,2)); + control_queue->handle(control_msg_factory->GetQueueMessage(0,1)); + control_queue->handle(control_msg_factory->GetQueueMessage(0,3)); + control_queue->handle(control_msg_factory->GetQueueMessage(200,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(0,0)); - control_queue->handle(control_msg_factory->GetQueueMessage(0,2)); - control_queue->handle(control_msg_factory->GetQueueMessage(0,1)); - control_queue->handle(control_msg_factory->GetQueueMessage(0,3)); - control_queue->handle(control_msg_factory->GetQueueMessage(200,0)); + control_thread->set_control_queue(control_queue); - control_thread->set_control_queue(control_queue); + control_thread->run(); + unsigned int expected5 = 5; + unsigned int expected1 = 1; + EXPECT_EQ(expected5, control_thread->processed_control_messages()); + EXPECT_EQ(expected1, control_thread->applied_actions()); - control_thread->run(); - - EXPECT_EQ(5, control_thread->processed_control_messages()); - EXPECT_EQ(1, control_thread->applied_actions()); - - delete config; - delete control_thread; - delete control_msg_factory; + delete config; + delete control_thread; + delete control_msg_factory; } diff --git a/src/tests/flowgraph/file_output_filter_test.cc b/src/tests/flowgraph/file_output_filter_test.cc deleted file mode 100644 index 64a63b0d7..000000000 --- a/src/tests/flowgraph/file_output_filter_test.cc +++ /dev/null @@ -1,44 +0,0 @@ -/*! - * \file file_output_filter_test.cc - * \brief This file implements tests for the FileSignalSourceClass - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es - * - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) - * - * GNSS-SDR is a software defined Global Navigation - * Satellite Systems receiver - * - * This file is part of GNSS-SDR. - * - * GNSS-SDR is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * GNSS-SDR is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNSS-SDR. If not, see . - * - * ------------------------------------------------------------------------- - */ - -#include -#include "file_output_filter.h" -#include "in_memory_configuration.h" - -TEST(FileOutputFilterTest, Instantiate) -{ - InMemoryConfiguration* config = new InMemoryConfiguration(); - config->set_property("Test.filename", "../data/output.dat"); - config->set_property("Test.item_type", "float"); - FileOutputFilter *output_filter = new FileOutputFilter(config, "Test", 1, 0); - delete output_filter; -} diff --git a/src/tests/flowgraph/file_signal_source_test.cc b/src/tests/flowgraph/file_signal_source_test.cc deleted file mode 100644 index dee6d8634..000000000 --- a/src/tests/flowgraph/file_signal_source_test.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * \file file_signal_source_test.cc - * \brief This file implements tests for the FileSignalSourceClass - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es - * - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) - * - * GNSS-SDR is a software defined Global Navigation - * Satellite Systems receiver - * - * This file is part of GNSS-SDR. - * - * GNSS-SDR is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * GNSS-SDR is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNSS-SDR. If not, see . - * - * ------------------------------------------------------------------------- - */ - - -#include -#include -#include -#include -#include -#include -#include "file_signal_source.h" -#include "in_memory_configuration.h" - - - -TEST(File_Signal_Source_Test, Instantiate) -{ - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - InMemoryConfiguration* config = new InMemoryConfiguration(); - - config->set_property("Test.samples", "0"); - config->set_property("Test.sampling_frequency", "0"); - - config->set_property("Test.filename", "/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat"); - - config->set_property("Test.item_type", "gr_complex"); - config->set_property("Test.repeat", "false"); - - try - { - FileSignalSource *signal_source = new FileSignalSource(config, "Test", 1, 1, queue); - } - catch(std::exception& e){} - EXPECT_STREQ("/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat", signal_source->filename().c_str()); - EXPECT_STREQ("gr_complex", signal_source->item_type().c_str()); - EXPECT_TRUE(signal_source->repeat() == false); - - delete signal_source; -} - - - -TEST(File_Signal_Source_Test, InstantiateFileNotExists) -{ - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - InMemoryConfiguration* config = new InMemoryConfiguration(); - - config->set_property("Test.samples", "0"); - config->set_property("Test.sampling_frequency", "0"); - config->set_property("Test.filename", "./signal_samples/i_dont_exist.dat"); - - config->set_property("Test.item_type", "gr_complex"); - config->set_property("Test.repeat", "false"); - - EXPECT_THROW(new FileSignalSource(config, "Test", 1, 1, queue), std::exception); -} diff --git a/src/tests/flowgraph/gnss_block_factory_test.cc b/src/tests/flowgraph/gnss_block_factory_test.cc deleted file mode 100644 index 52d98e48b..000000000 --- a/src/tests/flowgraph/gnss_block_factory_test.cc +++ /dev/null @@ -1,179 +0,0 @@ - -/** - * Copyright notice - */ - -/** - * Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com - */ - -/** - * This class implements a Unit Test for the class GNSSBlockFactory. - * - */ -#include -#include -#include -#include "in_memory_configuration.h" -#include "gnss_block_interface.h" -#include "gnss_block_factory.h" - -TEST(GNSSBlockFactory, InstantiateChannels) -{ - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("Channels.count", "2"); - configuration->set_property("Channel1.implementation", "Pass_Through"); - configuration->set_property("Channel1.item_type", "gr_complex"); - configuration->set_property("Channel1.vector_size", "1"); - configuration->set_property("Channel2.implementation", "Pass_Through"); - configuration->set_property("Channel2.item_type", "gr_complex"); - configuration->set_property("Channel2.vector_size", "1"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - std::vector* channels = factory->GetChannels(configuration, queue); - - EXPECT_EQ(2, channels->size()); - - delete configuration; - delete factory; - for(unsigned int i=0 ; isize() ; i++) - delete channels->at(i); - channels->clear(); - delete channels; -} - -TEST(GNSSBlockFactory, InstantiateSignalSource) -{ - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("SignalSource.implementation", "FileSignalSource"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); - - EXPECT_STREQ("SignalSource", signal_source->role().c_str()); - - delete configuration; - delete factory; - delete signal_source; -} - -TEST(GNSSBlockFactory, InstantiateWrongSignalSource) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("SignalSource.implementation", "Pepito"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); - - EXPECT_EQ(NULL, signal_source); - - delete configuration; - delete factory; -} - -TEST(GNSSBlockFactory, InstantiateSignalConditioner) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("SignalConditioner.implementation", "Pass_Through"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue); - - EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str()); - - delete configuration; - delete factory; - delete signal_conditioner; -} - -TEST(GNSSBlockFactory, InstantiateWrongSignalConditioner) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("SignalConditioner.implementation", "Pepito"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue); - - EXPECT_EQ(NULL, signal_conditioner); - - delete configuration; - delete factory; -} - -TEST(GNSSBlockFactory, InstantiatePVT) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("PVT.implementation", "Pass_Through"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *pvt = factory->GetPVT(configuration, queue); - - EXPECT_STREQ("PVT", pvt->role().c_str()); - - delete configuration; - delete factory; - delete pvt; -} - -TEST(GNSSBlockFactory, InstantiateWrongPVT) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("PVT.implementation", "Pepito"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *pvt = factory->GetPVT(configuration, queue); - - EXPECT_EQ(NULL, pvt); - - delete configuration; - delete factory; -} - -TEST(GNSSBlockFactory, InstantiateOutputFilter) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("OutputFilter.implementation", "NullSinkOutputFilter"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); - - EXPECT_STREQ("OutputFilter", output_filter->role().c_str()); - - delete configuration; - delete factory; - delete output_filter; -} - -TEST(GNSSBlockFactory, InstantiateWrongOutputFilter) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - - configuration->set_property("OutputFilter.implementation", "Pepito"); - - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); - - EXPECT_EQ(NULL, output_filter); - - delete configuration; - delete factory; -} diff --git a/src/tests/flowgraph/gnss_flowgraph_test.cc b/src/tests/flowgraph/gnss_flowgraph_test.cc index 8ea716819..9d9904391 100644 --- a/src/tests/flowgraph/gnss_flowgraph_test.cc +++ b/src/tests/flowgraph/gnss_flowgraph_test.cc @@ -1,15 +1,33 @@ - -/** - * Copyright notice - */ - -/** - * Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com - */ - -/** - * This class implements a Unit Tests for the class GNSSFlowgraph. +/*! + * \file gnss_flowgraph_test.cc + * \brief This file implements tests for a flowgraph + * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com + * Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- */ #include @@ -31,19 +49,22 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStop) { InMemoryConfiguration* config = new InMemoryConfiguration(); + config->set_property("SignalSource.sampling_frequency", "4000000"); config->set_property("SignalSource.implementation", "File_Signal_Source"); + config->set_property("SignalSource.item_type", "gr_complex"); + config->set_property("SignalSource.filename", "../src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat"); config->set_property("SignalConditioner.implementation", "Pass_Through"); config->set_property("Channels.count", "2"); config->set_property("Channels.acquisition.implementation", "Pass_Through"); config->set_property("Channels.tracking.implementation", "Pass_Through"); config->set_property("Channels.observables.implementation", "Pass_Through"); - config->set_property("Observables.implementation", "GpsL1CaObservables"); + config->set_property("Observables.implementation", "GPS_L1_CA_Observables"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); - config->set_property("OutputFilter.implementation", "NullSinkOutputFilter"); + config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); GNSSFlowgraph* flowgraph = new GNSSFlowgraph(config, gr_make_msg_queue(0)); - EXPECT_STREQ("FileSignalSource", flowgraph->signal_source()->implementation().c_str()); + EXPECT_STREQ("File_Signal_Source", flowgraph->signal_source()->implementation().c_str()); EXPECT_STREQ("Pass_Through", flowgraph->signal_conditioner()->implementation().c_str()); EXPECT_STREQ("Channel", flowgraph->channel(0)->implementation().c_str()); EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(0))->acquisition()->implementation().c_str()); @@ -51,9 +72,9 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStop) EXPECT_STREQ("Channel", flowgraph->channel(1)->implementation().c_str()); EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(1))->acquisition()->implementation().c_str()); EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(1))->tracking()->implementation().c_str()); - EXPECT_STREQ("GpsL1CaObservables", flowgraph->observables()->implementation().c_str()); + EXPECT_STREQ("GPS_L1_CA_Observables", flowgraph->observables()->implementation().c_str()); EXPECT_STREQ("GPS_L1_CA_PVT", flowgraph->pvt()->implementation().c_str()); - EXPECT_STREQ("NullSinkOutputFilter", flowgraph->output_filter()->implementation().c_str()); + EXPECT_STREQ("Null_Sink_Output_Filter", flowgraph->output_filter()->implementation().c_str()); EXPECT_NO_THROW(flowgraph->connect()); EXPECT_TRUE(flowgraph->connected()); diff --git a/src/tests/gnss_block/fir_filter_test.cc b/src/tests/gnss_block/fir_filter_test.cc index 46873fd62..ea3454b0e 100644 --- a/src/tests/gnss_block/fir_filter_test.cc +++ b/src/tests/gnss_block/fir_filter_test.cc @@ -33,7 +33,8 @@ #include #include #include -#include +#include +#include #include #include #include "gnss_block_factory.h" @@ -47,87 +48,87 @@ DEFINE_string(filter_test_output_filename, "../src/tests/data/fir_filter_test_ou class Fir_Filter_Test: public ::testing::Test { protected: - Fir_Filter_Test() - { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Fir filter test"); - config = new InMemoryConfiguration(); - item_size = sizeof(gr_complex); - - } - ~Fir_Filter_Test() - { - delete config; - } - void init(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; - InMemoryConfiguration* config; - size_t item_size; + Fir_Filter_Test() + { + queue = gr_make_msg_queue(0); + top_block = gr_make_top_block("Fir filter test"); + config = new InMemoryConfiguration(); + item_size = sizeof(gr_complex); + } + ~Fir_Filter_Test() + { + delete config; + } + void init(); + gr_msg_queue_sptr queue; + gr_top_block_sptr top_block; + InMemoryConfiguration* config; + size_t item_size; }; void Fir_Filter_Test::init() { - config->set_property("InputFilter.number_of_taps", "4"); - config->set_property("InputFilter.number_of_bands", "2"); + config->set_property("InputFilter.number_of_taps", "4"); + config->set_property("InputFilter.number_of_bands", "2"); - config->set_property("InputFilter.band1_begin", "0.0"); - config->set_property("InputFilter.band1_end", "0.45"); - config->set_property("InputFilter.band2_begin", "0.55"); - config->set_property("InputFilter.band2_end", "1.0"); + config->set_property("InputFilter.band1_begin", "0.0"); + config->set_property("InputFilter.band1_end", "0.45"); + config->set_property("InputFilter.band2_begin", "0.55"); + config->set_property("InputFilter.band2_end", "1.0"); - config->set_property("InputFilter.ampl1_begin", "1.0"); - config->set_property("InputFilter.ampl1_end", "1.0"); - config->set_property("InputFilter.ampl2_begin", "0.0"); - config->set_property("InputFilter.ampl2_end", "0.0"); + config->set_property("InputFilter.ampl1_begin", "1.0"); + config->set_property("InputFilter.ampl1_end", "1.0"); + config->set_property("InputFilter.ampl2_begin", "0.0"); + config->set_property("InputFilter.ampl2_end", "0.0"); - config->set_property("InputFilter.band1_error", "1.0"); - config->set_property("InputFilter.band2_error", "1.0"); + config->set_property("InputFilter.band1_error", "1.0"); + config->set_property("InputFilter.band2_error", "1.0"); - config->set_property("InputFilter.filter_type", "bandpass"); - config->set_property("InputFilter.grid_density", "16"); - //config->set_property("InputFilter.dump", "true"); + config->set_property("InputFilter.filter_type", "bandpass"); + config->set_property("InputFilter.grid_density", "16"); + //config->set_property("InputFilter.dump", "true"); } TEST_F(Fir_Filter_Test, Instantiate) { - init(); - FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue); - delete filter; + init(); + FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue); + delete filter; } + TEST_F(Fir_Filter_Test, ConnectAndRun) { - int fs_in = 8000000; - int nsamples = 10000000; - struct timeval tv; - long long int begin = 0; - long long int end = 0; + int fs_in = 8000000; + int nsamples = 10000000; + struct timeval tv; + long long int begin = 0; + long long int end = 0; - init(); + init(); - FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue); + FirFilter *filter = new FirFilter(config, "InputFilter", 1, 1, queue); - ASSERT_NO_THROW( { - filter->connect(top_block); - gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, gr_complex(0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); - gr_block_sptr null_sink = gr_make_null_sink(item_size); + ASSERT_NO_THROW( { + filter->connect(top_block); + gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + gr_block_sptr null_sink = gr_make_null_sink(item_size); - top_block->connect(source, 0, valve, 0); - top_block->connect(valve, 0, filter->get_left_block(), 0); - top_block->connect(filter->get_right_block(), 0, null_sink, 0); - }) << "Failure connecting the top_block."<< std::endl; + top_block->connect(source, 0, valve, 0); + top_block->connect(valve, 0, filter->get_left_block(), 0); + top_block->connect(filter->get_right_block(), 0, null_sink, 0); + }) << "Failure connecting the top_block."<< std::endl; - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; - std::cout << "Filtered " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; + std::cout << "Filtered " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; - delete filter; + delete filter; } diff --git a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc index 5ebe0bcd2..5837faf3a 100644 --- a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc @@ -37,7 +37,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -52,55 +53,55 @@ class GalileoE1DllPllVemlTrackingInternalTest: public ::testing::Test { protected: - GalileoE1DllPllVemlTrackingInternalTest() - { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Tracking test"); - factory = new GNSSBlockFactory(); - config = new InMemoryConfiguration(); - item_size = sizeof(gr_complex); - stop = false; - message = 0; - } + GalileoE1DllPllVemlTrackingInternalTest() + { + queue = gr_make_msg_queue(0); + top_block = gr_make_top_block("Tracking test"); + factory = new GNSSBlockFactory(); + config = new InMemoryConfiguration(); + item_size = sizeof(gr_complex); + stop = false; + message = 0; + } - ~GalileoE1DllPllVemlTrackingInternalTest() - { - delete factory; - delete config; - } + ~GalileoE1DllPllVemlTrackingInternalTest() + { + delete factory; + delete config; + } - void init(); + void init(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; - GNSSBlockFactory* factory; - InMemoryConfiguration* config; - Gnss_Synchro gnss_synchro; - size_t item_size; - concurrent_queue channel_internal_queue; - bool stop; - int message; - boost::thread ch_thread; + gr_msg_queue_sptr queue; + gr_top_block_sptr top_block; + GNSSBlockFactory* factory; + InMemoryConfiguration* config; + Gnss_Synchro gnss_synchro; + size_t item_size; + concurrent_queue channel_internal_queue; + bool stop; + int message; + boost::thread ch_thread; }; void GalileoE1DllPllVemlTrackingInternalTest::init() { - gnss_synchro.Channel_ID=0; - gnss_synchro.System = 'E'; - std::string signal = "1B"; - signal.copy(gnss_synchro.Signal,2,0); - gnss_synchro.PRN=11; + gnss_synchro.Channel_ID=0; + gnss_synchro.System = 'E'; + std::string signal = "1B"; + signal.copy(gnss_synchro.Signal,2,0); + gnss_synchro.PRN=11; - config->set_property("GNSS-SDR.internal_fs_hz", "8000000"); - config->set_property("Tracking.item_type", "gr_complex"); - config->set_property("Tracking.dump", "true"); - config->set_property("Tracking.dump_filename", "../data/veml_tracking_ch_"); - config->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_Tracking"); - config->set_property("Tracking.early_late_space_chips", "0.15"); - config->set_property("Tracking.very_early_late_space_chips", "0.6"); - config->set_property("Tracking.pll_bw_hz", "30.0"); - config->set_property("Tracking.dll_bw_hz", "2.0"); + config->set_property("GNSS-SDR.internal_fs_hz", "8000000"); + config->set_property("Tracking.item_type", "gr_complex"); + config->set_property("Tracking.dump", "true"); + config->set_property("Tracking.dump_filename", "../data/veml_tracking_ch_"); + config->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_Tracking"); + config->set_property("Tracking.early_late_space_chips", "0.15"); + config->set_property("Tracking.very_early_late_space_chips", "0.6"); + config->set_property("Tracking.pll_bw_hz", "30.0"); + config->set_property("Tracking.dll_bw_hz", "2.0"); } @@ -108,10 +109,10 @@ void GalileoE1DllPllVemlTrackingInternalTest::init() TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate) { - init(); - GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue); - EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str()); - delete tracking; + init(); + GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue); + EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str()); + delete tracking; } //TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) @@ -127,8 +128,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate) // // ASSERT_NO_THROW( { // tracking->connect(top_block); -// -// gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, gr_complex(0)); +// gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); // gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); // gr_null_sink_sptr sink = gr_make_null_sink(sizeof(Gnss_Synchro)); // top_block->connect(source, 0, valve, 0); @@ -152,66 +152,63 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate) TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) { - struct timeval tv; - long long int begin; - long long int end; - // int num_samples = 40000000; // 4 Msps - // unsigned int skiphead_sps = 24000000; // 4 Msps - int num_samples = 80000000; // 8 Msps - unsigned int skiphead_sps = 8000000; // 8 Msps - init(); - GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue); + struct timeval tv; + long long int begin = 0; + long long int end = 0; + // int num_samples = 40000000; // 4 Msps + // unsigned int skiphead_sps = 24000000; // 4 Msps + int num_samples = 80000000; // 8 Msps + unsigned int skiphead_sps = 8000000; // 8 Msps + init(); + GalileoE1DllPllVemlTracking *tracking = new GalileoE1DllPllVemlTracking(config, "Tracking", 1, 1, queue); - // gnss_synchro.Acq_delay_samples=1753; // 4 Msps - // gnss_synchro.Acq_doppler_hz=-9500; // 4 Msps - gnss_synchro.Acq_delay_samples=17256; // 8 Msps - gnss_synchro.Acq_doppler_hz=-8750; // 8 Msps - gnss_synchro.Acq_samplestamp_samples=0; + // gnss_synchro.Acq_delay_samples=1753; // 4 Msps + // gnss_synchro.Acq_doppler_hz=-9500; // 4 Msps + gnss_synchro.Acq_delay_samples = 17256; // 8 Msps + gnss_synchro.Acq_doppler_hz = -8750; // 8 Msps + gnss_synchro.Acq_samplestamp_samples = 0; - ASSERT_NO_THROW( { - tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel."<< std::endl; + ASSERT_NO_THROW( { + tracking->set_channel(gnss_synchro.Channel_ID); + }) << "Failure setting channel."<< std::endl; - ASSERT_NO_THROW( { - tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + ASSERT_NO_THROW( { + tracking->set_gnss_synchro(&gnss_synchro); + }) << "Failure setting gnss_synchro."<< std::endl; - ASSERT_NO_THROW( { - tracking->set_channel_queue(&channel_internal_queue); - }) << "Failure setting channel_internal_queue."<< std::endl; + ASSERT_NO_THROW( { + tracking->set_channel_queue(&channel_internal_queue); + }) << "Failure setting channel_internal_queue."<< std::endl; - ASSERT_NO_THROW( { - tracking->connect(top_block); - }) << "Failure connecting tracking to the top_block."<< std::endl; + ASSERT_NO_THROW( { + tracking->connect(top_block); + }) << "Failure connecting tracking to the top_block."<< std::endl; - ASSERT_NO_THROW( { - std::string file = "/media/DATA/Proyectos/Signals/cttc_2012_07_26/cp_cttc_2012_07_26_n6_8Msps.dat"; - // std::string file = "/media/DATA/Proyectos/Signals/cttc_2012_07_26/cp_cttc_2012_07_26_n4_4Msps.dat"; - // std::string file = "/media/DATA/Proyectos/Signals/prueba.dat"; - // std::string file = "../data/resampler.dat"; - const char * file_name = file.c_str(); - gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); - gr_skiphead_sptr skip_head = gr_make_skiphead(sizeof(gr_complex), skiphead_sps); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue); - gr_null_sink_sptr sink = gr_make_null_sink(sizeof(Gnss_Synchro)); - top_block->connect(file_source, 0, skip_head, 0); - top_block->connect(skip_head, 0, valve, 0); - top_block->connect(valve, 0, tracking->get_left_block(), 0); - top_block->connect(tracking->get_right_block(), 0, sink, 0); - }) << "Failure connecting the blocks of tracking test."<< std::endl; + ASSERT_NO_THROW( { + std::string file = "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat"; + const char * file_name = file.c_str(); + gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); + gr_skiphead_sptr skip_head = gr_make_skiphead(sizeof(gr_complex), skiphead_sps); + gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue); + gr_null_sink_sptr sink = gr_make_null_sink(sizeof(Gnss_Synchro)); + top_block->connect(file_source, 0, skip_head, 0); + top_block->connect(skip_head, 0, valve, 0); + top_block->connect(valve, 0, tracking->get_left_block(), 0); + top_block->connect(tracking->get_right_block(), 0, sink, 0); + }) << "Failure connecting the blocks of tracking test."<< std::endl; - tracking->start_tracking(); + tracking->start_tracking(); - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; - std::cout << "Tracked " << num_samples << " samples in " << (end-begin) << " microseconds" << std::endl; + std::cout << "Tracked " << num_samples << " samples in " << (end-begin) << " microseconds" << std::endl; - delete tracking; + delete tracking; } diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 4f74a5f09..890332fbc 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -47,7 +47,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -61,41 +62,45 @@ #include "galileo_e1_pcps_ambiguous_acquisition.h" -class GalileoE1PcpsAmbiguousAcquisitionGSoCTest: public ::testing::Test { +class GalileoE1PcpsAmbiguousAcquisitionGSoCTest: public ::testing::Test +{ protected: - GalileoE1PcpsAmbiguousAcquisitionGSoCTest() { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Acquisition test"); - factory = new GNSSBlockFactory(); - config = new InMemoryConfiguration(); - item_size = sizeof(gr_complex); - stop = false; - message = 0; - } + GalileoE1PcpsAmbiguousAcquisitionGSoCTest() + { + queue = gr_make_msg_queue(0); + top_block = gr_make_top_block("Acquisition test"); + factory = new GNSSBlockFactory(); + config = new InMemoryConfiguration(); + item_size = sizeof(gr_complex); + stop = false; + message = 0; + } - ~GalileoE1PcpsAmbiguousAcquisitionGSoCTest() { - delete factory; - delete config; - } + ~GalileoE1PcpsAmbiguousAcquisitionGSoCTest() + { + delete factory; + delete config; + } - void init(); - void start_queue(); - void wait_message(); - void stop_queue(); + void init(); + void start_queue(); + void wait_message(); + void stop_queue(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; - GNSSBlockFactory* factory; - InMemoryConfiguration* config; - Gnss_Synchro gnss_synchro; - size_t item_size; + gr_msg_queue_sptr queue; + gr_top_block_sptr top_block; + GNSSBlockFactory* factory; + InMemoryConfiguration* config; + Gnss_Synchro gnss_synchro; + size_t item_size; concurrent_queue channel_internal_queue; bool stop; int message; boost::thread ch_thread; }; -void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init(){ +void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init() +{ gnss_synchro.Channel_ID=0; gnss_synchro.System = 'E'; @@ -105,16 +110,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init(){ config->set_property("GNSS-SDR.internal_fs_hz", "4000000"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.sampled_ms", "4"); - config->set_property("Acquisition.dump", "false"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); - config->set_property("Acquisition.threshold", "50"); - config->set_property("Acquisition.doppler_max", "10000"); - config->set_property("Acquisition.doppler_step", "125"); - config->set_property("Acquisition.repeat_satellite", "false"); - config->set_property("Acquisition0.cboc", "true"); + config->set_property("Acquisition.item_type", "gr_complex"); + config->set_property("Acquisition.if", "0"); + config->set_property("Acquisition.sampled_ms", "4"); + config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); + config->set_property("Acquisition.threshold", "50"); + config->set_property("Acquisition.doppler_max", "10000"); + config->set_property("Acquisition.doppler_step", "125"); + config->set_property("Acquisition.repeat_satellite", "false"); + config->set_property("Acquisition0.cboc", "true"); } void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::start_queue() @@ -134,124 +139,122 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::wait_message() void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue() { - stop = true; - } + stop = true; +} TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate) { - init(); + init(); - GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); + GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); - delete acquisition; + delete acquisition; } TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) { - int fs_in = 4000000; - int nsamples = 4*fs_in; - struct timeval tv; + int fs_in = 4000000; + int nsamples = 4*fs_in; + struct timeval tv; long long int begin = 0; long long int end = 0; init(); - GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); + GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); - ASSERT_NO_THROW( { - acquisition->connect(top_block); + ASSERT_NO_THROW( { + acquisition->connect(top_block); + gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); - gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, gr_complex(0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + top_block->connect(source, 0, valve, 0); + top_block->connect(valve, 0, acquisition->get_left_block(), 0); + }) << "Failure connecting the blocks of acquisition test."<< std::endl; - top_block->connect(source, 0, valve, 0); - top_block->connect(valve, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test."<< std::endl; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; - - delete acquisition; - std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + delete acquisition; + std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; } TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) { - struct timeval tv; + struct timeval tv; long long int begin = 0; long long int end = 0; init(); - GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); + GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); - ASSERT_NO_THROW( { - acquisition->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_channel(gnss_synchro.Channel_ID); + }) << "Failure setting channel."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_gnss_synchro(&gnss_synchro); + }) << "Failure setting gnss_synchro."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_channel_queue(&channel_internal_queue); - }) << "Failure setting channel_internal_queue."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_channel_queue(&channel_internal_queue); + }) << "Failure setting channel_internal_queue."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); + }) << "Failure setting threshold."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", - 10000)); - }) << "Failure setting doppler_max."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", + 10000)); + }) << "Failure setting doppler_max."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", - 500)); - }) << "Failure setting doppler_step."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", + 500)); + }) << "Failure setting doppler_step."<< std::endl; - ASSERT_NO_THROW( { - acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + ASSERT_NO_THROW( { + acquisition->connect(top_block); + }) << "Failure connecting acquisition to the top_block."<< std::endl; - ASSERT_NO_THROW( { - std::string file = "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat"; - const char * file_name = file.c_str(); - gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); + ASSERT_NO_THROW( { + std::string file = "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat"; + const char * file_name = file.c_str(); + gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); - top_block->connect(file_source, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test."<< std::endl; + top_block->connect(file_source, 0, acquisition->get_left_block(), 0); + }) << "Failure connecting the blocks of acquisition test."<< std::endl; - start_queue(); - acquisition->init(); - acquisition->reset(); + start_queue(); + acquisition->init(); + acquisition->reset(); - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; - ch_thread.join(); + ch_thread.join(); - unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; - std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; + std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; - EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; - - delete acquisition; + EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; + delete acquisition; } diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc index 092a4c9a2..2956b0217 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -37,7 +37,8 @@ #include #include #include -#include +#include +#include #include #include #include "gnss_block_factory.h" @@ -150,7 +151,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) ASSERT_NO_THROW( { acquisition->connect(top_block); - gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, gr_complex(0)); + gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); top_block->connect(source, 0, valve, 0); diff --git a/src/tests/gnss_block/gnss_block_factory_test.cc b/src/tests/gnss_block/gnss_block_factory_test.cc index 9b033e4ad..9fdaa9ff2 100644 --- a/src/tests/gnss_block/gnss_block_factory_test.cc +++ b/src/tests/gnss_block/gnss_block_factory_test.cc @@ -49,112 +49,112 @@ TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("SignalSource.implementation", "File_Signal_Source"); - configuration->set_property("SignalSource.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + configuration->set_property("SignalSource.implementation", "File_Signal_Source"); + configuration->set_property("SignalSource.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); - EXPECT_STREQ("SignalSource", signal_source->role().c_str()); - EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str()); + EXPECT_STREQ("SignalSource", signal_source->role().c_str()); + EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str()); - delete configuration; - delete factory; - delete signal_source; + delete configuration; + delete factory; + delete signal_source; } TEST(GNSS_Block_Factory_Test, InstantiateUHDSignalSource) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("SignalSource.implementation", "UHD_Signal_Source"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + configuration->set_property("SignalSource.implementation", "UHD_Signal_Source"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); - EXPECT_STREQ("SignalSource", signal_source->role().c_str()); - EXPECT_STREQ("UHD_Signal_Source", signal_source->implementation().c_str()); + EXPECT_STREQ("SignalSource", signal_source->role().c_str()); + EXPECT_STREQ("UHD_Signal_Source", signal_source->implementation().c_str()); - delete configuration; - delete factory; - delete signal_source; + delete configuration; + delete factory; + delete signal_source; } TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalSource) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("SignalSource.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("SignalSource.implementation", "Pepito"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); - EXPECT_EQ(NULL, signal_source); + EXPECT_EQ(NULL, signal_source); - delete configuration; - delete factory; + delete configuration; + delete factory; } TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue); - EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str()); - EXPECT_STREQ("Signal_Conditioner", signal_conditioner->implementation().c_str()); + EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str()); + EXPECT_STREQ("Signal_Conditioner", signal_conditioner->implementation().c_str()); - delete configuration; - delete factory; - delete signal_conditioner; + delete configuration; + delete factory; + delete signal_conditioner; } TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - configuration->set_property("InputFilter.implementation", "Fir_Filter"); + configuration->set_property("InputFilter.implementation", "Fir_Filter"); - configuration->set_property("InputFilter.number_of_taps", "4"); - configuration->set_property("InputFilter.number_of_bands", "2"); + configuration->set_property("InputFilter.number_of_taps", "4"); + configuration->set_property("InputFilter.number_of_bands", "2"); - configuration->set_property("InputFilter.band1_begin", "0.0"); - configuration->set_property("InputFilter.band1_end", "0.45"); - configuration->set_property("InputFilter.band2_begin", "0.55"); - configuration->set_property("InputFilter.band2_end", "1.0"); + configuration->set_property("InputFilter.band1_begin", "0.0"); + configuration->set_property("InputFilter.band1_end", "0.45"); + configuration->set_property("InputFilter.band2_begin", "0.55"); + configuration->set_property("InputFilter.band2_end", "1.0"); - configuration->set_property("InputFilter.ampl1_begin", "1.0"); - configuration->set_property("InputFilter.ampl1_end", "1.0"); - configuration->set_property("InputFilter.ampl2_begin", "0.0"); - configuration->set_property("InputFilter.ampl2_end", "0.0"); + configuration->set_property("InputFilter.ampl1_begin", "1.0"); + configuration->set_property("InputFilter.ampl1_end", "1.0"); + configuration->set_property("InputFilter.ampl2_begin", "0.0"); + configuration->set_property("InputFilter.ampl2_end", "0.0"); - configuration->set_property("InputFilter.band1_error", "1.0"); - configuration->set_property("InputFilter.band2_error", "1.0"); + configuration->set_property("InputFilter.band1_error", "1.0"); + configuration->set_property("InputFilter.band2_error", "1.0"); - configuration->set_property("InputFilter.filter_type", "bandpass"); - configuration->set_property("InputFilter.grid_density", "16"); + configuration->set_property("InputFilter.filter_type", "bandpass"); + configuration->set_property("InputFilter.grid_density", "16"); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1,1, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1,1, queue); - EXPECT_STREQ("InputFilter", input_filter->role().c_str()); - EXPECT_STREQ("Fir_Filter", input_filter->implementation().c_str()); + EXPECT_STREQ("InputFilter", input_filter->role().c_str()); + EXPECT_STREQ("Fir_Filter", input_filter->implementation().c_str()); - delete configuration; - delete factory; - delete input_filter; + delete configuration; + delete factory; + delete input_filter; } TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter) @@ -199,36 +199,36 @@ TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter) TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Resampler.implementation", "Direct_Resampler"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Resampler.implementation", "Direct_Resampler"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1,1, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1,1, queue); - EXPECT_STREQ("Resampler", resampler->role().c_str()); - EXPECT_STREQ("Direct_Resampler", resampler->implementation().c_str()); + EXPECT_STREQ("Resampler", resampler->role().c_str()); + EXPECT_STREQ("Direct_Resampler", resampler->implementation().c_str()); - delete configuration; - delete factory; - delete resampler; + delete configuration; + delete factory; + delete resampler; } TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPcpsAcquisition) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1, queue); - EXPECT_STREQ("Acquisition", acquisition->role().c_str()); - EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str()); + EXPECT_STREQ("Acquisition", acquisition->role().c_str()); + EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str()); - delete configuration; - delete factory; - delete acquisition; + delete configuration; + delete factory; + delete acquisition; } @@ -252,55 +252,55 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1PcpsAmbiguousAcquisition) TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllFllPllTracking) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_FLL_PLL_Tracking", 1, 1, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_FLL_PLL_Tracking", 1, 1, queue); - EXPECT_STREQ("Tracking", tracking->role().c_str()); - EXPECT_STREQ("GPS_L1_CA_DLL_FLL_PLL_Tracking", tracking->implementation().c_str()); + EXPECT_STREQ("Tracking", tracking->role().c_str()); + EXPECT_STREQ("GPS_L1_CA_DLL_FLL_PLL_Tracking", tracking->implementation().c_str()); - delete configuration; - delete factory; - delete tracking; + delete configuration; + delete factory; + delete tracking; } TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllPllTracking) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1, queue); - EXPECT_STREQ("Tracking", tracking->role().c_str()); - EXPECT_STREQ("GPS_L1_CA_DLL_PLL_Tracking", tracking->implementation().c_str()); + EXPECT_STREQ("Tracking", tracking->role().c_str()); + EXPECT_STREQ("GPS_L1_CA_DLL_PLL_Tracking", tracking->implementation().c_str()); - delete configuration; - delete factory; - delete tracking; + delete configuration; + delete factory; + delete tracking; } TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTcpConnectorTracking) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1, queue); - EXPECT_STREQ("Tracking", tracking->role().c_str()); - EXPECT_STREQ("GPS_L1_CA_TCP_CONNECTOR_Tracking", tracking->implementation().c_str()); + EXPECT_STREQ("Tracking", tracking->role().c_str()); + EXPECT_STREQ("GPS_L1_CA_TCP_CONNECTOR_Tracking", tracking->implementation().c_str()); - delete configuration; - delete factory; - delete tracking; + delete configuration; + delete factory; + delete tracking; } @@ -324,205 +324,205 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1DllPllVemlTracking) TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTelemetryDecoder) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - TelemetryDecoderInterface *telemetry_decoder = (TelemetryDecoderInterface*)factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + TelemetryDecoderInterface *telemetry_decoder = (TelemetryDecoderInterface*)factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1, queue); - EXPECT_STREQ("TelemetryDecoder", telemetry_decoder->role().c_str()); - EXPECT_STREQ("GPS_L1_CA_Telemetry_Decoder", telemetry_decoder->implementation().c_str()); + EXPECT_STREQ("TelemetryDecoder", telemetry_decoder->role().c_str()); + EXPECT_STREQ("GPS_L1_CA_Telemetry_Decoder", telemetry_decoder->implementation().c_str()); - delete configuration; - delete factory; - delete telemetry_decoder; + delete configuration; + delete factory; + delete telemetry_decoder; } TEST(GNSS_Block_Factory_Test, InstantiateChannels) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Channels.count", "2"); - configuration->set_property("Channels.in_acquisition", "2"); - configuration->set_property("Tracking.implementation","GPS_L1_CA_DLL_FLL_PLL_Tracking"); - configuration->set_property("TelemetryDecoder.implementation","GPS_L1_CA_Telemetry_Decoder"); + configuration->set_property("Channels.count", "2"); + configuration->set_property("Channels.in_acquisition", "2"); + configuration->set_property("Tracking.implementation","GPS_L1_CA_DLL_FLL_PLL_Tracking"); + configuration->set_property("TelemetryDecoder.implementation","GPS_L1_CA_Telemetry_Decoder"); - configuration->set_property("Channel0.item_type", "gr_complex"); - configuration->set_property("Acquisition0.implementation", "GPS_L1_CA_PCPS_Acquisition"); + configuration->set_property("Channel0.item_type", "gr_complex"); + configuration->set_property("Acquisition0.implementation", "GPS_L1_CA_PCPS_Acquisition"); - configuration->set_property("Channel1.item_type", "gr_complex"); - configuration->set_property("Acquisition1.implementation", "GPS_L1_CA_PCPS_Acquisition"); + configuration->set_property("Channel1.item_type", "gr_complex"); + configuration->set_property("Acquisition1.implementation", "GPS_L1_CA_PCPS_Acquisition"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockFactory *factory = new GNSSBlockFactory(); - std::vector* channels = factory->GetChannels(configuration, queue); + std::vector* channels = factory->GetChannels(configuration, queue); - EXPECT_EQ((unsigned int) 2, channels->size()); + EXPECT_EQ((unsigned int) 2, channels->size()); - delete configuration; - delete factory; - for(unsigned int i=0 ; isize() ; i++) delete channels->at(i); - channels->clear(); - delete channels; + delete configuration; + delete factory; + for(unsigned int i=0 ; isize() ; i++) delete channels->at(i); + channels->clear(); + delete channels; } TEST(GNSS_Block_Factory_Test, InstantiateObservables) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Observables.implementation", "Pass_Through"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Observables.implementation", "Pass_Through"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); - EXPECT_STREQ("Observables", observables->role().c_str()); - EXPECT_STREQ("Pass_Through", observables->implementation().c_str()); + EXPECT_STREQ("Observables", observables->role().c_str()); + EXPECT_STREQ("Pass_Through", observables->implementation().c_str()); - delete configuration; - delete factory; - delete observables; + delete configuration; + delete factory; + delete observables; } TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaObservables) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Observables.implementation", "GPS_L1_CA_Observables"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Observables.implementation", "GPS_L1_CA_Observables"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); - EXPECT_STREQ("Observables", observables->role().c_str()); - EXPECT_STREQ("GPS_L1_CA_Observables", observables->implementation().c_str()); + EXPECT_STREQ("Observables", observables->role().c_str()); + EXPECT_STREQ("GPS_L1_CA_Observables", observables->implementation().c_str()); - delete configuration; - delete factory; - delete observables; + delete configuration; + delete factory; + delete observables; } TEST(GNSS_Block_Factory_Test, InstantiateWrongObservables) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("Observables.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("Observables.implementation", "Pepito"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); - EXPECT_EQ(NULL, observables); + EXPECT_EQ(NULL, observables); - delete configuration; - delete factory; - delete observables; + delete configuration; + delete factory; + delete observables; } TEST(GNSS_Block_Factory_Test, InstantiatePvt) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("PVT.implementation", "Pass_Through"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("PVT.implementation", "Pass_Through"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); - EXPECT_STREQ("PVT", pvt->role().c_str()); - EXPECT_STREQ("Pass_Through", pvt->implementation().c_str()); + EXPECT_STREQ("PVT", pvt->role().c_str()); + EXPECT_STREQ("Pass_Through", pvt->implementation().c_str()); - delete configuration; - delete factory; - delete pvt; + delete configuration; + delete factory; + delete pvt; } TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPvt) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("PVT.implementation", "GPS_L1_CA_PVT"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("PVT.implementation", "GPS_L1_CA_PVT"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); - EXPECT_STREQ("PVT", pvt->role().c_str()); - EXPECT_STREQ("GPS_L1_CA_PVT", pvt->implementation().c_str()); + EXPECT_STREQ("PVT", pvt->role().c_str()); + EXPECT_STREQ("GPS_L1_CA_PVT", pvt->implementation().c_str()); - delete configuration; - delete factory; - delete pvt; + delete configuration; + delete factory; + delete pvt; } TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("PVT.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("PVT.implementation", "Pepito"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); - EXPECT_EQ(NULL, pvt); + EXPECT_EQ(NULL, pvt); - delete configuration; - delete factory; - delete pvt; + delete configuration; + delete factory; + delete pvt; } TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); - EXPECT_STREQ("OutputFilter", output_filter->role().c_str()); - EXPECT_STREQ("Null_Sink_Output_Filter", output_filter->implementation().c_str()); + EXPECT_STREQ("OutputFilter", output_filter->role().c_str()); + EXPECT_STREQ("Null_Sink_Output_Filter", output_filter->implementation().c_str()); - delete configuration; - delete factory; - delete output_filter; + delete configuration; + delete factory; + delete output_filter; } TEST(GNSS_Block_Factory_Test, InstantiateFileOutputFilter) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("OutputFilter.implementation", "File_Output_Filter"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("OutputFilter.implementation", "File_Output_Filter"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); - EXPECT_STREQ("OutputFilter", output_filter->role().c_str()); - EXPECT_STREQ("File_Output_Filter", output_filter->implementation().c_str()); + EXPECT_STREQ("OutputFilter", output_filter->role().c_str()); + EXPECT_STREQ("File_Output_Filter", output_filter->implementation().c_str()); - delete configuration; - delete factory; - delete output_filter; + delete configuration; + delete factory; + delete output_filter; } TEST(GNSS_Block_Factory_Test, InstantiateWrongOutputFilter) { - InMemoryConfiguration *configuration = new InMemoryConfiguration(); - configuration->set_property("OutputFilter.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + InMemoryConfiguration *configuration = new InMemoryConfiguration(); + configuration->set_property("OutputFilter.implementation", "Pepito"); + gr_msg_queue_sptr queue = gr_make_msg_queue(0); - GNSSBlockFactory *factory = new GNSSBlockFactory(); - GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); + GNSSBlockFactory *factory = new GNSSBlockFactory(); + GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); - EXPECT_EQ(NULL, output_filter); + EXPECT_EQ(NULL, output_filter); - delete configuration; - delete factory; + delete configuration; + delete factory; } diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc index 6ffdd3080..58a354884 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc @@ -37,7 +37,8 @@ #include #include #include -#include +#include +#include #include #include #include "gnss_block_factory.h" @@ -51,200 +52,198 @@ class GpsL1CaPcpsAcquisitionTest: public ::testing::Test { protected: - GpsL1CaPcpsAcquisitionTest() - { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Acquisition test"); - factory = new GNSSBlockFactory(); - config = new InMemoryConfiguration(); - item_size = sizeof(gr_complex); - stop = false; - message = 0; - } + GpsL1CaPcpsAcquisitionTest() +{ + queue = gr_make_msg_queue(0); + top_block = gr_make_top_block("Acquisition test"); + factory = new GNSSBlockFactory(); + config = new InMemoryConfiguration(); + item_size = sizeof(gr_complex); + stop = false; + message = 0; +} - ~GpsL1CaPcpsAcquisitionTest() - { - delete factory; - delete config; - } + ~GpsL1CaPcpsAcquisitionTest() + { + delete factory; + delete config; + } - void init(); - void start_queue(); - void wait_message(); - void stop_queue(); + void init(); + void start_queue(); + void wait_message(); + void stop_queue(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; - GNSSBlockFactory* factory; - InMemoryConfiguration* config; - Gnss_Synchro gnss_synchro; - size_t item_size; - concurrent_queue channel_internal_queue; - bool stop; - int message; - boost::thread ch_thread; + gr_msg_queue_sptr queue; + gr_top_block_sptr top_block; + GNSSBlockFactory* factory; + InMemoryConfiguration* config; + Gnss_Synchro gnss_synchro; + size_t item_size; + concurrent_queue channel_internal_queue; + bool stop; + int message; + boost::thread ch_thread; }; void GpsL1CaPcpsAcquisitionTest::init() { - gnss_synchro.Channel_ID = 0; - gnss_synchro.System = 'G'; - std::string signal = "1C"; - signal.copy(gnss_synchro.Signal,2,0); - gnss_synchro.PRN=1; + gnss_synchro.Channel_ID = 0; + gnss_synchro.System = 'G'; + std::string signal = "1C"; + signal.copy(gnss_synchro.Signal,2,0); + gnss_synchro.PRN=1; - config->set_property("GNSS-SDR.internal_fs_hz", "4000000"); - config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "0"); - config->set_property("Acquisition.sampled_ms", "1"); - config->set_property("Acquisition.dump", "false"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.threshold", "70"); - config->set_property("Acquisition.doppler_max", "7200"); - config->set_property("Acquisition.doppler_step", "600"); - config->set_property("Acquisition.repeat_satellite", "false"); + config->set_property("GNSS-SDR.internal_fs_hz", "4000000"); + config->set_property("Acquisition.item_type", "gr_complex"); + config->set_property("Acquisition.if", "0"); + config->set_property("Acquisition.sampled_ms", "1"); + config->set_property("Acquisition.dump", "false"); + config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition.threshold", "70"); + config->set_property("Acquisition.doppler_max", "7200"); + config->set_property("Acquisition.doppler_step", "600"); + config->set_property("Acquisition.repeat_satellite", "false"); } void GpsL1CaPcpsAcquisitionTest::start_queue() { - ch_thread = boost::thread(&GpsL1CaPcpsAcquisitionTest::wait_message, this); + ch_thread = boost::thread(&GpsL1CaPcpsAcquisitionTest::wait_message, this); } void GpsL1CaPcpsAcquisitionTest::wait_message() { - while (!stop) - { - channel_internal_queue.wait_and_pop(message); - stop_queue(); - } + while (!stop) + { + channel_internal_queue.wait_and_pop(message); + stop_queue(); + } } void GpsL1CaPcpsAcquisitionTest::stop_queue() { - stop = true; + stop = true; } TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate) { - init(); - GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); - delete acquisition; + init(); + GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); + delete acquisition; } TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) { - int fs_in = 4000000; - int nsamples = 4000; - struct timeval tv; + int fs_in = 4000000; + int nsamples = 4000; + struct timeval tv; long long int begin = 0; long long int end = 0; init(); - GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); + GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); - ASSERT_NO_THROW( { - acquisition->connect(top_block); + ASSERT_NO_THROW( { + acquisition->connect(top_block); + gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + top_block->connect(source, 0, valve, 0); + top_block->connect(valve, 0, acquisition->get_left_block(), 0); + }) << "Failure connecting the blocks of acquisition test."<< std::endl; - gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in,GR_SIN_WAVE, 1000, 1, gr_complex(0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; - top_block->connect(source, 0, valve, 0); - top_block->connect(valve, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test."<< std::endl; - - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; - - delete acquisition; - std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + delete acquisition; + std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; } TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) { - struct timeval tv; + struct timeval tv; long long int begin = 0; long long int end = 0; double expected_delay_samples = 524; double expected_doppler_hz = 1680; init(); - GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); + GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue); - ASSERT_NO_THROW( { - acquisition->set_channel(1); - }) << "Failure setting channel."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_channel(1); + }) << "Failure setting channel."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_gnss_synchro(&gnss_synchro); + }) << "Failure setting gnss_synchro."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_channel_queue(&channel_internal_queue); - }) << "Failure setting channel_internal_queue."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_channel_queue(&channel_internal_queue); + }) << "Failure setting channel_internal_queue."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); + }) << "Failure setting threshold."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", - 10000)); - }) << "Failure setting doppler_max."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", + 10000)); + }) << "Failure setting doppler_max."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", - 500)); - }) << "Failure setting doppler_step."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", + 500)); + }) << "Failure setting doppler_step."<< std::endl; - ASSERT_NO_THROW( { - acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + ASSERT_NO_THROW( { + acquisition->connect(top_block); + }) << "Failure connecting acquisition to the top_block."<< std::endl; - ASSERT_NO_THROW( { - std::string file = "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"; - const char * file_name = file.c_str(); - gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); - top_block->connect(file_source, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test."<< std::endl; + ASSERT_NO_THROW( { + std::string file = "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"; + const char * file_name = file.c_str(); + gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); + top_block->connect(file_source, 0, acquisition->get_left_block(), 0); + }) << "Failure connecting the blocks of acquisition test."<< std::endl; - start_queue(); - acquisition->init(); - acquisition->reset(); + start_queue(); + acquisition->init(); + acquisition->reset(); - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; - ch_thread.join(); + ch_thread.join(); - unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; - std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; + std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; - ASSERT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; + ASSERT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; - double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); - float delay_error_chips = (float)(delay_error_samples*1023/4000); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); + float delay_error_chips = (float)(delay_error_samples*1023/4000); + double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); - EXPECT_LE(doppler_error_hz, 333) << "Doppler error exceeds the expected value: 333 Hz = 2/(3*integration period)"; - EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; + EXPECT_LE(doppler_error_hz, 333) << "Doppler error exceeds the expected value: 333 Hz = 2/(3*integration period)"; + EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; - delete acquisition; + delete acquisition; } diff --git a/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc b/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc index 643376a1f..8925e464f 100644 --- a/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc +++ b/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include #include #include #include "gnss_sdr_valve.h" @@ -45,38 +46,38 @@ TEST(Direct_Resampler_Conditioner_Cc_Test, InstantiationAndRunTest) { - double fs_in = 8000000.0; // Input sampling frequency in Hz - double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz - struct timeval tv; - int nsamples = 1000000; //Number of samples to be computed - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - gr_top_block_sptr top_block = gr_make_top_block("direct_resampler_conditioner_cc_test"); - gr_sig_source_c_sptr source = gr_make_sig_source_c(fs_in, GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); + double fs_in = 8000000.0; // Input sampling frequency in Hz + double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz + struct timeval tv; + int nsamples = 1000000; //Number of samples to be computed + gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr_top_block_sptr top_block = gr_make_top_block("direct_resampler_conditioner_cc_test"); + gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); long long int begin = 0; long long int end = 0; - EXPECT_NO_THROW({ - direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); - }) << "Failure in instantiation of direct_resampler_conditioner."; + EXPECT_NO_THROW({ + direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); + }) << "Failure in instantiation of direct_resampler_conditioner."; - direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); - gr_block_sptr sink = gr_make_null_sink(sizeof(gr_complex)); + direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); + gr_block_sptr sink = gr_make_null_sink(sizeof(gr_complex)); - EXPECT_NO_THROW( { - top_block->connect(source, 0, valve, 0); - top_block->connect(valve, 0, resampler, 0); - top_block->connect(resampler, 0, sink, 0); - }) << "Connection failure of direct_resampler_conditioner."; + EXPECT_NO_THROW( { + top_block->connect(source, 0, valve, 0); + top_block->connect(valve, 0, resampler, 0); + top_block->connect(resampler, 0, sink, 0); + }) << "Connection failure of direct_resampler_conditioner."; - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - top_block->stop(); - }) << "Failure running direct_resampler_conditioner."; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + top_block->stop(); + }) << "Failure running direct_resampler_conditioner."; - std::cout << "Resampled " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + std::cout << "Resampled " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; } diff --git a/src/tests/gnuradio_block/gnss_sdr_valve_test.cc b/src/tests/gnuradio_block/gnss_sdr_valve_test.cc index e0016c184..2dda04181 100644 --- a/src/tests/gnuradio_block/gnss_sdr_valve_test.cc +++ b/src/tests/gnuradio_block/gnss_sdr_valve_test.cc @@ -33,7 +33,8 @@ #include #include -#include +#include +#include #include #include #include "gnss_sdr_valve.h" @@ -43,8 +44,9 @@ TEST(Valve_Test, CheckEventSentAfter100Samples) gr_msg_queue_sptr queue = gr_make_msg_queue(0); gr_top_block_sptr top_block = gr_make_top_block("gnss_sdr_valve_test"); + + gr_block_sptr source = gr::analog::sig_source_f::make(100, gr::analog::GR_CONST_WAVE, 100, 1, 0); gr_block_sptr valve = gnss_sdr_make_valve(sizeof(float), 100, queue); - gr_sig_source_f_sptr source = gr_make_sig_source_f(100, GR_CONST_WAVE, 100, 1, 0); gr_block_sptr sink = gr_make_null_sink(sizeof(float)); unsigned int expected0 = 0; diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 7a00dae06..7d94143f7 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -46,27 +46,28 @@ #include "control_thread.h" -#include "control_thread/control_message_factory_test.cc" -//#include "control_thread/control_thread_test.cc" -#include "configuration/file_configuration_test.cc" -//#include "flowgraph/file_output_filter_test.cc" -//#include "flowgraph/file_signal_source_test.cc" -#include "flowgraph/pass_through_test.cc" -//#include "flowgraph/gnss_flowgraph_test.cc" -#include "gnuradio_block/gnss_sdr_valve_test.cc" -#include "gnuradio_block/direct_resampler_conditioner_cc_test.cc" -#include "string_converter/string_converter_test.cc" #include "arithmetic/complex_arithmetic_libc.cc" #include "arithmetic/correlations_libc.cc" #include "arithmetic/cordic_test.cc" +#include "configuration/file_configuration_test.cc" +#include "configuration/in_memory_configuration_test.cc" +#include "control_thread/control_message_factory_test.cc" +//#include "control_thread/control_thread_test.cc" +#include "flowgraph/pass_through_test.cc" +//#include "flowgraph/gnss_flowgraph_test.cc" +#include "gnss_block/file_output_filter_test.cc" #include "gnss_block/file_signal_source_test.cc" #include "gnss_block/fir_filter_test.cc" #include "gnss_block/gps_l1_ca_pcps_acquisition_test.cc" #include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc" -#include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc" -//#include "gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc" -#include "gnss_block/file_output_filter_test.cc" +//#include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc"// +#include "gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc" #include "gnss_block/gnss_block_factory_test.cc" +#include "gnuradio_block/gnss_sdr_valve_test.cc" +#include "gnuradio_block/direct_resampler_conditioner_cc_test.cc" +#include "string_converter/string_converter_test.cc" + + concurrent_queue global_gps_nav_msg_queue;