Skip to content

Commit

Permalink
added CRC unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
aerokiwi committed Jul 31, 2018
1 parent 7d91792 commit c25a468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/core/system_parameters/BEIDOU_B2a.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const double BEIDOU_LEAP_SECONDS = -33; // uniform scale and 33 seconds behind T
// NAVIGATION MESSAGE DEMODULATION AND DECODING
#define BEIDOU_CNAV2_PREAMBLE \
{ \
1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0 \
}

const double BEIDOU_CNAV2_PREAMBLE_DURATION_S = 0.120; //[s]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ TEST(BeidouCnav2NavigationMessageTest, CRCTestSuccess)
{
// Variables declarations in code
bool test_result;
std::bitset<BEIDOU_CNAV2_STRING_BITS> string_bits(std::string("0010100100001100000000000000000000000000110011110001100000000000000001100100011000000"));
Beidou_Cnav2_Navigation_Message gnav_nav_message;
std::bitset<BEIDOU_CNAV2_STRING_BITS> string_bits(std::string("011110101000100001001011101110101111111111011110000000000001111000000101001001101011011010110110101101101011011010110110101101101011011010110110101101101011011010110110101101101011011010110110101101101011011010110110101101101000000000000000000000000000000000000000000110011100111111011010011010100000000101110000100001101110000111101101001010110010001101001111010110110100101000000000000010001111010011101111000010011101001000010110010101111110111100010010010011011010101000110101011011111010011011000000010111100100010001101011001110010001110100101010001101110111011001011000"));
Beidou_Cnav2_Navigation_Message cnav2_nav_message;
cnav2_nav_message.reset();

// Call function to test
Expand All @@ -65,7 +65,7 @@ TEST(BeidouCnav2NavigationMessageTest, CRCTestFailure)
// Variables declarations in code
bool test_result;
// Constructor of string to bitset will flip the order of the bits. Needed for CRC computation
std::bitset<BEIDOU_CNAV2_STRING_BITS> string_bits(std::string("0111100100001100000000000000000000000000110011110001100000000000000001100100011000000"));
std::bitset<BEIDOU_CNAV2_STRING_BITS> string_bits(std::string("011110101000100001001011101110101111111111011110000000000001111000000101001001101011011010110110101101101011011010110110101101101011011010110110101101101011011010110110101101101011011010110110101101101011011010110110101101101000000000000000000000000000000000000000000110011100111111011010011010100000000101110000100001101110000111101101001010110010001101001111010110110100101000000000000010001111010011101111000010011101001000010110010101111110111100010010010011011010101000110101011011111010011011000000010111100100010001101011001110010001110100101010001101110111011001011001"));
Beidou_Cnav2_Navigation_Message cnav2_nav_message;
cnav2_nav_message.reset();

Expand Down

0 comments on commit c25a468

Please sign in to comment.