1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 06:23:18 +00:00

Cleaning tests. Added test for the RTCM printer.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@495 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2014-03-23 09:45:03 +00:00
parent 7e752653b4
commit daba798d8a
34 changed files with 336 additions and 544 deletions

View File

@ -110,6 +110,7 @@ include_directories(
${GFlags_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${ARMADILLO_INCLUDE_DIRS}
)
@ -126,6 +127,9 @@ if(OPENCL_FOUND)
add_definitions(-DOPENCL_BLOCKS_TEST=1)
endif(OPENCL_FOUND)
add_definitions(-DTEST_PATH="${CMAKE_SOURCE_DIR}/src/tests/")
add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc)
target_link_libraries(run_tests ${MAC_LIBRARIES}
@ -137,6 +141,7 @@ target_link_libraries(run_tests ${MAC_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
${GNURADIO_ANALOG_LIBRARIES}
${ARMADILLO_LIBRARIES}
gnss_sp_libs
gnss_rx
signal_generator_blocks

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -31,43 +31,88 @@
*/
#include <gtest/gtest.h>
#include <gflags/gflags.h>
#include <complex>
#include <sys/time.h>
#include <iostream>
#include <glog/log_severity.h>
#include <glog/logging.h>
using google::LogMessage;
#include <complex>
#include <ctime>
#include <armadillo>
#include <gflags/gflags.h>
DEFINE_int32(size_multiply_test, 100000, "Size of the arrays used for calculations");
TEST(Multiply_Test, StandardCImplementation)
TEST(Multiply_Test, StandardCComplexImplementation)
{
//LOG_AT_LEVEL(INFO) << "Using standard C++ library implementation to perform complex arithmetic";
std::complex<float>* input = new std::complex<float>[FLAGS_size_multiply_test];
std::complex<float>* output = new std::complex<float>[FLAGS_size_multiply_test];
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_multiply_test);
struct timeval tv;
gettimeofday(&tv, NULL);
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i = 0; i < FLAGS_size_multiply_test; i++)
{
output[i] = input[i] * input[i];
}
gettimeofday(&tv, NULL);
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
std::cout << "Multiplication of "<< FLAGS_size_multiply_test
<< " complex<float> finished in " << (end - begin)
<< " microseconds" << std::endl;
ASSERT_LE(0, end - begin);
}
//LOG_AT_LEVEL(INFO) << "Allocated two vectors containing " << FLAGS_size << " complex numbers";
//LOG_AT_LEVEL(INFO) << "Begin multiplications";
TEST(Multiply_Test, StandardCDoubleImplementation)
{
double input[FLAGS_size_multiply_test];
double output[FLAGS_size_multiply_test];
memset(input, 0, sizeof(double) * FLAGS_size_multiply_test);
struct timeval tv;
gettimeofday(&tv, NULL);
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i = 0; i < FLAGS_size_multiply_test; i++)
{
output[i] = input[i] * input[i];
}
gettimeofday(&tv, NULL);
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
std::cout << "Multiplication of "<< FLAGS_size_multiply_test
<< " doubles finished in " << (end - begin)
<< " microseconds" << std::endl;
ASSERT_LE(0, end - begin);
}
TEST(Multiply_Test, ArmadilloComplexImplementation)
{
arma::cx_fvec input(FLAGS_size_multiply_test, arma::fill::zeros);
arma::cx_fvec output(FLAGS_size_multiply_test);
struct timeval tv;
gettimeofday(&tv, NULL);
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<FLAGS_size_multiply_test; i++)
{
output[i] = input[i] * input[i];
}
output = input % input;
gettimeofday(&tv, NULL);
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
// LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
std::cout << "Multiplication of "<< FLAGS_size_multiply_test << " complex<float> finished in " << (end - begin) << " microseconds" << std::endl;
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
std::cout << "Element-wise multiplication of "<< FLAGS_size_multiply_test
<< "-length complex armadillo vectors finished in " << (end - begin)
<< " microseconds" << std::endl;
ASSERT_LE(0, end - begin);
}
TEST(Multiply_Test, ArmadilloImplementation)
{
arma::vec input(FLAGS_size_multiply_test, arma::fill::zeros);
arma::vec output(FLAGS_size_multiply_test);
struct timeval tv;
gettimeofday(&tv, NULL);
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
output = input % input;
gettimeofday(&tv, NULL);
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
std::cout << "Element-wise multiplication of "<< FLAGS_size_multiply_test
<< "-length armadillo vectors finished in " << (end - begin)
<< " microseconds" << std::endl;
ASSERT_LE(0, end - begin);
}

View File

