Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
b987b033
Commit
b987b033
authored
Dec 10, 2025
by
Sakthivel Velumani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: include slot functions to frame parms ctest
parent
c9902a86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
openair1/PHY/INIT/tests/test_nr_frame_params.cpp
openair1/PHY/INIT/tests/test_nr_frame_params.cpp
+46
-0
No files found.
openair1/PHY/INIT/tests/test_nr_frame_params.cpp
View file @
b987b033
...
...
@@ -21,6 +21,7 @@
#include "gtest/gtest.h"
extern
"C"
{
#include <stdlib.h>
#include "openair1/PHY/defs_nr_common.h"
#include "openair1/PHY/INIT/nr_phy_init.h"
...
...
@@ -31,6 +32,28 @@ softmodem_params_t *get_softmodem_params(void)
}
}
uint32_t
ref_get_samples_slot_timestamp
(
NR_DL_FRAME_PARMS
*
fp
,
unsigned
int
slot
)
{
uint32_t
samp_count
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
slot
;
i
++
)
{
samp_count
+=
get_samples_per_slot
(
i
,
fp
);
}
return
samp_count
;
}
uint32_t
ref_get_slot_from_timestamp
(
openair0_timestamp
ts
,
NR_DL_FRAME_PARMS
*
fp
)
{
uint32_t
slot_idx
=
0
;
int
samples_till_the_slot
=
get_samples_per_slot
(
slot_idx
,
fp
)
-
1
;
ts
=
ts
%
fp
->
samples_per_frame
;
while
(
ts
>
samples_till_the_slot
)
{
slot_idx
++
;
samples_till_the_slot
+=
get_samples_per_slot
(
slot_idx
,
fp
);
}
return
slot_idx
;
}
void
test_coherence_symbol_api
(
NR_DL_FRAME_PARMS
*
fp
)
{
EXPECT_EQ
(
get_samples_symbol_timestamp
(
fp
,
0
,
0
),
get_samples_slot_timestamp
(
fp
,
0
));
...
...
@@ -46,6 +69,25 @@ void test_coherence_symbol_api(NR_DL_FRAME_PARMS *fp)
}
}
void
test_coherence_slot_api
(
NR_DL_FRAME_PARMS
*
fp
)
{
for
(
unsigned
int
slot
=
0
;
slot
<
fp
->
slots_per_frame
;
slot
++
)
{
EXPECT_EQ
(
get_samples_slot_timestamp
(
fp
,
slot
),
ref_get_samples_slot_timestamp
(
fp
,
slot
));
}
openair0_timestamp
ts
=
get_samples_per_slot
(
0
,
fp
);
// When timestamp is the last sample of the slot
EXPECT_EQ
(
get_slot_from_timestamp
(
ts
-
1
,
fp
),
0
);
for
(
unsigned
int
slot
=
0
;
slot
<
fp
->
slots_per_frame
;
slot
++
)
{
// When timestamp is the first sample of the slot
ts
=
ref_get_samples_slot_timestamp
(
fp
,
slot
);
EXPECT_EQ
(
get_slot_from_timestamp
(
ts
,
fp
),
slot
);
// When timestamp is anywhere in the slot
ts
+=
(
rand
()
%
fp
->
samples_per_slotN0
);
EXPECT_EQ
(
get_slot_from_timestamp
(
ts
,
fp
),
slot
);
}
}
TEST
(
nr_frame_params
,
test_mu_3
)
{
NR_DL_FRAME_PARMS
fp
;
...
...
@@ -63,6 +105,7 @@ TEST(nr_frame_params, test_mu_3)
nr_init_frame_parms
(
&
cfg
,
&
fp
);
nr_dump_frame_parms
(
&
fp
);
test_coherence_symbol_api
(
&
fp
);
test_coherence_slot_api
(
&
fp
);
}
TEST
(
nr_frame_params
,
test_mu_2
)
...
...
@@ -82,6 +125,7 @@ TEST(nr_frame_params, test_mu_2)
nr_init_frame_parms
(
&
cfg
,
&
fp
);
nr_dump_frame_parms
(
&
fp
);
test_coherence_symbol_api
(
&
fp
);
test_coherence_slot_api
(
&
fp
);
}
TEST
(
nr_frame_params
,
test_mu_1
)
...
...
@@ -101,6 +145,7 @@ TEST(nr_frame_params, test_mu_1)
nr_init_frame_parms
(
&
cfg
,
&
fp
);
nr_dump_frame_parms
(
&
fp
);
test_coherence_symbol_api
(
&
fp
);
test_coherence_slot_api
(
&
fp
);
}
TEST
(
nr_frame_params
,
test_mu_0
)
...
...
@@ -120,6 +165,7 @@ TEST(nr_frame_params, test_mu_0)
nr_init_frame_parms
(
&
cfg
,
&
fp
);
nr_dump_frame_parms
(
&
fp
);
test_coherence_symbol_api
(
&
fp
);
test_coherence_slot_api
(
&
fp
);
}
int
main
(
int
argc
,
char
**
argv
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment