A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
time-test-suite.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 * Copyright (c) 2007 Emmanuelle Laprise
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8 * TimeStep support by Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
9 */
10
11#include "ns3/int64x64.h"
12#include "ns3/nstime.h"
13#include "ns3/test.h"
14#include "ns3/time-span.h"
15
16#include <array>
17#include <cstdint>
18#include <iomanip>
19#include <iostream>
20#include <sstream>
21#include <string>
22#include <tuple>
23
24using namespace ns3;
25
26/**
27 * @ingroup core-tests
28 * @brief time simple test case, Checks the basic operations on time
29 */
31{
32 public:
33 /**
34 * @brief constructor for TimeSimpleTestCase.
35 */
37
38 private:
39 /**
40 * @brief setup function for TimeSimpleTestCase.
41 */
42 void DoSetup() override;
43
44 /**
45 * @brief Runs the Simple Time test case.
46 */
47 void DoRun() override;
48
49 /**
50 * @brief Tests the Time Operations.
51 */
52 virtual void DoTimeOperations();
53
54 /**
55 * @brief Does the tear down for TimeSimpleTestCase.
56 */
57 void DoTeardown() override;
58
59 /**
60 * Helper function to handle boilerplate code for multiplication tests
61 *
62 * @tparam T type of multiplication value
63 *
64 * @param t Time value to multiply
65 * @param expected Expected result of the multiplication
66 * @param val Value to multiply by
67 * @param msg Error message to print if test fails
68 */
69 template <typename T>
70 void TestMultiplication(Time t, Time expected, T val, const std::string& msg);
71
72 /**
73 * Test multiplying a Time instance by various integer types
74 */
76
77 /**
78 * Test multiplying a Time instance by various decimal types
79 */
81
82 /**
83 * Helper function to handle boilerplate code for division tests
84 *
85 * @tparam T type of division value
86 *
87 * @param t Time value to divide
88 * @param expected Expected result of the division
89 * @param val Value to divide by
90 * @param msg Error message to print if test fails
91 */
92 template <typename T>
93 void TestDivision(Time t, Time expected, T val, const std::string& msg);
94
95 /**
96 * Test dividing a Time instance by various integer types
97 */
99
100 /**
101 * Test dividing a Time instance by various decimal types
102 */
104};
105
107 : TestCase("Sanity check of common time operations")
108{
109}
110
111void
115
116void
118{
119 // Test Multiplication
120 constexpr long long oneSec = 1000000000; // conversion to default nanoseconds
121
122 // Time in seconds
123 ns3::Time t1 = Time(125LL * oneSec);
124 ns3::Time t2 = Time(2000LL * oneSec);
125
126 std::cout << "Testing Time Subtraction \n";
127
128 NS_TEST_ASSERT_MSG_EQ((t2 - t1).GetSeconds(), 1875, "Time Subtraction");
129
130 // Test Multiplication Operations:
131 std::cout << "Testing Time Multiplication \n";
132
135
136 // Test Division Operations:
137 std::cout << "Testing Time Division \n";
138
141
142 std::cout << "Testing modulo division \n";
143
144 t1 = Time(101LL * oneSec);
145 NS_TEST_ASSERT_MSG_EQ((t2 % t1).GetSeconds(), 81, "Remainder Operation (2000 % 101 = 81)");
146 NS_TEST_ASSERT_MSG_EQ(Div(t2, t1), 19, "Modular Division");
147 NS_TEST_ASSERT_MSG_EQ(Rem(t2, t1).GetSeconds(), 81, "Remainder Operation (2000 % 101 = 81)");
148}
149
150void
152{
153 NS_TEST_ASSERT_MSG_EQ_TOL(Years(1.0).GetYears(), 1.0, Years(1).GetYears(), "is 1 really 1 ?");
154 NS_TEST_ASSERT_MSG_EQ_TOL(Years(10.0).GetYears(),
155 10.0,
156 Years(1).GetYears(),
157 "is 10 really 10 ?");
158 NS_TEST_ASSERT_MSG_EQ_TOL(Days(1.0).GetDays(), 1.0, Days(1).GetDays(), "is 1 really 1 ?");
159 NS_TEST_ASSERT_MSG_EQ_TOL(Days(10.0).GetDays(), 10.0, Days(1).GetDays(), "is 10 really 10 ?");
160 NS_TEST_ASSERT_MSG_EQ_TOL(Hours(1.0).GetHours(), 1.0, Hours(1).GetHours(), "is 1 really 1 ?");
161 NS_TEST_ASSERT_MSG_EQ_TOL(Hours(10.0).GetHours(),
162 10.0,
163 Hours(1).GetHours(),
164 "is 10 really 10 ?");
165 NS_TEST_ASSERT_MSG_EQ_TOL(Minutes(1.0).GetMinutes(),
166 1.0,
167 Minutes(1).GetMinutes(),
168 "is 1 really 1 ?");
169 NS_TEST_ASSERT_MSG_EQ_TOL(Minutes(10.0).GetMinutes(),
170 10.0,
171 Minutes(1).GetMinutes(),
172 "is 10 really 10 ?");
173 NS_TEST_ASSERT_MSG_EQ_TOL(Seconds(1).GetSeconds(),
174 1.0,
175 TimeStep(1).GetSeconds(),
176 "is 1 really 1 ?");
177 NS_TEST_ASSERT_MSG_EQ_TOL(Seconds(10).GetSeconds(),
178 10.0,
179 TimeStep(1).GetSeconds(),
180 "is 10 really 10 ?");
181 NS_TEST_ASSERT_MSG_EQ(MilliSeconds(1).GetMilliSeconds(), 1, "is 1ms really 1ms ?");
182 NS_TEST_ASSERT_MSG_EQ(MicroSeconds(1).GetMicroSeconds(), 1, "is 1us really 1us ?");
183
185
186#if 0
187 Time ns = NanoSeconds (1);
188 ns.GetNanoSeconds ();
189 NS_TEST_ASSERT_MSG_EQ (NanoSeconds (1).GetNanoSeconds (), 1,
190 "is 1ns really 1ns ?");
191 NS_TEST_ASSERT_MSG_EQ (PicoSeconds (1).GetPicoSeconds (), 1,
192 "is 1ps really 1ps ?");
193 NS_TEST_ASSERT_MSG_EQ (FemtoSeconds (1).GetFemtoSeconds (), 1,
194 "is 1fs really 1fs ?");
195#endif
196
197 Time ten = NanoSeconds(10);
198 int64_t tenValue = ten.GetInteger();
200 int64_t tenKValue = ten.GetInteger();
201 NS_TEST_ASSERT_MSG_EQ(tenValue * 1000, tenKValue, "change resolution to PS");
202}
203
204void
208
209template <typename T>
210void
211TimeSimpleTestCase::TestMultiplication(Time t, Time expected, T val, const std::string& msg)
212
213{
214 using TestEntry = std::tuple<Time, std::string>;
215 std::array<TestEntry, 2> TESTS{std::make_tuple(t * val, "Test Time * value: "),
216 std::make_tuple(val * t, "Test Time * value: ")};
217
218 for (auto test : TESTS)
219 {
220 std::string errMsg = std::get<1>(test) + msg;
221
222 NS_TEST_ASSERT_MSG_EQ(std::get<0>(test), expected, errMsg);
223 }
224}
225
226void
228{
229 int sec = 125;
230 int scale = 100;
231
232 Time t = Seconds(sec);
233 Time expected = Time(t.GetTimeStep() * scale);
234
235 TestMultiplication(t, expected, static_cast<char>(scale), "Multiplication by char");
237 expected,
238 static_cast<unsigned char>(scale),
239 "Multiplication by unsigned char");
240 TestMultiplication(t, expected, static_cast<short>(scale), "Multiplication by short");
242 expected,
243 static_cast<unsigned short>(scale),
244 "Multiplication by unsigned short");
245 TestMultiplication(t, expected, static_cast<int>(scale), "Multiplication by int");
247 expected,
248 static_cast<unsigned int>(scale),
249 "Multiplication by unsigned int");
250 TestMultiplication(t, expected, static_cast<long>(scale), "Multiplication by long");
252 expected,
253 static_cast<unsigned long>(scale),
254 "Multiplication by unsigned long");
255 TestMultiplication(t, expected, static_cast<long long>(scale), "Multiplication by long long");
257 expected,
258 static_cast<unsigned long long>(scale),
259 "Multiplication by unsigned long long");
260 TestMultiplication(t, expected, static_cast<std::size_t>(scale), "Multiplication by size_t");
261
262 int64x64_t scale64 = 100;
263 TestMultiplication(t, expected, scale64, "Multiplication by int64x64_t");
264}
265
266void
268{
269 float sec = 150.0;
270 float scale = 100.2;
271
272 Time t = Seconds(sec);
273 Time expected = Time(t.GetDouble() * scale);
274
275 TestMultiplication(t, expected, scale, "Multiplication by float");
276 TestMultiplication(t, expected, static_cast<double>(scale), "Multiplication by double");
277}
278
279template <typename T>
280void
281TimeSimpleTestCase::TestDivision(Time t, Time expected, T val, const std::string& msg)
282{
283 Time result = t / val;
284
285 NS_TEST_ASSERT_MSG_EQ(result, expected, msg);
286}
287
288void
290{
291 int sec = 2000;
292 int scale = 100;
293
294 Time t = Seconds(sec);
295 Time expected = Time(t.GetTimeStep() / scale);
296
297 TestDivision(t, expected, static_cast<char>(scale), "Division by char");
298 TestDivision(t, expected, static_cast<unsigned char>(scale), "Division by unsigned char");
299 TestDivision(t, expected, static_cast<short>(scale), "Division by short");
300 TestDivision(t, expected, static_cast<unsigned short>(scale), "Division by unsigned short");
301 TestDivision(t, expected, static_cast<int>(scale), "Division by int");
302 TestDivision(t, expected, static_cast<unsigned int>(scale), "Division by unsigned int");
303 TestDivision(t, expected, static_cast<long>(scale), "Division by long");
304 TestDivision(t, expected, static_cast<unsigned long>(scale), "Division by unsigned long");
305 TestDivision(t, expected, static_cast<long long>(scale), "Division by long long");
306 TestDivision(t,
307 expected,
308 static_cast<unsigned long long>(scale),
309 "Division by unsigned long long");
310 TestDivision(t, expected, static_cast<std::size_t>(scale), "Division by size_t");
311
312 int64x64_t scale64 = 100;
313 TestDivision(t, expected, scale64, "Division by int64x64_t");
314}
315
316void
318{
319 float sec = 200.0;
320 float scale = 0.2;
321
322 Time t = Seconds(sec);
323 Time expected = t / int64x64_t(scale);
324
325 TestDivision(t, expected, scale, "Division by float");
326 TestDivision(t, expected, static_cast<double>(scale), "Division by double");
327}
328
329/**
330 * @ingroup core-tests
331 * @brief time-tests Time with Sign test case
332 */
334{
335 public:
336 /**
337 * @brief constructor for TimeWithSignTestCase.
338 */
340
341 private:
342 /**
343 * @brief DoSetup for TimeWithSignTestCase.
344 */
345 void DoSetup() override;
346
347 /**
348 * @brief DoRun for TimeWithSignTestCase.
349 */
350 void DoRun() override;
351
352 /**
353 * @brief DoTeardown for TimeWithSignTestCase.
354 */
355 void DoTeardown() override;
356};
357
359 : TestCase("Checks times that have plus or minus signs")
360{
361}
362
363void
367
368void
370{
371 Time timePositive("+1000.0");
372 Time timePositiveWithUnits("+1000.0ms");
373
374 Time timeNegative("-1000.0");
375 Time timeNegativeWithUnits("-1000.0ms");
376
378 +1000.0,
379 1.0e-8,
380 "Positive time not parsed correctly.");
381
382 NS_TEST_ASSERT_MSG_EQ_TOL(timePositiveWithUnits.GetSeconds(),
383 +1.0,
384 1.0e-8,
385 "Positive time with units not parsed correctly.");
386
388 -1000.0,
389 1.0e-8,
390 "Negative time not parsed correctly.");
391
392 NS_TEST_ASSERT_MSG_EQ_TOL(timeNegativeWithUnits.GetSeconds(),
393 -1.0,
394 1.0e-8,
395 "Negative time with units not parsed correctly.");
396}
397
398void
402
403/**
404 * @ingroup core-tests
405 * @brief Input output Test Case for Time
406 */
408{
409 public:
410 /**
411 * @brief Constructor for TimeInputOutputTestCase.
412 */
414
415 private:
416 /**
417 * @brief DoRun for TimeInputOutputTestCase.
418 */
419 void DoRun() override;
420 /**
421 * @brief Check roundtrip from/to string.
422 * @param str Time input check.
423 */
424 void Check(const std::string& str);
425
426 /**
427 * @brief Check autoscaling output using Time::As()
428 * @param t Time instance.
429 * @param expect Expected string output with Time::As() autoscaling.
430 */
431 void CheckAs(const Time t, const std::string expect);
432};
433
435 : TestCase("Input,output from,to strings")
436{
437}
438
439void
440TimeInputOutputTestCase::Check(const std::string& str)
441{
442 std::stringstream ss(str);
443 Time time;
444 ss >> time;
445 ss << time;
446 bool pass = (str == ss.str());
447
448 std::cout << GetParent()->GetName() << " InputOutput: " << (pass ? "pass " : "FAIL ") << "\""
449 << str << "\"";
450 if (!pass)
451 {
452 std::cout << ", got " << ss.str();
453 }
454 std::cout << std::endl;
455 NS_TEST_EXPECT_MSG_EQ(ss.str(), str, "round trip conversion from/to string");
456}
457
458void
459TimeInputOutputTestCase::CheckAs(const Time t, const std::string expect)
460{
461 std::stringstream ss;
462 ss << std::fixed << std::setprecision(6) << t.As();
463 std::string str;
464 ss >> str;
465 bool pass = (str == expect);
466
467 std::cout << GetParent()->GetName() << " InputOutput:As: " << (pass ? "pass " : "FAIL ") << "\""
468 << expect << "\"";
469 if (!pass)
470 {
471 std::cout << ", got " << str;
472 }
473 std::cout << std::endl;
474 NS_TEST_EXPECT_MSG_EQ(str, expect, "Time::As() autoscaling");
475}
476
477void
479{
480 std::cout << std::endl;
481 std::cout << GetParent()->GetName() << " InputOutput: " << GetName() << std::endl;
482
483 Check("2ns");
484 Check("+3.1us");
485 Check("-4.2ms");
486 Check("5.3s");
487 Check("6.4min");
488 Check("7.5h");
489 Check("8.6d");
490 Check("10.8y");
491
492 Time t(3.141592654e9); // Pi seconds
493
494 std::cout << GetParent()->GetName() << " InputOutput: "
495 << "example: raw: " << t << std::endl;
496
497 std::cout << GetParent()->GetName() << " InputOutput: " << std::fixed << std::setprecision(9)
498 << "example: in s: " << t.As(Time::S) << std::endl;
499
500 std::cout << GetParent()->GetName() << " InputOutput: " << std::setprecision(6)
501 << "example: in ms: " << t.As(Time::MS) << std::endl;
502
503 std::cout << GetParent()->GetName() << " InputOutput: "
504 << "example: Get ns: " << t.GetNanoSeconds() << std::endl;
505
506 std::cout << GetParent()->GetName() << " InputOutput: "
507 << "example: auto scale: \n";
508 CheckAs(t * 1e-9, "+3.000000ns");
509 CheckAs(t * 1e-8, "+31.000000ns");
510 CheckAs(t * 1e-7, "+314.000000ns");
511 CheckAs(t * 1e-6, "+3.142000us");
512 CheckAs(t * 1e-5, "+31.416000us");
513 CheckAs(t * 1e-4, "+314.159000us");
514 CheckAs(t * 1e-3, "+3.141593ms");
515 CheckAs(t * 1e-2, "+31.415927ms");
516 CheckAs(t * 1e-1, "+314.159265ms");
517 CheckAs(t * 1e-0, "+3.141593s");
518 CheckAs(t * 1e+1, "+31.415927s");
519 CheckAs(t * 1e+2, "+5.235988min");
520 CheckAs(t * 1e+3, "+52.359878min");
521 CheckAs(t * 1e+4, "+8.726646h");
522 CheckAs(t * 1e+5, "+3.636103d");
523 CheckAs(t * 1e+6, "+36.361026d");
524 CheckAs(t * 1e+7, "+363.610261d");
525 CheckAs(t * 1e+8, "+9.961925y");
526
527 std::stringstream timeSpanStream{" { 50ms , 100ms } "};
528 TimeSpan timeSpan(Seconds(0), Seconds(0));
529 timeSpanStream >> timeSpan;
530 NS_TEST_EXPECT_MSG_EQ(timeSpan.Begin(), MilliSeconds(50), "Unexpected TimeSpan begin time");
531 NS_TEST_EXPECT_MSG_EQ(timeSpan.End(), MilliSeconds(100), "Unexpected TimeSpan end time");
532
533 std::stringstream timeSpanOutput;
534 timeSpanOutput << TimeSpan(NanoSeconds(50), NanoSeconds(100));
535 NS_TEST_EXPECT_MSG_EQ(timeSpanOutput.str(), "{+50ns, +100ns}", "Unexpected TimeSpan output");
536
537 TimeSpan timeSpanString(" { 50ms , 100ms } ");
538 NS_TEST_EXPECT_MSG_EQ(timeSpanString.Begin(),
539 MilliSeconds(50),
540 "Unexpected string TimeSpan begin time");
541 NS_TEST_EXPECT_MSG_EQ(timeSpanString.End(),
542 MilliSeconds(100),
543 "Unexpected string TimeSpan end time");
544
545 NS_TEST_EXPECT_MSG_EQ(timeSpan == timeSpanString, true, "Equivalent TimeSpan objects differ");
547 false,
548 "Different TimeSpan objects compare equal");
549}
550
551/**
552 * @ingroup core-tests
553 * @brief Checks that integer unit conversions whose result does not fit in
554 * int64_t wrap around in a well-defined (two's-complement) manner.
555 *
556 * Time::ToInteger() multiplies the raw value by an integer unit-conversion
557 * factor. When the mathematical result exceeds the range of int64_t, the
558 * operation must wrap around deterministically rather than invoke signed
559 * integer overflow, which is undefined behavior (and is trapped by the
560 * undefined-behavior sanitizer). This test pins down that wrapped result for
561 * both positive and negative times.
562 */
564{
565 public:
566 /**
567 * @brief Constructor for TimeToIntegerOverflowTestCase.
568 */
570
571 private:
572 /**
573 * @brief DoRun for TimeToIntegerOverflowTestCase.
574 */
575 void DoRun() override;
576};
577
579 : TestCase("Integer unit conversion overflow wraps without undefined behavior")
580{
581}
582
583void
585{
586 // GetFemtoSeconds() converts the stored value to femtoseconds by an integer
587 // multiplication. This test assumes a resolution coarser than femtoseconds
588 // (the default is nanoseconds) so that the value 10000 s is representable
589 // internally but its femtosecond count is not.
591 Time::FS,
592 "test precondition: resolution must be coarser than fs");
593
594 // 10000 s == 1e19 fs. That exceeds INT64_MAX (~9.22e18) but is below 2^64,
595 // so the femtosecond count cannot be represented exactly in the signed
596 // 64-bit return value and instead wraps around modulo 2^64. This documents
597 // the (intentional, well-defined) behavior of the integer Get*() accessors.
598 const uint64_t totalFemtos = 10000000000000000000ULL; // 1e19 fs, > INT64_MAX, < 2^64
599
600 // Positive time: +1e19 wraps to 1e19 - 2^64 == -8446744073709551616.
601 NS_TEST_ASSERT_MSG_EQ(Seconds(10000).GetFemtoSeconds(),
602 static_cast<int64_t>(totalFemtos),
603 "femtosecond overflow of a positive Time must wrap modulo 2^64");
604
605 // Negative time: -1e19 wraps to 2^64 - 1e19 == +8446744073709551616,
606 // confirming the sign is handled consistently by the wraparound.
607 NS_TEST_ASSERT_MSG_EQ(Seconds(-10000).GetFemtoSeconds(),
608 -static_cast<int64_t>(totalFemtos),
609 "femtosecond overflow of a negative Time must wrap modulo 2^64");
610}
611
612/**
613 * @ingroup core-tests
614 * @brief Time test Suite. Runs the appropriate test cases for time
615 */
616static class TimeTestSuite : public TestSuite
617{
618 public:
628}
629/** @brief Member variable for time test suite */
return result
Input output Test Case for Time.
TimeInputOutputTestCase()
Constructor for TimeInputOutputTestCase.
void DoRun() override
DoRun for TimeInputOutputTestCase.
void CheckAs(const Time t, const std::string expect)
Check autoscaling output using Time::As().
void Check(const std::string &str)
Check roundtrip from/to string.
time simple test case, Checks the basic operations on time
void DoTeardown() override
Does the tear down for TimeSimpleTestCase.
virtual void DoTimeOperations()
Tests the Time Operations.
void DoSetup() override
setup function for TimeSimpleTestCase.
void TestMultiplicationByDecimalTypes()
Test multiplying a Time instance by various decimal types.
void TestMultiplicationByIntegerTypes()
Test multiplying a Time instance by various integer types.
TimeSimpleTestCase()
constructor for TimeSimpleTestCase.
void DoRun() override
Runs the Simple Time test case.
void TestDivisionByIntegerTypes()
Test dividing a Time instance by various integer types.
void TestDivision(Time t, Time expected, T val, const std::string &msg)
Helper function to handle boilerplate code for division tests.
void TestDivisionByDecimalTypes()
Test dividing a Time instance by various decimal types.
void TestMultiplication(Time t, Time expected, T val, const std::string &msg)
Helper function to handle boilerplate code for multiplication tests.
Checks that integer unit conversions whose result does not fit in int64_t wrap around in a well-defin...
void DoRun() override
DoRun for TimeToIntegerOverflowTestCase.
TimeToIntegerOverflowTestCase()
Constructor for TimeToIntegerOverflowTestCase.
time-tests Time with Sign test case
void DoTeardown() override
DoTeardown for TimeWithSignTestCase.
void DoSetup() override
DoSetup for TimeWithSignTestCase.
void DoRun() override
DoRun for TimeWithSignTestCase.
TimeWithSignTestCase()
constructor for TimeWithSignTestCase.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:296
@ QUICK
Fast test.
Definition test.h:1057
TestCase * GetParent() const
Get the parent of this TestCase.
Definition test.cc:378
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
std::string GetName() const
Definition test.cc:371
Type
Type of test.
Definition test.h:1271
@ UNIT
This test suite implements a Unit Test.
Definition test.h:1273
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Definition test.cc:494
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:413
@ PS
picosecond
Definition nstime.h:110
@ FS
femtosecond
Definition nstime.h:111
@ MS
millisecond
Definition nstime.h:107
@ S
second
Definition nstime.h:106
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:422
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:398
static Unit GetResolution()
Definition time.cc:415
Time TimeStep(uint64_t ts)
Scheduler interface.
Definition nstime.h:1410
int64_t GetInteger() const
Get the raw time value, in the current resolution unit.
Definition nstime.h:450
static void SetResolution(Unit resolution)
Definition time.cc:214
double GetDouble() const
Get the raw time value, in the current resolution unit.
Definition nstime.h:445
int64_t GetTimeStep() const
Get the raw time value, in the current resolution unit.
Definition nstime.h:440
Class representing a period of time defined via a begin time and an end time.
Definition time-span.h:30
Time End() const
Definition time-span.cc:50
Time Begin() const
Definition time-span.cc:44
High precision numerical type, implementing Q64.64 fixed precision.
TimeTestSuite g_timeTestSuite
Member variable for time test suite.
int64_t Div(const Length &numerator, const Length &denominator, Length *remainder)
Calculate how many times numerator can be split into denominator sized pieces.
Definition length.cc:467
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition test.h:133
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:240
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Definition test.h:553
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition test.h:326
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1347
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1364
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1313
Time Days(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1272
Time Hours(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1284
Time PicoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1376
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1388
Time Minutes(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1296
Time Years(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1260
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1330
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time Rem(const Time &lhs, const Time &rhs)
Remainder (modulus) from the quotient of two Times.
Definition nstime.h:1115
-ns3 Test suite for the ns3 wrapper script