@ -1,161 +0,0 @@
/*!
* \file cordic_test.cc
* \brief Test of the CORDIC (COordinate Rotation DIgital Computer) algorithm
* \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
* Javier Arribas, 2012. jarribas(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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "GPS_L1_CA.h"
#include <iostream>
#include <cmath>
#include <gtest/gtest.h>
#include "cordic.h"
#include <sys/time.h>
#include <algorithm>
#include <cstdlib> // for RAND_MAX
#include <gnuradio/fxpt_nco.h>
#include "nco_lib.h"
TEST(Cordic_Test, StandardCIsFasterThanCordic)
{
int largest_k = 10;
Cordic* cordicPtr;
cordicPtr = new Cordic(largest_k);
std::complex<float> *d_carr_sign;
float* d_carr_sign_I;
float* d_carr_sign_Q;
// carrier parameters
int d_vector_length = 4000;
float phase_rad;
float phase_step_rad;
float carrier_freq = 2000;
float d_fs_in = 4000000;
phase_step_rad = (float)GPS_TWO_PI*carrier_freq / (float)d_fs_in;
// space for carrier wipeoff and signal baseband vectors
if (posix_memalign((void**)&d_carr_sign, 16, d_vector_length * sizeof(std::complex<float>) * 2) == 0){};
if (posix_memalign((void**)&d_carr_sign_I, 16, d_vector_length * sizeof(float) * 2) == 0){};
if (posix_memalign((void**)&d_carr_sign_Q, 16, d_vector_length * sizeof(float) * 2) == 0){};
double sin_d,cos_d;
double sin_f,cos_f;
double niter = 10000;
struct timeval tv;
//*** NON-OPTIMIZED CORDIC *****
gettimeofday(&tv, NULL);
long long int begin1 = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<niter; i++)
{
phase_rad=0;
for(int j=0; j<d_vector_length; j++)
{
cordicPtr->cordic_get_cos_sin(phase_rad, cos_d, sin_d);
d_carr_sign[j] = std::complex<float>(cos_d, -sin_d);
phase_rad = phase_rad + phase_step_rad;
}
}
gettimeofday(&tv, NULL);
long long int end1 = tv.tv_sec *1000000 + tv.tv_usec;
//*** STD COS, SIN standalone *****
gettimeofday(&tv, NULL);
long long int begin2 = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<niter; i++)
{
for(int j=0;j<d_vector_length;j++)
{
cos_f = std::cos(phase_rad);
sin_f = std::sin(phase_rad);
d_carr_sign[j] =std::complex<float>(cos_f, -sin_f);
phase_rad = phase_rad + phase_step_rad;
}
}
gettimeofday(&tv, NULL);
long long int end2 = tv.tv_sec *1000000 + tv.tv_usec;
//*** GNU RADIO FIXED POINT ARITHMETIC ********
gettimeofday(&tv, NULL);
long long int begin3 = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<niter; i++)
{
gr::fxpt_nco(d_carr_sign, d_vector_length,0, phase_step_rad);
}
gettimeofday(&tv, NULL);
long long int end3 = tv.tv_sec *1000000 + tv.tv_usec;
//*** SSE2 NCO ****************
gettimeofday(&tv, NULL);
long long int begin4 = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<niter; i++)
{
sse_nco(d_carr_sign, d_vector_length,0, phase_step_rad);
}
gettimeofday(&tv, NULL);
long long int end4 = tv.tv_sec *1000000 + tv.tv_usec;
//*** GNU RADIO FIXED POINT ARITHMETIC COPY BY REFERENCE********
gettimeofday(&tv, NULL);
long long int begin5 = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<niter; i++)
{
gr::fxpt_nco_cpyref(d_carr_sign, d_vector_length,0, phase_step_rad);
}
gettimeofday(&tv, NULL);
long long int end5 = tv.tv_sec *1000000 + tv.tv_usec;
//*** GNU RADIO FIXED POINT ARITHMETIC COPY BY REFERENCE SPLIT IQ********
gettimeofday(&tv, NULL);
long long int begin6 = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<niter; i++)
{
gr::fxpt_nco_IQ_split(d_carr_sign_I, d_carr_sign_Q, d_vector_length,0, phase_step_rad);
}
gettimeofday(&tv, NULL);
long long int end6 = tv.tv_sec *1000000 + tv.tv_usec;
delete cordicPtr;
std::cout << "NON-OPTIMIZED CORDIC computed " << niter << " times in " << (end1-begin1) << " microseconds" << std::endl;
std::cout << "STD LIB ARITHM computed " << niter << " times in " << (end2-begin2) << " microseconds" << std::endl;
std::cout << "FXPT CORDIC computed " << niter << " times in " << (end3-begin3) << " microseconds" << std::endl;
std::cout << "SSE CORDIC computed " << niter << " times in " << (end4-begin4) << " microseconds" << std::endl;
std::cout << "FXPT CORDIC CPY REF computed " << niter << " times in " << (end5-begin5) << " microseconds" << std::endl;
std::cout << "FXPT CORDIC CPY REF SPLIT computed " << niter << " times in " << (end6-begin6) << " microseconds" << std::endl;
EXPECT_TRUE((end2-begin2) < (end1-begin1)); // if true, standard C++ is faster than the cordic implementation
}

View File

@ -1,92 +0,0 @@
/*!
* \file correlations_libc.cc
* \brief This file implements a unit test for correlation
* \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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include <gtest/gtest.h>
#include <complex>
#include <sys/time.h>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <gflags/gflags.h>
using google::LogMessage;
DEFINE_int32(N, 2046, "Samples per millisecond of signal");
DEFINE_int32(M, 3, "Number of correlations per GNSS-SDR channel");
DEFINE_int32(C, 12, "Number of channels to simulate");
DEFINE_string(data_type, "complex", "Data type for samples");
TEST(Correlation_Test, StandardCImplementation)
{
int correlations = FLAGS_M * FLAGS_C;
//LOG_AT_LEVEL(INFO) << "Simulating " << FLAGS_C << " channels";
//LOG_AT_LEVEL(INFO) << FLAGS_M << " correlations per channel";
//LOG_AT_LEVEL(INFO) << "Performing " << correlations << " correlations";
//LOG_AT_LEVEL(INFO) << "Testing standard C++ library using complex numbers";
std::complex<float>* input = new std::complex<float>[FLAGS_N];
std::complex<float> accum;
std::srand((unsigned)time(0));
for(int i=0; i < FLAGS_N; i++)
{
input[i] = std::complex<float>(std::rand() % 10000, std::rand() % 10000);
}
struct timeval tv;
gettimeofday(&tv, NULL);
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
for(int i=0; i<correlations; i++)
{
for(int j=0; j < FLAGS_N; j++)
{
input[j] = input[j] * input[j];
input[j] = input[j] * input[j];
accum += input[j];
}
}
gettimeofday(&tv, NULL);
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
std::cout << correlations << " correlations of " << FLAGS_N
<< "-length vectors computed in " << (end - begin)
<< " microseconds" << std::endl;
}

View File

@ -6,7 +6,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -32,15 +32,15 @@
#include <string>
#include <iostream>
#include <gtest/gtest.h>
#include "file_configuration.h"
TEST(File_Configuration_Test, OverridedProperties)
{
ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt");
std::string path = std::string(TEST_PATH);
std::string filename = path + "data/config_file_sample.txt";
ConfigurationInterface *configuration = new FileConfiguration(filename);
std::string default_value = "default_value";
std::string value = configuration->property("NotThere", default_value);
@ -73,7 +73,9 @@ TEST(File_Configuration_Test, LoadFromNonExistentFile)
TEST(File_Configuration_Test, PropertyDoesNotExist)
{
ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt");
std::string path = std::string(TEST_PATH);
std::string filename = path + "data/config_file_sample.txt";
ConfigurationInterface *configuration = new FileConfiguration(filename);
std::string default_value = "default_value";
std::string value = configuration->property("whatever.whatever", default_value);

View File

@ -6,7 +6,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -29,7 +29,6 @@
* -------------------------------------------------------------------------
*/
#include <gtest/gtest.h>
#include "configuration_interface.h"
#include "in_memory_configuration.h"

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -32,7 +32,6 @@
#include <string>
#include <gtest/gtest.h>
#include "control_message_factory.h"

