47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
/*
|
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
|
*/
|
|
|
|
#include <gtest/gtest.h>
|
|
extern "C" {
|
|
#include "nr_common.h"
|
|
#include "common/utils/LOG/log.h"
|
|
}
|
|
|
|
TEST(nr_common, nr_timer) {
|
|
NR_timer_t timer;
|
|
nr_timer_setup(&timer, 10, 1);
|
|
nr_timer_start(&timer);
|
|
EXPECT_TRUE(nr_timer_is_active(&timer));
|
|
EXPECT_FALSE(nr_timer_expired(&timer));
|
|
for (auto i = 0; i < 10; i++) {
|
|
nr_timer_tick(&timer);
|
|
}
|
|
EXPECT_FALSE(nr_timer_is_active(&timer));
|
|
EXPECT_TRUE(nr_timer_expired(&timer));
|
|
}
|
|
|
|
TEST(nr_common, pdsch_codeword_layer_split)
|
|
{
|
|
constexpr uint8_t expected_codewords[] = {1, 1, 1, 1, 2, 2, 2, 2};
|
|
constexpr uint8_t expected_cw0_layers[] = {1, 2, 3, 4, 2, 3, 3, 4};
|
|
constexpr uint8_t expected_cw1_layers[] = {0, 0, 0, 0, 3, 3, 4, 4};
|
|
|
|
for (uint8_t layers = 1; layers <= NR_MAX_NB_LAYERS; layers++) {
|
|
const int index = layers - 1;
|
|
EXPECT_EQ(nr_pdsch_num_codewords(layers), expected_codewords[index]);
|
|
EXPECT_EQ(nr_pdsch_layers_per_codeword(layers, 0), expected_cw0_layers[index]);
|
|
if (expected_codewords[index] == 2) {
|
|
EXPECT_EQ(nr_pdsch_layers_per_codeword(layers, 1), expected_cw1_layers[index]);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
logInit();
|
|
testing::InitGoogleTest(&argc, argv);
|
|
return RUN_ALL_TESTS();
|
|
}
|