5G-LENA nr-v3.3-120-gdac69c56
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-test-sfnsf.cc
1// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#include "ns3/sfnsf.h"
6#include "ns3/test.h"
7
16namespace ns3
17{
18
19class TestSfnSfTestCase : public TestCase
20{
21 public:
22 TestSfnSfTestCase(uint16_t num, const std::string& name)
23 : TestCase(name),
24 m_numerology(num)
25 {
26 }
27
28 private:
29 void DoRun() override;
30 uint16_t m_numerology{0};
31};
32
33void
34TestSfnSfTestCase::DoRun()
35{
36 SfnSf sfn(0, 0, 0, m_numerology);
37
38 for (uint32_t i = 0; i < 9999; ++i)
39 {
40 NS_TEST_ASSERT_MSG_EQ(sfn.Normalize(), i, "Mm");
41 sfn.Add(1);
42 }
43}
44
45class TestSfnSf : public TestSuite
46{
47 public:
48 TestSfnSf()
49 : TestSuite("nr-test-sfnsf", Type::UNIT)
50 {
51 AddTestCase(new TestSfnSfTestCase(0, "SfnSf TestAdd with num 2"), Duration::QUICK);
52 AddTestCase(new TestSfnSfTestCase(1, "SfnSf TestAdd with num 2"), Duration::QUICK);
53 AddTestCase(new TestSfnSfTestCase(2, "SfnSf TestAdd with num 2"), Duration::QUICK);
54 AddTestCase(new TestSfnSfTestCase(3, "SfnSf TestAdd with num 2"), Duration::QUICK);
55 AddTestCase(new TestSfnSfTestCase(4, "SfnSf TestAdd with num 2"), Duration::QUICK);
56 }
57};
58
59static TestSfnSf testSfnSf;
60
61} // namespace ns3