View File

@ -30,12 +30,27 @@
* -------------------------------------------------------------------------
*/
#include <unistd.h>
#include <exception>
#include <boost/lexical_cast.hpp>
#include <boost/thread/thread.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception_ptr.hpp>
#include <gtest/gtest.h>
#include <gnuradio/msg_queue.h>
#include "control_thread.h"
#include <gnuradio/message.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
//#include "control_thread.h"
#include "in_memory_configuration.h"
#include "control_message_factory.h"
/*
#include "control_thread.h"
#include <boost/lexical_cast.hpp>
#include "gnss_flowgraph.h"
#include "file_configuration.h"
#include "gps_ephemeris.h"
#include "gps_iono.h"
#include "gps_utc_model.h"
@ -48,14 +63,6 @@
#include "concurrent_queue.h"
#include "concurrent_map.h"
#include <unistd.h>
#include <gnuradio/message.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "gnss_flowgraph.h"
#include "file_configuration.h"
#include "control_message_factory.h"
#include <boost/thread/thread.hpp>
extern concurrent_map<Gps_Ephemeris> global_gps_ephemeris_map;
extern concurrent_map<Gps_Iono> global_gps_iono_map;
@ -79,7 +86,7 @@ extern concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
extern concurrent_queue<Galileo_Iono> global_galileo_iono_queue;
extern concurrent_queue<Galileo_Utc_Model> global_galileo_utc_model_queue;
extern concurrent_queue<Galileo_Almanac> global_galileo_almanac_queue;
*/
TEST(Control_Thread_Test, InstantiateRunControlMessages)
@ -87,7 +94,8 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages)
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.filename", "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat");
config->set_property("SignalSource.filename", "../src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat");
config->set_property("SignalSource.item_type", "gr_complex");
config->set_property("SignalSource.sampling_frequency", "4000000");
config->set_property("SignalSource.repeat", "true");
@ -96,6 +104,7 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages)
config->set_property("Channels.count", "2");
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
config->set_property("Acquisition.item_type", "gr_complex");
config->set_property("Acquisition.threshold", "0.8");
config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
config->set_property("Tracking.item_type", "gr_complex");
config->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder");
@ -110,39 +119,35 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages)
std::unique_ptr<ControlThread> control_thread(new ControlThread(config));
gr::msg_queue::sptr control_queue = gr::msg_queue::make(0);
ControlMessageFactory *control_msg_factory = new ControlMessageFactory();
//ControlMessageFactory *control_msg_factory = new ControlMessageFactory();
std::unique_ptr<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(200,0));
control_thread->set_control_queue(control_queue);
try
{
control_thread->run();
}
catch( boost::exception & e )
{
std::cout << "Boost exception: " << boost::diagnostic_information(e);
}
catch(std::exception const& ex)
{
std::cout << "STD exception: " << ex.what();
}
control_thread->run();
unsigned int expected18 = 18;
unsigned int expected3 = 3;
unsigned int expected1 = 1;
EXPECT_EQ(expected18, control_thread->processed_control_messages());
EXPECT_EQ(expected3, control_thread->processed_control_messages());
EXPECT_EQ(expected1, control_thread->applied_actions());
delete config;
//delete control_thread;
delete control_msg_factory;
//delete control_msg_factory;
}
@ -153,9 +158,11 @@ 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.filename", "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat");
config->set_property("SignalSource.filename", "../src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.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", "1");
@ -172,26 +179,40 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages2)
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);
std::unique_ptr<ControlThread> control_thread2(new ControlThread(config));
gr::msg_queue::sptr control_queue = gr::msg_queue::make(0);
ControlMessageFactory *control_msg_factory = new ControlMessageFactory();
gr::msg_queue::sptr control_queue2 = gr::msg_queue::make(0);
//ControlMessageFactory *control_msg_factory = new ControlMessageFactory();
std::unique_ptr<ControlMessageFactory> control_msg_factory2(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_queue2->handle(control_msg_factory2->GetQueueMessage(0,0));
control_queue2->handle(control_msg_factory2->GetQueueMessage(0,2));
control_queue2->handle(control_msg_factory2->GetQueueMessage(0,1));
control_queue2->handle(control_msg_factory2->GetQueueMessage(0,3));
control_queue2->handle(control_msg_factory2->GetQueueMessage(200,0));
control_thread->set_control_queue(control_queue);
control_thread2->set_control_queue(control_queue2);
try
{
control_thread2->run();
}
catch( boost::exception & e )
{
std::cout << "Boost exception: " << boost::diagnostic_information(e);
}
catch(std::exception const& ex)
{
std::cout << "STD exception: " << ex.what();
}
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());
EXPECT_EQ(expected5, control_thread2->processed_control_messages());
EXPECT_EQ(expected1, control_thread2->applied_actions());
delete config;
delete control_thread;
delete control_msg_factory;
//delete control_thread;
//delete control_msg_factory;
}

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -30,7 +30,6 @@
* -------------------------------------------------------------------------
*/
#include <gtest/gtest.h>
#include <gnuradio/msg_queue.h>
#include "gnss_flowgraph.h"
#include "gnss_block_interface.h"
@ -52,7 +51,9 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStop)
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");
std::string path = std::string(TEST_PATH);
std::string filename = path + "signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
config->set_property("SignalSource.filename", filename);
config->set_property("SignalConditioner.implementation", "Pass_Through");
config->set_property("Channels.count", "2");
config->set_property("Channels.acquisition.implementation", "Pass_Through");

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -31,7 +31,6 @@
*/
#include <gtest/gtest.h>
#include "pass_through.h"
#include "in_memory_configuration.h"

