2024-09-20 12:50:31 +00:00
|
|
|
/*!
|
|
|
|
* \file galileo_ism_test.cc
|
|
|
|
* \brief Tests for Galileo Integrity Support Message
|
|
|
|
* \author Carles Fernandez-Prades, 2024. cfernandez(at)cttc.es
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2024-09-21 08:22:32 +00:00
|
|
|
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
|
2024-09-20 12:50:31 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "galileo_ism.h"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(GalileoISMTest, CRC)
|
|
|
|
{
|
2024-09-20 16:54:18 +00:00
|
|
|
// Example from ANNEX G Galileo ICD
|
2024-09-20 12:50:31 +00:00
|
|
|
Galileo_ISM gal_ism{};
|
2024-09-20 16:54:18 +00:00
|
|
|
std::bitset<128> input{"01011000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010111101001101011010101111"};
|
|
|
|
bool result = gal_ism.check_ism_crc(input);
|
|
|
|
EXPECT_TRUE(result);
|
2024-09-21 08:22:32 +00:00
|
|
|
// Check if it can be used twice
|
2024-09-21 11:26:27 +00:00
|
|
|
bool result2 = gal_ism.check_ism_crc(input);
|
2024-09-21 08:22:32 +00:00
|
|
|
EXPECT_TRUE(result2);
|
|
|
|
// Check if it fails
|
2024-09-21 11:26:27 +00:00
|
|
|
input.set(127);
|
|
|
|
bool result3 = gal_ism.check_ism_crc(input);
|
2024-09-21 08:22:32 +00:00
|
|
|
EXPECT_TRUE(!result3);
|
2024-09-20 12:50:31 +00:00
|
|
|
}
|