diff --git a/lib/include/srsran/adt/bounded_bitset.h b/lib/include/srsran/adt/bounded_bitset.h index 82b2749b9..05c27b4f9 100644 --- a/lib/include/srsran/adt/bounded_bitset.h +++ b/lib/include/srsran/adt/bounded_bitset.h @@ -14,7 +14,7 @@ #define SRSRAN_DYN_BITSET_H #include "srsran/srslog/bundled/fmt/format.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include #include diff --git a/lib/include/srsran/adt/bounded_vector.h b/lib/include/srsran/adt/bounded_vector.h index 7f3b00ec4..ea273c729 100644 --- a/lib/include/srsran/adt/bounded_vector.h +++ b/lib/include/srsran/adt/bounded_vector.h @@ -14,7 +14,7 @@ #define SRSRAN_BOUNDED_VECTOR_H #include "srsran/adt/detail/type_storage.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include #include diff --git a/lib/include/srsran/adt/circular_buffer.h b/lib/include/srsran/adt/circular_buffer.h index e411831bb..c674a59f1 100644 --- a/lib/include/srsran/adt/circular_buffer.h +++ b/lib/include/srsran/adt/circular_buffer.h @@ -16,7 +16,7 @@ #include "srsran/adt/detail/type_storage.h" #include "srsran/adt/expected.h" #include "srsran/adt/pool/pool_utils.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include diff --git a/lib/include/srsran/adt/circular_map.h b/lib/include/srsran/adt/circular_map.h index 4d1c9b87f..a7744f0fa 100644 --- a/lib/include/srsran/adt/circular_map.h +++ b/lib/include/srsran/adt/circular_map.h @@ -15,7 +15,7 @@ #include "detail/type_storage.h" #include "expected.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include namespace srsran { diff --git a/lib/include/srsran/adt/expected.h b/lib/include/srsran/adt/expected.h index ff6e0760d..ed6af1a55 100644 --- a/lib/include/srsran/adt/expected.h +++ b/lib/include/srsran/adt/expected.h @@ -13,7 +13,7 @@ #ifndef SRSRAN_EXPECTED_H #define SRSRAN_EXPECTED_H -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include diff --git a/lib/include/srsran/adt/interval.h b/lib/include/srsran/adt/interval.h index c2a9ff9a9..e59d2d607 100644 --- a/lib/include/srsran/adt/interval.h +++ b/lib/include/srsran/adt/interval.h @@ -14,7 +14,7 @@ #define SRSRAN_INTERVAL_H #include "srsran/srslog/bundled/fmt/format.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include #include diff --git a/lib/include/srsran/adt/move_callback.h b/lib/include/srsran/adt/move_callback.h index 7526b76a5..1e589f3d0 100644 --- a/lib/include/srsran/adt/move_callback.h +++ b/lib/include/srsran/adt/move_callback.h @@ -14,7 +14,7 @@ #define SRSRAN_MOVE_CALLBACK_H #include "detail/type_storage.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include #include diff --git a/lib/include/srsran/adt/optional.h b/lib/include/srsran/adt/optional.h index bcdb9c574..8a08df6f2 100644 --- a/lib/include/srsran/adt/optional.h +++ b/lib/include/srsran/adt/optional.h @@ -14,7 +14,7 @@ #define SRSRAN_OPTIONAL_H #include "detail/type_storage.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" namespace srsran { diff --git a/lib/include/srsran/adt/pool/batch_mem_pool.h b/lib/include/srsran/adt/pool/batch_mem_pool.h index dea333e2a..d54f5fff8 100644 --- a/lib/include/srsran/adt/pool/batch_mem_pool.h +++ b/lib/include/srsran/adt/pool/batch_mem_pool.h @@ -16,7 +16,7 @@ #include "memblock_cache.h" #include "pool_utils.h" #include "srsran/common/thread_pool.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include diff --git a/lib/include/srsran/adt/pool/linear_allocator.h b/lib/include/srsran/adt/pool/linear_allocator.h index c79fd9f15..f825d96f8 100644 --- a/lib/include/srsran/adt/pool/linear_allocator.h +++ b/lib/include/srsran/adt/pool/linear_allocator.h @@ -14,7 +14,7 @@ #define SRSRAN_LINEAR_ALLOCATOR_H #include "pool_utils.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" namespace srsran { diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h index e130d271c..c50038b6a 100644 --- a/lib/include/srsran/asn1/asn1_utils.h +++ b/lib/include/srsran/asn1/asn1_utils.h @@ -14,7 +14,7 @@ #define SRSASN_COMMON_UTILS_H #include "srsran/srslog/srslog.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include #include diff --git a/lib/include/srsran/common/slot_point.h b/lib/include/srsran/common/slot_point.h index 97b0bbed1..d9abee2cc 100644 --- a/lib/include/srsran/common/slot_point.h +++ b/lib/include/srsran/common/slot_point.h @@ -14,7 +14,7 @@ #define SRSRAN_SLOT_POINT_H #include "srsran/adt/interval.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" namespace srsran { diff --git a/lib/include/srsran/common/test_common.h b/lib/include/srsran/common/test_common.h index 7457eb951..8c6f8d5f7 100644 --- a/lib/include/srsran/common/test_common.h +++ b/lib/include/srsran/common/test_common.h @@ -14,6 +14,7 @@ #define SRSRAN_TEST_COMMON_H #include "srsran/config.h" +#include "srsran/support/srsran_test.h" #ifdef __cplusplus @@ -21,7 +22,6 @@ #include "srsran/common/crash_handler.h" #include "srsran/common/standard_streams.h" #include "srsran/srslog/srslog.h" -#include "support/srsran_assert.h" #include #include @@ -159,20 +159,6 @@ inline void copy_msg_to_buffer(unique_byte_buffer_t& pdu, const_byte_span msg) #define TESTERROR(fmt, ...) CONDERROR(true, fmt, ##__VA_ARGS__) -#define TESTASSERT(cond) srsran_assert((cond), "Fail at \"%s\"", (#cond)) - -#else // if C - -#include - -#define TESTASSERT(cond) \ - do { \ - if (!(cond)) { \ - printf("[%s][Line %d] Fail at \"%s\"\n", __FUNCTION__, __LINE__, (#cond)); \ - return -1; \ - } \ - } while (0) - #endif // __cplusplus #endif // SRSRAN_TEST_COMMON_H diff --git a/lib/include/srsran/common/tti_point.h b/lib/include/srsran/common/tti_point.h index aac2e0b80..7855e11f9 100644 --- a/lib/include/srsran/common/tti_point.h +++ b/lib/include/srsran/common/tti_point.h @@ -16,7 +16,7 @@ #include "srsran/adt/interval.h" #include "srsran/common/common.h" #include "srsran/srslog/srslog.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include diff --git a/lib/include/srsran/rlc/rlc_am_lte.h b/lib/include/srsran/rlc/rlc_am_lte.h index 19cd565c9..468b5cab6 100644 --- a/lib/include/srsran/rlc/rlc_am_lte.h +++ b/lib/include/srsran/rlc/rlc_am_lte.h @@ -24,8 +24,8 @@ #include "srsran/interfaces/pdcp_interface_types.h" #include "srsran/rlc/rlc_am_base.h" #include "srsran/rlc/rlc_common.h" +#include "srsran/support/srsran_assert.h" #include "srsran/upper/byte_buffer_queue.h" -#include "support/srsran_assert.h" #include #include #include diff --git a/lib/include/support/srsran_assert.h b/lib/include/srsran/support/srsran_assert.h similarity index 100% rename from lib/include/support/srsran_assert.h rename to lib/include/srsran/support/srsran_assert.h diff --git a/lib/include/srsran/support/srsran_test.h b/lib/include/srsran/support/srsran_test.h new file mode 100644 index 000000000..c247c69af --- /dev/null +++ b/lib/include/srsran/support/srsran_test.h @@ -0,0 +1,64 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#ifndef SRSRAN_SRSRAN_TEST_H +#define SRSRAN_SRSRAN_TEST_H + +#ifdef __cplusplus + +#include "srsran_assert.h" + +namespace srsran { +namespace detail { + +template +[[gnu::noinline, noreturn]] void assert_eq_failure(const T& expected_val, const U& actual_val) +{ + std::string s = fmt::format("Actual value '{}' differs from expected '{}'", actual_val, expected_val); + srsran_assertion_failure("%s", s.c_str()); +} + +template +[[gnu::noinline, noreturn]] void assert_neq_failure(const T& actual_val) +{ + std::string s = fmt::format("Value should not be equal to '{}'", actual_val); + srsran_assertion_failure("%s", s.c_str()); +} + +} // namespace detail +} // namespace srsran + +#define TESTASSERT_EQ(EXPECTED, ACTUAL) \ + (void)((EXPECTED == ACTUAL) || (::srsran::detail::assert_eq_failure(EXPECTED, ACTUAL), 0)) + +#define TESTASSERT_NEQ(EXPECTED, ACTUAL) \ + (void)((EXPECTED != ACTUAL) || (::srsran::detail::assert_neq_failure(ACTUAL), 0)) + +#define TESTASSERT(cond) srsran_assert((cond), "Fail at \"%s\"", (#cond)) + +#define TESTASSERT_SUCCESS(cond) srsran_assert((cond == SRSRAN_SUCCESS), "Operation \"%s\" was not successful", (#cond)) + +#else // __cplusplus + +#include + +#define TESTASSERT(cond) \ + do { \ + if (!(cond)) { \ + printf("[%s][Line %d] Fail at \"%s\"\n", __FUNCTION__, __LINE__, (#cond)); \ + return -1; \ + } \ + } while (0) + +#endif // __cplusplus + +#endif // SRSRAN_SRSRAN_TEST_H diff --git a/lib/src/phy/ch_estimation/test/chest_test_srs.c b/lib/src/phy/ch_estimation/test/chest_test_srs.c index 8867cb484..3fa7acb6e 100644 --- a/lib/src/phy/ch_estimation/test/chest_test_srs.c +++ b/lib/src/phy/ch_estimation/test/chest_test_srs.c @@ -10,8 +10,8 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/srsran.h" +#include "srsran/support/srsran_test.h" #include #include #include diff --git a/lib/src/phy/ch_estimation/test/csi_rs_pattern_test.c b/lib/src/phy/ch_estimation/test/csi_rs_pattern_test.c index 2bd11ff82..6e63edd7f 100644 --- a/lib/src/phy/ch_estimation/test/csi_rs_pattern_test.c +++ b/lib/src/phy/ch_estimation/test/csi_rs_pattern_test.c @@ -10,8 +10,8 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/phy/ch_estimation/csi_rs.h" +#include "srsran/support/srsran_test.h" static srsran_carrier_nr_t carrier = {}; diff --git a/lib/src/phy/ch_estimation/test/csi_rs_test.c b/lib/src/phy/ch_estimation/test/csi_rs_test.c index ea96b06d1..cdd89f66c 100644 --- a/lib/src/phy/ch_estimation/test/csi_rs_test.c +++ b/lib/src/phy/ch_estimation/test/csi_rs_test.c @@ -10,9 +10,9 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/phy/ch_estimation/csi_rs.h" #include "srsran/phy/utils/vector.h" +#include "srsran/support/srsran_test.h" #include #include #include diff --git a/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c b/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c index 52b5033ff..03e8b7818 100644 --- a/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c +++ b/lib/src/phy/ch_estimation/test/dmrs_pdcch_test.c @@ -10,9 +10,9 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/phy/ch_estimation/dmrs_pdcch.h" #include "srsran/phy/phch/pdcch_nr.h" +#include "srsran/support/srsran_test.h" #include #include #include diff --git a/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c b/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c index af2f8f39c..4a8b55b83 100644 --- a/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c +++ b/lib/src/phy/ch_estimation/test/dmrs_pdsch_test.c @@ -10,10 +10,10 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/phy/ch_estimation/dmrs_sch.h" #include "srsran/phy/phch/ra_dl_nr.h" #include "srsran/srsran.h" +#include "srsran/support/srsran_test.h" #include #include #include diff --git a/lib/src/phy/fec/block/test/block_test.c b/lib/src/phy/fec/block/test/block_test.c index 470095536..a4985d41f 100644 --- a/lib/src/phy/fec/block/test/block_test.c +++ b/lib/src/phy/fec/block/test/block_test.c @@ -9,10 +9,10 @@ * the distribution. * */ -#include "srsran/common/test_common.h" #include "srsran/phy/fec/block/block.h" #include "srsran/phy/utils/debug.h" #include "srsran/phy/utils/random.h" +#include "srsran/support/srsran_test.h" #include #include #include diff --git a/lib/src/phy/fec/polar/test/polar_interleaver_test.c b/lib/src/phy/fec/polar/test/polar_interleaver_test.c index ad50d2fdf..1a16638cb 100644 --- a/lib/src/phy/fec/polar/test/polar_interleaver_test.c +++ b/lib/src/phy/fec/polar/test/polar_interleaver_test.c @@ -11,8 +11,8 @@ */ #include "polar_interleaver_gold.h" -#include "srsran/common/test_common.h" #include "srsran/phy/fec/polar/polar_interleaver.h" +#include "srsran/support/srsran_test.h" int main(int argc, char** argv) { diff --git a/lib/src/phy/phch/test/dci_nr_test.c b/lib/src/phy/phch/test/dci_nr_test.c index d808cf597..8cd92f864 100644 --- a/lib/src/phy/phch/test/dci_nr_test.c +++ b/lib/src/phy/phch/test/dci_nr_test.c @@ -10,10 +10,10 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/phy/phch/dci_nr.h" #include "srsran/phy/utils/debug.h" #include "srsran/phy/utils/random.h" +#include "srsran/support/srsran_test.h" #include static uint32_t nof_repetitions = 1024; diff --git a/lib/src/phy/utils/test/re_pattern_test.c b/lib/src/phy/utils/test/re_pattern_test.c index ffed8bfb7..c283e9056 100644 --- a/lib/src/phy/utils/test/re_pattern_test.c +++ b/lib/src/phy/utils/test/re_pattern_test.c @@ -10,8 +10,8 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/phy/utils/re_pattern.h" +#include "srsran/support/srsran_test.h" int main(int argc, char** argv) { diff --git a/lib/src/phy/utils/test/ring_buffer_test.c b/lib/src/phy/utils/test/ring_buffer_test.c index 8410d5033..8f8dda5b3 100644 --- a/lib/src/phy/utils/test/ring_buffer_test.c +++ b/lib/src/phy/utils/test/ring_buffer_test.c @@ -10,7 +10,7 @@ * */ -#include "srsran/common/test_common.h" +#include "srsran/support/srsran_test.h" #include #include #include diff --git a/lib/test/adt/bounded_vector_test.cc b/lib/test/adt/bounded_vector_test.cc index edc471bd5..ec87c7c49 100644 --- a/lib/test/adt/bounded_vector_test.cc +++ b/lib/test/adt/bounded_vector_test.cc @@ -11,7 +11,7 @@ */ #include "srsran/adt/bounded_vector.h" -#include "srsran/common/test_common.h" +#include "srsran/support/srsran_test.h" namespace srsran { @@ -52,7 +52,7 @@ struct moveonly { moveonly& operator=(moveonly&&) noexcept = default; }; -int test_ctor() +void test_ctor() { // TEST: default ctor bounded_vector a; @@ -88,11 +88,9 @@ int test_ctor() bounded_vector a6(std::move(a5)); TESTASSERT(a6.size() == 7); TESTASSERT(a5.size() == 0); - - return SRSRAN_SUCCESS; } -int test_obj_add_rem() +void test_obj_add_rem() { // TEST: push_back / emplace_back bounded_vector a; @@ -154,11 +152,9 @@ int test_obj_add_rem() a2.clear(); a = std::move(a2); TESTASSERT(a.empty() and a2.empty()); - - return SRSRAN_SUCCESS; } -int test_move_only_type() +void test_move_only_type() { bounded_vector a(5); TESTASSERT(a.size() == 5); @@ -175,24 +171,21 @@ int test_move_only_type() a2.push_back(moveonly()); TESTASSERT(a2.size() == 7); - - return SRSRAN_SUCCESS; } -int assert_dtor_consistency() +void assert_dtor_consistency() { TESTASSERT(C::nof_dtor == C::nof_copy_ctor + C::nof_value_ctor + C::nof_move_ctor); - return SRSRAN_SUCCESS; } } // namespace srsran int main() { - TESTASSERT(srsran::test_ctor() == SRSRAN_SUCCESS); - TESTASSERT(srsran::test_obj_add_rem() == SRSRAN_SUCCESS); - TESTASSERT(srsran::test_move_only_type() == SRSRAN_SUCCESS); - TESTASSERT(srsran::assert_dtor_consistency() == SRSRAN_SUCCESS); + srsran::test_ctor(); + srsran::test_obj_add_rem(); + srsran::test_move_only_type(); + srsran::assert_dtor_consistency(); printf("Success\n"); return 0; } \ No newline at end of file diff --git a/lib/test/common/timer_test.cc b/lib/test/common/timer_test.cc index c1f265272..24e8e9656 100644 --- a/lib/test/common/timer_test.cc +++ b/lib/test/common/timer_test.cc @@ -10,8 +10,8 @@ * */ -#include "srsran/common/test_common.h" #include "srsran/common/timers.h" +#include "srsran/support/srsran_test.h" #include #include #include @@ -21,7 +21,7 @@ using namespace srsran; static_assert(timer_handler::max_timer_duration() == 1073741823, "Invalid max duration"); -int timers_test1() +void timers_test1() { timer_handler timers; uint32_t dur = 5; @@ -110,8 +110,6 @@ int timers_test1() } // TEST: timer dtor is called and removes "timer" from "timers" TESTASSERT(timers.nof_timers() == 0); - - return SRSRAN_SUCCESS; } /** @@ -119,7 +117,7 @@ int timers_test1() * - calling stop() early, forbids the timer from getting expired * - calling stop() after timer has expired should be a noop */ -int timers_test2() +void timers_test2() { timer_handler timers; uint32_t duration = 2; @@ -145,15 +143,13 @@ int timers_test2() // TEST 2: call utimer.stop() after it expires and assert it is still expired utimer2.stop(); TESTASSERT(utimer2.is_expired()); - - return SRSRAN_SUCCESS; } /** * Description: * - setting a new duration while the timer is already running should not stop timer, and should extend timeout */ -int timers_test3() +void timers_test3() { timer_handler timers; uint32_t duration = 5; @@ -176,8 +172,6 @@ int timers_test3() } timers.step_all(); TESTASSERT(not utimer.is_running() and utimer.is_expired()); - - return SRSRAN_SUCCESS; } struct timers_test4_ctxt { @@ -218,7 +212,7 @@ static void timers2_test4_thread(timers_test4_ctxt* ctx) } } -int timers_test4() +void timers_test4() { timer_handler timers; timers_test4_ctxt ctx; @@ -295,14 +289,12 @@ int timers_test4() for (uint32_t i = 0; i < nof_timers; i++) { TESTASSERT(not ctx.timers[i].is_running()); } - - return SRSRAN_SUCCESS; } /** * Description: Delaying a callback using the timer_handler */ -int timers_test5() +void timers_test5() { timer_handler timers; TESTASSERT(timers.nof_timers() == 0); @@ -354,14 +346,12 @@ int timers_test5() TESTASSERT(timers.nof_timers() == 1); TESTASSERT(vals.size() == 3); TESTASSERT(vals[2] == 3); - - return SRSRAN_SUCCESS; } /** * Description: Check if erasure of a running timer is safe */ -int timers_test6() +void timers_test6() { timer_handler timers; @@ -399,8 +389,6 @@ int timers_test6() // TEST: The second timer's callback should be the one being called, and should be called only once timers.step_all(); TESTASSERT(vals.size() == 1 and vals[0] == 3); - - return SRSRAN_SUCCESS; } /** @@ -408,7 +396,7 @@ int timers_test6() * - check if timer update is safe when its new updated wheel position matches the previous wheel position * - multime timers can exist in the same wheel position */ -int timers_test7() +void timers_test7() { timer_handler timers; size_t wheel_size = timer_handler::get_wheel_size(); @@ -449,19 +437,17 @@ int timers_test7() TESTASSERT(not t2.is_expired() and t2.is_running()); TESTASSERT(t3.is_expired() and not t3.is_running()); TESTASSERT(timers.nof_running_timers() == 1 and timers.nof_timers() == 3); - - return SRSRAN_SUCCESS; } int main() { - TESTASSERT(timers_test1() == SRSRAN_SUCCESS); - TESTASSERT(timers_test2() == SRSRAN_SUCCESS); - TESTASSERT(timers_test3() == SRSRAN_SUCCESS); - TESTASSERT(timers_test4() == SRSRAN_SUCCESS); - TESTASSERT(timers_test5() == SRSRAN_SUCCESS); - TESTASSERT(timers_test6() == SRSRAN_SUCCESS); - TESTASSERT(timers_test7() == SRSRAN_SUCCESS); + timers_test1(); + timers_test2(); + timers_test3(); + timers_test4(); + timers_test5(); + timers_test6(); + timers_test7(); printf("Success\n"); return 0; } diff --git a/lib/test/common/tti_point_test.cc b/lib/test/common/tti_point_test.cc index 71c98ed00..145d39c4a 100644 --- a/lib/test/common/tti_point_test.cc +++ b/lib/test/common/tti_point_test.cc @@ -11,12 +11,12 @@ */ #include "srsran/common/slot_point.h" -#include "srsran/common/test_common.h" #include "srsran/common/tti_point.h" +#include "srsran/support/srsran_test.h" using srsran::tti_point; -int test_tti_type() +void test_tti_type() { // TEST: constructors tti_point tti1; @@ -63,8 +63,6 @@ int test_tti_type() TESTASSERT(tti_point{1u - 2u} == tti_point{10239}); TESTASSERT(tti_point{1u - 100u} == tti_point{10141}); TESTASSERT(tti_point{10239u + 3u} == tti_point{2}); - - return SRSRAN_SUCCESS; } void test_nr_slot_type() diff --git a/srsenb/hdr/stack/mac/sched_phy_ch/sched_phy_resource.h b/srsenb/hdr/stack/mac/sched_phy_ch/sched_phy_resource.h index 8e218b3da..7729bfbd7 100644 --- a/srsenb/hdr/stack/mac/sched_phy_ch/sched_phy_resource.h +++ b/srsenb/hdr/stack/mac/sched_phy_ch/sched_phy_resource.h @@ -15,7 +15,7 @@ #include "srsran/adt/bounded_bitset.h" #include "srsran/adt/interval.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" extern "C" { #include "srsran/phy/phch/ra.h" } diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 6ac359cae..ddaab20cc 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -22,7 +22,7 @@ #include "srsran/interfaces/enb_pdcp_interfaces.h" #include "srsran/interfaces/enb_rlc_interfaces.h" #include "srsran/interfaces/enb_s1ap_interfaces.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" using namespace asn1::rrc; diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index 0f105cf03..63c5ca35e 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -17,7 +17,7 @@ #include "srsran/common/string_helpers.h" #include "srsran/interfaces/enb_interfaces.h" #include "srsran/interfaces/enb_pdcp_interfaces.h" -#include "support/srsran_assert.h" +#include "srsran/support/srsran_assert.h" #include #include diff --git a/srsenb/test/mac/sched_dci_test.cc b/srsenb/test/mac/sched_dci_test.cc index d9c589d21..c96d60fb8 100644 --- a/srsenb/test/mac/sched_dci_test.cc +++ b/srsenb/test/mac/sched_dci_test.cc @@ -14,7 +14,7 @@ #include "srsenb/hdr/stack/mac/sched_lte_common.h" #include "srsenb/hdr/stack/mac/sched_phy_ch/sched_dci.h" #include "srsran/common/common_lte.h" -#include "srsran/common/test_common.h" +#include "srsran/support/srsran_test.h" namespace srsenb { @@ -251,7 +251,7 @@ int test_min_mcs_tbs_specific() CONDERROR(result.tbs_bytes * 8 != 120, "Invalid min TBS calculation"); args.req_bytes = 50; - TESTASSERT(test_min_mcs_tbs_dl_helper(cell_params, args, &result) == SRSRAN_SUCCESS); + TESTASSERT_SUCCESS(test_min_mcs_tbs_dl_helper(cell_params, args, &result)); CONDERROR(result.tbs_bytes < (int)args.req_bytes, "Invalid MCS calculation"); CONDERROR(result.tbs_bytes * 8 != 424, "Invalid min TBS calculation"); @@ -264,7 +264,7 @@ int test_min_mcs_tbs_specific() // Check equality case args.req_bytes = 109; - TESTASSERT(test_min_mcs_tbs_dl_helper(cell_params, args, &result) == SRSRAN_SUCCESS); + TESTASSERT_SUCCESS(test_min_mcs_tbs_dl_helper(cell_params, args, &result)); CONDERROR(result.tbs_bytes < (int)args.req_bytes, "Invalid MCS calculation"); CONDERROR(result.tbs_bytes * 8 != 872, "Invalid min TBS calculation"); @@ -294,18 +294,18 @@ void test_ul_mcs_tbs_derivation() }; cqi = 0; - TESTASSERT(compute_tbs_mcs(25, 25 - 4).mcs == 0); - TESTASSERT(compute_tbs_mcs(50, 50 - 5).mcs == 0); + TESTASSERT_EQ(0, compute_tbs_mcs(25, 25 - 4).mcs); + TESTASSERT_EQ(0, compute_tbs_mcs(50, 50 - 5).mcs); cqi = 5; - TESTASSERT(compute_tbs_mcs(25, 25 - 4).mcs == 9); - TESTASSERT(compute_tbs_mcs(50, 50 - 5).mcs == 9); + TESTASSERT_EQ(9, compute_tbs_mcs(25, 25 - 4).mcs); + TESTASSERT_EQ(9, compute_tbs_mcs(50, 50 - 5).mcs); cqi = 15; - TESTASSERT(compute_tbs_mcs(25, 25 - 4).mcs == 23); - TESTASSERT(compute_tbs_mcs(50, 50 - 5).mcs == 23); - TESTASSERT(compute_tbs_mcs(75, 75 - 5).mcs == 24); - TESTASSERT(compute_tbs_mcs(100, 100 - 5).mcs == 23); + TESTASSERT_EQ(23, compute_tbs_mcs(25, 25 - 4).mcs); + TESTASSERT_EQ(23, compute_tbs_mcs(50, 50 - 5).mcs); + TESTASSERT_EQ(24, compute_tbs_mcs(75, 75 - 5).mcs); + TESTASSERT_EQ(23, compute_tbs_mcs(100, 100 - 5).mcs); } } // namespace srsenb diff --git a/srsue/src/stack/mac/test/mac_test.cc b/srsue/src/stack/mac/test/mac_test.cc index 1d8b90f88..9b8f677e5 100644 --- a/srsue/src/stack/mac/test/mac_test.cc +++ b/srsue/src/stack/mac/test/mac_test.cc @@ -13,8 +13,8 @@ #include "srsran/asn1/rrc/rr_common.h" #include "srsran/asn1/rrc_utils.h" #include "srsran/common/mac_pcap.h" -#include "srsran/common/test_common.h" #include "srsran/common/tsan_options.h" +#include "srsran/support/srsran_test.h" #include "srsran/test/ue_test_interfaces.h" #include "srsue/hdr/stack/mac/mac.h" #include "srsue/hdr/stack/mac/mux.h" diff --git a/srsue/src/stack/upper/test/nas_test.cc b/srsue/src/stack/upper/test/nas_test.cc index edbc5e72a..a69d96fdb 100644 --- a/srsue/src/stack/upper/test/nas_test.cc +++ b/srsue/src/stack/upper/test/nas_test.cc @@ -11,10 +11,10 @@ */ #include "srsran/common/bcd_helpers.h" -#include "srsran/common/test_common.h" #include "srsran/common/tsan_options.h" #include "srsran/interfaces/ue_pdcp_interfaces.h" #include "srsran/srslog/srslog.h" +#include "srsran/support/srsran_test.h" #include "srsran/test/ue_test_interfaces.h" #include "srsue/hdr/stack/upper/gw.h" #include "srsue/hdr/stack/upper/nas.h" diff --git a/srsue/src/stack/upper/test/usim_test.cc b/srsue/src/stack/upper/test/usim_test.cc index ed4300fb7..2fe576d2b 100644 --- a/srsue/src/stack/upper/test/usim_test.cc +++ b/srsue/src/stack/upper/test/usim_test.cc @@ -10,7 +10,7 @@ * */ -#include "srsran/common/test_common.h" +#include "srsran/support/srsran_test.h" #include "srsue/hdr/stack/upper/usim.h" using namespace srsue;