View File

@ -30,15 +30,16 @@
*/
#include <gtest/gtest.h>
#include "file_output_filter.h"
#include "in_memory_configuration.h"
TEST(FileOutputFilter, 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;
InMemoryConfiguration* config = new InMemoryConfiguration();
std::string path = std::string(TEST_PATH);
std::string file = path + "data/output.dat";
config->set_property("Test.filename", file);
config->set_property("Test.item_type", "float");
FileOutputFilter *output_filter = new FileOutputFilter(config, "Test", 1, 0);
delete output_filter;
}

View File

@ -29,12 +29,10 @@
* -------------------------------------------------------------------------
*/
#include <gtest/gtest.h>
//#include <gnuradio/block.h>
#include <stdexcept>
#include <gnuradio/msg_queue.h>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/null_sink.h>
#include <stdexcept>
#include "file_signal_source.h"
#include "in_memory_configuration.h"
@ -45,13 +43,15 @@ TEST(FileSignalSource, Instantiate)
config->set_property("Test.samples", "0");
config->set_property("Test.sampling_frequency", "0");
config->set_property("Test.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat");
std::string path = std::string(TEST_PATH);
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
config->set_property("Test.filename", filename);
config->set_property("Test.item_type", "gr_complex");
config->set_property("Test.repeat", "false");
FileSignalSource *signal_source = new FileSignalSource(config, "Test", 1, 1, queue);
EXPECT_STREQ("../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat", signal_source->filename().c_str());
//EXPECT_STREQ("../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat", signal_source->filename().c_str());
EXPECT_STREQ("gr_complex", signal_source->item_type().c_str());
EXPECT_TRUE(signal_source->repeat() == false);

