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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
spbro
OpenXG-RAN
Commits
58a29664
Commit
58a29664
authored
Aug 12, 2024
by
Thomas Schlichter
Committed by
francescomani
Sep 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for log2_approx()
parent
4e09353b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
openair1/PHY/TOOLS/tests/CMakeLists.txt
openair1/PHY/TOOLS/tests/CMakeLists.txt
+6
-0
openair1/PHY/TOOLS/tests/test_log2_approx.cpp
openair1/PHY/TOOLS/tests/test_log2_approx.cpp
+24
-0
No files found.
openair1/PHY/TOOLS/tests/CMakeLists.txt
View file @
58a29664
...
...
@@ -9,3 +9,9 @@ target_link_libraries(benchmark_rotate_vector PRIVATE benchmark::benchmark UTIL
add_dependencies
(
tests benchmark_rotate_vector
)
add_test
(
NAME benchmark_rotate_vector
COMMAND ./benchmark_rotate_vector
)
add_executable
(
test_log2_approx test_log2_approx.cpp ../log2_approx.c
)
target_link_libraries
(
test_log2_approx PRIVATE GTest::gtest LOG minimal_lib
)
add_dependencies
(
tests test_log2_approx
)
add_test
(
NAME test_log2_approx
COMMAND ./test_log2_approx
)
openair1/PHY/TOOLS/tests/test_log2_approx.cpp
0 → 100644
View file @
58a29664
#include <gtest/gtest.h>
extern
"C"
{
#include "openair1/PHY/TOOLS/tools_defs.h"
#include "common/utils/LOG/log.h"
}
#include <cmath>
uint8_t
log2_approx_ref
(
uint32_t
x
)
{
return
std
::
round
(
std
::
log2
(
x
));
}
TEST
(
log2_approx_ref
,
complete
)
{
for
(
uint32_t
i
=
0
;
i
<
UINT32_MAX
;
i
++
)
EXPECT_EQ
(
log2_approx
(
i
),
log2_approx_ref
(
i
));
}
int
main
(
int
argc
,
char
**
argv
)
{
logInit
();
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
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