View File

@ -28,10 +28,9 @@
* -------------------------------------------------------------------------
*/
#include <gflags/gflags.h>
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gflags/gflags.h>
#include <gnuradio/top_block.h>
#include <gnuradio/analog/sig_source_waveform.h>
#include <gnuradio/analog/sig_source_c.h>
@ -43,7 +42,7 @@
#include "gnss_sdr_valve.h"
#include "fir_filter.h"
DEFINE_string(filter_test_output_filename, "../src/tests/data/fir_filter_test_output.dat", "Dump filename");
DEFINE_string(filter_test_output_filename, std::string(TEST_PATH) + "data/fir_filter_test_output.dat", "Dump filename");
class Fir_Filter_Test: public ::testing::Test
{

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2012-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -31,9 +31,7 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -185,7 +183,8 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
}) << "Failure connecting tracking 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";
std::string path = std::string(TEST_PATH);
std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
const char * file_name = file.c_str();
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex),file_name,false);
gr::blocks::skiphead::sptr skip_head = gr::blocks::skiphead::make(sizeof(gr_complex), skiphead_sps);

View File

@ -6,7 +6,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -30,8 +30,7 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -44,9 +43,7 @@
#include "gnss_synchro.h"
#include "galileo_e1_pcps_8ms_ambiguous_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "boost/shared_ptr.hpp"
@ -569,7 +566,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block." << std::endl;
if (i == 0)
{

View File

@ -31,9 +31,7 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -46,9 +44,7 @@
#include "gnss_synchro.h"
#include "galileo_e1_pcps_ambiguous_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "boost/shared_ptr.hpp"
@ -195,7 +191,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
config->set_property("Acquisition.max_dwells", "1");
config->set_property("Acquisition.bit_transition_flag","false");
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
config->set_property("Acquisition.threshold", "0.3");
config->set_property("Acquisition.threshold", "0.1");
config->set_property("Acquisition.doppler_max", "10000");
config->set_property("Acquisition.doppler_step", "250");
config->set_property("Acquisition.dump", "false");
@ -487,10 +483,6 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
{
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
}
}
delete acquisition;
@ -567,7 +559,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running the top_block."<< std::endl;
}) << "Failure running the top_block." << std::endl;
if (i == 0)
{

View File

@ -41,9 +41,7 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -52,16 +50,15 @@
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/blocks/skiphead.h>
#include "gnss_block_factory.h"
#include "gnss_block_interface.h"
#include "in_memory_configuration.h"
#include "gnss_sdr_valve.h"
#include "gnss_signal.h"
#include "gnss_synchro.h"
#include "galileo_e1_pcps_ambiguous_acquisition.h"
class GalileoE1PcpsAmbiguousAcquisitionGSoCTest: public ::testing::Test
{
protected:
@ -236,7 +233,8 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
}) << "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";
std::string path = std::string(TEST_PATH);
std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
const char * file_name = file.c_str();
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
@ -263,7 +261,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
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.";
EXPECT_EQ(0, message) << "Acquisition failure. Expected message: 0=ACQ STOP.";
delete acquisition;
}

View File

@ -31,9 +31,8 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -195,7 +194,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
}) << "Failure setting channel_internal_queue." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
acquisition->set_threshold(config->property("Acquisition.threshold", 0.00001));
}) << "Failure setting threshold." << std::endl;
ASSERT_NO_THROW( {
@ -211,7 +210,8 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
}) << "Failure connecting acquisition to the top_block." << std::endl;
ASSERT_NO_THROW( {
std::string file = "../src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
std::string path = std::string(TEST_PATH);
std::string file = path + "signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
const char * file_name = file.c_str();
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
@ -222,7 +222,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
}) << "Failure while starting the queue" << std::endl;
acquisition->init();
acquisition->reset();
//acquisition->reset();
EXPECT_NO_THROW( {
gettimeofday(&tv, NULL);
@ -232,14 +232,17 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
end = tv.tv_sec *1000000 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
//ASSERT_NO_THROW( {
// ch_thread.timed_join(boost::posix_time::seconds(1));
//}) << "Failure while waiting the queue to stop" << 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.";
std::cout << "Delay: " << gnss_synchro.Acq_delay_samples << std::endl;
std::cout << "Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl;
double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
float delay_error_chips = (float)(delay_error_samples*1023/4000000);
double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);

View File

@ -31,9 +31,7 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -46,9 +44,7 @@
#include "gnss_synchro.h"
#include "galileo_e1_pcps_cccwsr_ambiguous_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "boost/shared_ptr.hpp"
@ -450,7 +446,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
}) << "Failure connecting the blocks of acquisition test." << std::endl;
// i = 0 --> sallite in acquisition is visible
// i = 0 --> satellite in acquisition is visible
// i = 1 --> satellite in acquisition is not visible
for (unsigned int i = 0; i < 2; i++)
{
@ -471,7 +467,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block." << std::endl;
if (i == 0)
{
@ -485,10 +481,6 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
{
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;
@ -522,7 +514,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
}) << "Failure setting doppler_step."<< std::endl;
ASSERT_NO_THROW( {
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
acquisition->set_threshold(config->property("Acquisition.threshold", 0.00215));
}) << "Failure setting threshold."<< std::endl;
ASSERT_NO_THROW( {
@ -563,7 +555,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
@ -576,9 +568,6 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -32,8 +32,8 @@
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -41,15 +41,14 @@
#include <gnuradio/analog/sig_source_c.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/null_sink.h>
#include <gtest/gtest.h>
#include "gnss_block_interface.h"
#include "in_memory_configuration.h"
#include "configuration_interface.h"
#include "gnss_synchro.h"
#include "galileo_e1_pcps_tong_ambiguous_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
@ -432,12 +431,12 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
}) << "Failure setting doppler_step."<< std::endl;
ASSERT_NO_THROW( {
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
acquisition->set_threshold(config->property("Acquisition.threshold", 0.000001));
}) << "Failure setting threshold."<< std::endl;
ASSERT_NO_THROW( {
acquisition->connect(top_block);
}) << "Failure connecting acquisition to the top_block."<< std::endl;
}) << "Failure connecting acquisition to the top_block." << std::endl;
acquisition->init();
@ -450,7 +449,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
}) << "Failure connecting the blocks of acquisition test." << std::endl;
// i = 0 --> sallite in acquisition is visible
// i = 0 --> satellite in acquisition is visible
// i = 1 --> satellite in acquisition is not visible
for (unsigned int i = 0; i < 2; i++)
{
@ -485,10 +484,6 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
{
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;
@ -522,7 +517,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
}) << "Failure setting doppler_step."<< std::endl;
ASSERT_NO_THROW( {
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
acquisition->set_threshold(config->property("Acquisition.threshold", 0.00028));
}) << "Failure setting threshold."<< std::endl;
ASSERT_NO_THROW( {
@ -563,7 +558,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running the top_block."<< std::endl;
}) << "Failure running the top_block." << std::endl;
if (i == 0)
{

View File

@ -2,7 +2,7 @@
* \file gnss_block_factory_test.cc
* \brief This class implements a Unit Test for the GNSSBlockFactory class.
* \authors <ul>
* <li> Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
* <li> Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* </ul>
*
@ -10,7 +10,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -33,10 +33,8 @@
* -------------------------------------------------------------------------
*/
#include <gnuradio/msg_queue.h>
#include <vector>
#include <gtest/gtest.h>
#include <gnuradio/msg_queue.h>
#include "in_memory_configuration.h"
#include "gnss_block_interface.h"
#include "acquisition_interface.h"
@ -50,17 +48,15 @@
TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource)
{
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");
std::string path = std::string(TEST_PATH);
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
configuration->set_property("SignalSource.filename", filename);
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
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());
delete configuration;
delete factory;
delete signal_source;

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -31,9 +31,7 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -47,9 +45,7 @@
#include "gnss_synchro.h"
#include "gps_l1_ca_pcps_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -32,8 +32,7 @@
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
@ -176,8 +175,8 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
struct timeval tv;
long long int begin = 0;
long long int end = 0;
double expected_delay_samples = 945;
double expected_doppler_hz = 4000;
double expected_delay_samples = 127;
double expected_doppler_hz = -2400;
init();
GpsL1CaPcpsAcquisition *acquisition = new GpsL1CaPcpsAcquisition(config, "Acquisition", 1, 1, queue);
@ -194,7 +193,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
}) << "Failure setting channel_internal_queue." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_threshold(config->property("Acquisition.threshold", 0.005));
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0001));
}) << "Failure setting threshold." << std::endl;
ASSERT_NO_THROW( {
@ -210,7 +209,8 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
}) << "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";
std::string path = std::string(TEST_PATH);
std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
const char * file_name = file.c_str();
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
@ -236,8 +236,8 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
ASSERT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
std::cout << "----Aq_delay: " << gnss_synchro.Acq_delay_samples << std::endl;
std::cout << "----Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl;
//std::cout << "----Aq_delay: " << gnss_synchro.Acq_delay_samples << std::endl;
//std::cout << "----Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl;
double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
float delay_error_chips = (float)(delay_error_samples*1023/4000);

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -32,9 +32,9 @@
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/analog/sig_source_waveform.h>
@ -47,13 +47,10 @@
#include "gnss_synchro.h"
#include "gps_l1_ca_pcps_multithread_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
#include "boost/shared_ptr.hpp"
#include "signal_generator.h"
#include "signal_generator.cc"
#include "signal_generator_c.h"
@ -560,7 +557,7 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResultsProbabi
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block." << std::endl;
if (i == 0)
{

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -31,10 +31,9 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/analog/sig_source_waveform.h>
@ -51,7 +50,7 @@
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
#include "boost/shared_ptr.hpp"
class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test: public ::testing::Test

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -32,9 +32,9 @@
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/analog/sig_source_waveform.h>
@ -47,13 +47,11 @@
#include "gnss_synchro.h"
#include "gps_l1_ca_pcps_tong_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
#include "boost/shared_ptr.hpp"
class GpsL1CaPcpsTongAcquisitionGSoC2013Test: public ::testing::Test
@ -385,7 +383,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
boost::shared_ptr<gr::block> 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;
}) << "Failure connecting the blocks of acquisition test." << std::endl;
EXPECT_NO_THROW( {
gettimeofday(&tv, NULL);
@ -393,7 +391,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
top_block->run(); // Start threads and wait
gettimeofday(&tv, NULL);
end = tv.tv_sec *1e6 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
}) << "Failure running the top_block." << std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
delete acquisition;
@ -432,7 +430,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
ASSERT_NO_THROW( {
acquisition->connect(top_block);
}) << "Failure connecting acquisition to the top_block."<< std::endl;
}) << "Failure connecting acquisition to the top_block." << std::endl;
acquisition->init();

View File

@ -0,0 +1,77 @@
/*!
* \file rtcm_printer_test.cc
* \brief Implements Unit Test for the Rtcm_Printer class.
* \author Carles Fernandez-Prades, 2013. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (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 <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include <fstream>
#include <map>
#include <string>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include "rtcm_printer.h"
#include "gps_ephemeris.h"
TEST(Rtcm_Printer_Test, Instantiate)
{
std::string filename = "hello.rtcm";
bool flag_rtcm_tty_port = false;
std::string rtcm_dump_devname = "/dev/pts/4";
Rtcm_Printer *RTCM_printer = new Rtcm_Printer(filename, flag_rtcm_tty_port, rtcm_dump_devname);
delete RTCM_printer;
}
TEST(Rtcm_Printer_Test, Instantiate_and_Run)
{
std::string file_name = "./gps_ephemeris_rx.xml";
std::map<int,Gps_Ephemeris> gps_ephemeris_map;
try
{
std::ifstream ifs(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs);
gps_ephemeris_map.clear();
xml >> boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", gps_ephemeris_map);
ifs.close();
}
catch (std::exception& e)
{
//LOG(WARNING) << e.what() << "File: " << file_name;
//std::cout << "File not found" << std::endl;
}
std::string filename = "hello.rtcm";
bool flag_rtcm_tty_port = false;
std::string rtcm_dump_devname = "/dev/pts/4";
Rtcm_Printer *RTCM_printer = new Rtcm_Printer(filename, flag_rtcm_tty_port, rtcm_dump_devname);
std::string reference_msg = "D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B98";
std::string testing_msg = RTCM_printer->print_M1005_test();
EXPECT_EQ(reference_msg, testing_msg);
delete RTCM_printer;
}

View File

@ -32,8 +32,7 @@
*/
#include <gtest/gtest.h>
#include <sys/time.h>
#include <ctime>
#include <iostream>
#include <gnuradio/top_block.h>
#include <gnuradio/analog/sig_source_waveform.h>

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -31,7 +31,6 @@
*/
#include <gtest/gtest.h>
#include <gnuradio/top_block.h>
#include <gnuradio/analog/sig_source_waveform.h>
#include <gnuradio/analog/sig_source_f.h>

View File

@ -1,53 +0,0 @@
/**
* Copyright notice
*/
/**
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
*/
/**
* Integration test for file signal source.
*
*/
#include <gtest/gtest.h>
#include <iostream>
#include <fstream>
#include "in_memory_configuration.h"
#include "control_thread.h"
TEST(SignalSource, CorrectFileSignalSource)
{
InMemoryConfiguration* config = new InMemoryConfiguration();
config->set_property("ControlThread.wait_for_flowgraph", "true");
config->set_property("SignalSource.implementation", "FileSignalSource");
config->set_property("SignalSource.samples", "0");
config->set_property("SignalSource.filename", "./signal_samples/signal_1ms.dat");
config->set_property("SignalSource.dump", "true");
config->set_property("SignalSource.dump_filename", "./data/test1_dump.dat");
config->set_property("SignalConditioner.implementation", "PassThrough");
config->set_property("Channels.count", "1");
ControlThread* control_thread = new ControlThread(config);
control_thread->run();
delete control_thread;
delete config;
std::ifstream signal_expected;
signal_expected.open("./signal_samples/signal_1ms.dat", std::ios::in | std::ios::binary | std::ios::ate);
EXPECT_FALSE(signal_expected.fail());
std::ifstream signal_result;
signal_result.open("./data/test_dump.dat", std::ios::in | std::ios::binary | std::ios::ate);
EXPECT_FALSE(signal_result.fail());
EXPECT_EQ(signal_expected.tellg(), signal_result.tellg());
std::cout << signal_expected.tellg() << ":" << signal_result.tellg() << std::endl;
signal_expected.close();
signal_result.close();
}

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -30,7 +30,6 @@
* -------------------------------------------------------------------------
*/
#include <gtest/gtest.h>
#include "string_converter.h"

View File

@ -42,6 +42,7 @@
#include <boost/filesystem.hpp>
#include "concurrent_queue.h"
#include "concurrent_map.h"
#include "control_thread.h"
#include "gps_navigation_message.h"
#include "gps_ephemeris.h"
@ -60,28 +61,27 @@
#include "sbas_satellite_correction.h"
#include "sbas_time.h"
#include "control_thread.h"
//#include "arithmetic/complex_arithmetic_libc.cc"
//#include "arithmetic/correlations_libc.cc"
//#include "arithmetic/cordic_test.cc"
using google::LogMessage;
DECLARE_string(log_dir);
#include "arithmetic/complex_arithmetic_libc.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 "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"
//#include "flowgraph/gnss_flowgraph_test.cc"
//#include "gnss_block/rtcm_printer_test.cc"
#include "gnss_block/rtcm_printer_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/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc"
//#include "gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc"
@ -95,12 +95,10 @@
#include "gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc"
#include "gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc"
#include "gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc"
#include "gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc"
concurrent_queue<Gps_Ephemeris> global_gps_ephemeris_queue;
concurrent_queue<Gps_Iono> global_gps_iono_queue;
concurrent_queue<Gps_Utc_Model> global_gps_utc_model_queue;
@ -138,8 +136,9 @@ concurrent_map<Sbas_Ephemeris> global_sbas_ephemeris_map;
int main(int argc, char **argv)
{
std::cout << "Running main() from test_main.cc" << std::endl;
std::cout << "Running GNSS-SDR Tests..." << std::endl;
testing::InitGoogleTest(&argc, argv);
google::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
return RUN_ALL_TESTS();
}

View File

@ -1,7 +1,5 @@
#include <gflags/gflags.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "control_message_factory.h"
#include <gr_complex_to_interleaved_short.h>

View File

@ -1,9 +1,6 @@
#include <gflags/gflags.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <gr_sig_source_c.h>
#include <gr_head.h>
#include <gr_file_sink.h>