A Discrete-Event Network Simulator
API
int64x64-test-suite.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19
20#include "ns3/int64x64.h"
21#include "ns3/test.h"
22#include "ns3/valgrind.h" // Bug 1882
23
24#include <cmath> // fabs
25#include <iomanip>
26#include <limits> // numeric_limits<>::epsilon ()
27
28using namespace ns3;
29
30namespace ns3 {
31
32namespace int64x64 {
33
34namespace test {
35
61{
62public:
69 Printer (const int64_t high, const uint64_t low)
70 : m_haveInt (false),
71 m_value (0),
72 m_high (high),
73 m_low (low)
74 { }
75
81 Printer (const int64x64_t value)
82 : m_haveInt (true),
83 m_value (value),
84 m_high (value.GetHigh ()),
85 m_low (value.GetLow ())
86 { }
87
88private:
96 friend std::ostream & operator << (std::ostream & os, const Printer & p);
97
98 bool m_haveInt;
100 int64_t m_high;
101 uint64_t m_low;
102};
103
104std::ostream & operator << (std::ostream & os, const Printer & p)
105{
106 if (p.m_haveInt)
107 {
108 os << std::fixed << std::setprecision (22)
109 << p.m_value;
110
111 }
112
113 os << std::hex << std::setfill ('0')
114 << " (0x" << std::setw (16) << p.m_high
115 << " 0x" << std::setw (16) << p.m_low << ")"
116 << std::dec << std::setfill (' ');
117 return os;
118}
119
120
122{
123public:
125 virtual void DoRun (void);
126 void Check (const int64_t hi, const uint64_t lo);
127};
128
130 : TestCase ("Manipulate the high and low part of every number")
131{}
132
133void
134Int64x64HiLoTestCase::Check (const int64_t hi, const uint64_t lo)
135{
136 uint64_t tolerance = 0;
138 {
139 // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
140 tolerance = 1;
141 }
142
143 int64x64_t value = int64x64_t (hi,lo);
144 uint64_t vLow = value.GetLow ();
145 bool pass = ( (value.GetHigh () == hi)
146 && ( (Max (vLow, lo) - Min (vLow, lo)) <= tolerance)
147 );
148
149 std::cout << GetParent ()->GetName () << " Check: "
150 << (pass ? "pass " : "FAIL ")
151 << Printer (value) << " from" << Printer (hi, lo)
152 << std::endl;
153
154 NS_TEST_EXPECT_MSG_EQ (value.GetHigh (), hi,
155 "High part does not match for hi:" << hi
156 << " lo: " << lo);
157 NS_TEST_EXPECT_MSG_EQ_TOL ((int64_t)vLow, (int64_t)lo, (int64_t)tolerance,
158 "Low part does not match for hi: " << hi
159 << " lo: " << lo);
160}
161
162void
164{
165 std::cout << std::endl;
166 std::cout << GetParent ()->GetName () << " Check: " << GetName ()
167 << std::endl;
168
169 uint64_t low = 1;
171 {
172 // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
173 low = static_cast<uint64_t> (HP_MAX_64 * std::numeric_limits<long double>::epsilon ());
174 }
175
176 Check ( 0, 0);
177 Check ( 0, low);
178 Check ( 0, 0xffffffffffffffffULL - low);
179
180 Check ( 1, 0);
181 Check ( 1, low);
182 Check ( 1, 0xffffffffffffffffULL - low);
183
184 Check (-1, 0);
185 Check (-1, low);
186 Check (-1, 0xffffffffffffffffULL - low);
187}
188
189
191{
192public:
194 virtual void DoRun (void);
195 void Check (const int64x64_t value,
196 const int64_t expectInt,
197 const int64_t expectRnd);
198};
199
201 : TestCase ("Check GetInt and Round")
202{}
203
204void
206 const int64_t expectInt,
207 const int64_t expectRnd)
208{
209 int64_t vInt = value.GetInt ();
210 int64_t vRnd = value.Round ();
211
212 bool pass = (vInt == expectInt) && (vRnd == expectRnd);
213 std::cout << GetParent ()->GetName () << " Check: "
214 << (pass ? "pass " : "FAIL ")
215 << value
216 << " (int)-> " << std::setw (2) << vInt << " (expected: " << std::setw (2) << expectInt
217 << "), (rnd)-> " << std::setw (2) << vRnd << " (expected " << std::setw (2) << expectRnd
218 << ")"
219 << std::endl;
220
221 NS_TEST_EXPECT_MSG_EQ (vInt, expectInt,
222 "Truncation to int failed");
223 NS_TEST_EXPECT_MSG_EQ (vRnd, expectRnd,
224 "Rounding to int failed.");
225}
226
227void
229{
230 std::cout << std::endl;
231 std::cout << GetParent ()->GetName () << " Check: " << GetName ()
232 << std::endl;
233
234 // Trivial cases
235 Check ( 0, 0, 0);
236 Check ( 1, 1, 1);
237 Check (-1, -1, -1);
238
239 // Both should move toward zero
240 Check ( 2.4, 2, 2);
241 Check (-2.4, -2, -2);
242
243 // GetInt should move toward zero; Round should move away
244 Check ( 3.6, 3, 4);
245 Check (-3.6, -3, -4);
246 // Boundary case
247 Check ( 4.5, 4, 5);
248 Check (-4.5, -4, -5);
249}
250
251
253{
254public:
256 virtual void DoRun (void);
257 void Check (const std::string & str,
258 const int64_t hi, const uint64_t lo,
259 const int64_t tolerance = 0);
260};
262 : TestCase ("Parse int64x64_t numbers as strings")
263{}
264void
265Int64x64InputTestCase::Check (const std::string & str,
266 const int64_t hi, const uint64_t lo,
267 const int64_t tolerance /* = 0 */)
268
269{
270 std::istringstream iss;
271 iss.str (str);
272 int64x64_t value;
273 iss >> value;
274
275 std::string input = "\"" + str + "\"";
276 uint64_t vLow = value.GetLow ();
277 bool pass = ( (value.GetHigh () == hi)
278 && ( Max (vLow, lo) - Min (vLow, lo) <= tolerance)
279 );
280
281 std::cout << GetParent ()->GetName () << " Input: "
282 << (pass ? "pass " : "FAIL ")
283 << std::left << std::setw (28) << input << std::right
284 << Printer (value)
285 << " expected: " << Printer (hi, lo) << " +/- " << tolerance
286 << std::endl;
287
288 NS_TEST_EXPECT_MSG_EQ (value.GetHigh (), hi,
289 "High parts do not match for input string \""
290 << str << "\"");
291 NS_TEST_EXPECT_MSG_EQ_TOL ((int64_t)value.GetLow (), (int64_t)lo, tolerance,
292 "Low parts do not match for input string \""
293 << str << "\"");
294}
295void
297{
298 std::cout << std::endl;
299 std::cout << GetParent ()->GetName () << " Input: " << GetName ()
300 << std::endl;
301
302 int64_t tolerance = 0;
304 {
305 // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
306 tolerance = 2;
307 }
308
309 Check ("1", 1, 0);
310 Check ("+1", 1, 0);
311 Check ("-1", -1, 0);
312 Check ("1.0", 1, 0);
313 Check ("+1.0", 1, 0);
314 Check ("001.0", 1, 0);
315 Check ("+001.0", 1, 0);
316 Check ("020.0", 20, 0);
317 Check ("+020.0", 20, 0);
318 Check ("1.0000000", 1, 0);
319 Check ("-1.0", -1, 0, tolerance);
320 Check ("-1.0000", -1, 0, tolerance);
321 Check (" 1.000000000000000000054", 1, 1, tolerance);
322 Check ("-1.000000000000000000054", (int64_t)-2, (uint64_t)-1, tolerance);
323}
324
325
327{
328public:
330 virtual void DoRun (void);
331 void Check (const std::string & str,
332 const int64_t tolerance = 0);
333};
335 : TestCase ("Roundtrip int64x64_t numbers as strings")
336{}
337void
338Int64x64InputOutputTestCase::Check (const std::string & str,
339 const int64_t tolerance /* = 0 */)
340{
341 std::stringstream iss (str);
342 int64x64_t expect;
343 iss >> expect;
344
345 std::stringstream oss;
346 oss << std::scientific << std::setprecision (21) << expect;
347 int64x64_t value;
348 oss >> value;
349
350 bool pass = Abs (value - expect) <= int64x64_t (0, tolerance + 1);
351
352 std::string input = "\"" + str + "\"";
353 std::string output = "\"" + oss.str () + "\"";
354
355 if (pass)
356 {
357 std::cout << GetParent ()->GetName () << " InputOutput: "
358 << (pass ? "pass " : "FAIL ")
359 << " in: " << std::left << std::setw (28) << input
360 << " out: " << std::left << std::setw (28) << output
361 << std::right
362 << std::endl;
363 }
364 else
365 {
366 std::cout << GetParent ()->GetName () << " InputOutput: "
367 << (pass ? "pass " : "FAIL ")
368 << " in: " << std::left << std::setw (28) << input
369 << std::right << Printer (expect)
370 << std::endl;
371 std::cout << GetParent ()->GetName ()
372 << std::setw (19) << " "
373 << " out: " << std::left << std::setw (28) << output
374 << std::right << Printer (value)
375 << std::endl;
376 }
377
378 NS_TEST_EXPECT_MSG_EQ_TOL (value, expect, int64x64_t (0, tolerance),
379 "Converted string does not match expected string");
380}
381
382void
384{
385 std::cout << std::endl;
386 std::cout << GetParent ()->GetName () << " InputOutput: " << GetName ()
387 << std::endl;
388
389 int64_t tolerance = 0;
391 {
392 // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
393 tolerance = 1;
394 }
395
396 Check ("+1.000000000000000000000");
397 Check ("+20.000000000000000000000");
398 Check ("+0.000000000000000000000", tolerance);
399 Check ("-1.000000000000000000000", tolerance);
400 Check ("+1.084467440737095516158", tolerance);
401 Check ("-2.084467440737095516158", tolerance);
402 Check ("+3.184467440737095516179", tolerance);
403 Check ("-4.184467440737095516179", tolerance);
404}
405
406
408{
409public:
411 virtual void DoRun (void);
412 void Check (const int test,
413 const int64x64_t value, const int64x64_t expect);
414 void Check (const int test,
415 const int64x64_t value, const int64x64_t expect,
416 const int64x64_t tolerance);
417};
418
420 : TestCase ("Basic arithmetic operations")
421{}
422void
424 const int64x64_t value,
425 const int64x64_t expect)
426{
427 int64x64_t zero (0,0);
428 Check (test, value, expect, zero);
429}
430void
432 const int64x64_t value,
433 const int64x64_t expect,
434 const int64x64_t tolerance)
435{
436 bool pass = Abs (value - expect) <= tolerance;
437
438 std::cout << GetParent ()->GetName () << " Arithmetic: "
439 << (pass ? "pass " : "FAIL ")
440 << test << ": " << value << " == " << expect
441 << " (+/- " << tolerance << ")"
442 << std::endl;
443
444 NS_TEST_ASSERT_MSG_EQ_TOL ( value, expect, tolerance,
445 "Arithmetic failure in test case " << test);
446}
447
448void
450{
451 const int64x64_t tol1 (0, 1);
452 const int64x64_t zero (0, 0);
453 const int64x64_t one (1, 0);
454 const int64x64_t two (2, 0);
455 const int64x64_t thre (3, 0);
456
457 std::cout << std::endl;
458 std::cout << GetParent ()->GetName () << " Arithmetic: " << GetName ()
459 << std::endl;
460
461 Check ( 0, zero - zero, zero );
462 Check ( 1, zero - one, -one );
463 Check ( 2, one - one, zero );
464 Check ( 3, one - two, -one );
465 Check ( 4, one - (-one ), two );
466 Check ( 5, (-one ) - (-two ), one );
467 Check ( 6, (-one ) - two, -thre );
468
469 Check ( 7, zero + zero, zero );
470 Check ( 8, zero + one, one );
471 Check ( 9, one + one, two );
472 Check (10, one + two, thre );
473 Check (11, one + (-one ), zero );
474 Check (12, (-one ) + (-two ), -thre );
475 Check (13, (-one ) + two, one );
476
477 Check (14, zero * zero, zero );
478 Check (15, zero * one, zero );
479 Check (16, zero * (-one ), zero );
480 Check (17, one * one, one );
481 Check (18, one * (-one ), -one );
482 Check (19, (-one ) * (-one ), one );
483
484 Check (20, (two * thre ) / thre, two );
485
486 const int64x64_t frac = int64x64_t (0, 0xc000000000000000ULL); // 0.75
487 const int64x64_t fplf2 = frac + frac * frac; // 1.3125
488
489 Check (21, frac, 0.75);
490 Check (22, fplf2, 1.3125);
491
492 const int64x64_t zerof = zero + frac;
493 const int64x64_t onef = one + frac;
494 const int64x64_t twof = two + frac;
495 const int64x64_t thref = thre + frac;
496
497 Check (23, zerof, frac);
498
499
500 Check (24, zerof - zerof, zero );
501 Check (25, zerof - onef, -one );
502 Check (26, onef - onef, zero );
503 Check (27, onef - twof, -one );
504 Check (28, onef - (-onef), twof + frac );
505 Check (29, (-onef) - (-twof), one );
506 Check (30, (-onef) - twof, -thref - frac );
507
508 Check (31, zerof + zerof, zerof + frac );
509 Check (32, zerof + onef, onef + frac );
510 Check (33, onef + onef, twof + frac );
511 Check (34, onef + twof, thref + frac );
512 Check (35, onef + (-onef), zero );
513 Check (36, (-onef) + (-twof), -thref - frac );
514 Check (37, (-onef) + twof, one );
515
516 Check (38, zerof * zerof, frac * frac );
517 Check (39, zero * onef, zero );
518 Check (40, zerof * one, frac );
519
520 Check (41, zerof * onef, fplf2 );
521 Check (42, zerof * (-onef), -fplf2 );
522 Check (43, onef * onef, onef + fplf2 );
523 Check (44, onef * (-onef), -onef - fplf2 );
524 Check (45, (-onef) * (-onef), onef + fplf2 );
525
526
527 // Multiplication followed by division is exact:
528 Check (46, (two * thre ) / thre, two );
529 Check (47, (twof * thref) / thref, twof );
530
531 // Division followed by multiplication loses a bit or two:
532 Check (48, (two / thre) * thre, two, 2 * tol1 );
533 Check (49, (twof / thref) * thref, twof, 3 * tol1 );
534
535 // The example below shows that we really do not lose
536 // much precision internally: it is almost always the
537 // final conversion which loses precision.
538 Check (50, (int64x64_t (2000000000) / int64x64_t (3)) * int64x64_t (3),
539 int64x64_t (1999999999, 0xfffffffffffffffeULL));
540
541 // Check special values
542 Check (51, int64x64_t (0, 0x159fa87f8aeaad21ULL) * 10,
543 int64x64_t (0, 0xd83c94fb6d2ac34aULL));
544
545}
546
547
548
553{
554public:
556 virtual void DoRun (void);
557 void Check (const double result, const double expect,
558 const std::string & msg);
559};
560
562 : TestCase ("Test case for bug 455")
563{}
564void
565Int64x64Bug455TestCase::Check (const double result, const double expect,
566 const std::string & msg)
567{
568 bool pass = result == expect;
569
570 std::cout << GetParent ()->GetName () << " Bug 455: "
571 << (pass ? "pass " : "FAIL ")
572 << "res: " << result
573 << " exp: " << expect
574 << ": " << msg
575 << std::endl;
576
577 NS_TEST_ASSERT_MSG_EQ (result, expect, msg);
578}
579
580void
582{
583 std::cout << std::endl;
584 std::cout << GetParent ()->GetName () << " Bug 455: " << GetName ()
585 << std::endl;
586
587 int64x64_t a = int64x64_t (0.1);
588 a /= int64x64_t (1.25);
589 Check (a.GetDouble (), 0.08, "The original testcase");
590
591 a = int64x64_t (0.5);
592 a *= int64x64_t (5);
593 Check (a.GetDouble (), 2.5, "Simple test for multiplication");
594
595 a = int64x64_t (-0.5);
596 a *= int64x64_t (5);
597 Check (a.GetDouble (), -2.5, "Test sign, first operation negative");
598
599 a = int64x64_t (-0.5);
600 a *= int64x64_t (-5);
601 Check (a.GetDouble (), 2.5, "both operands negative");
602
603 a = int64x64_t (0.5);
604 a *= int64x64_t (-5);
605 Check (a.GetDouble (), -2.5, "only second operand negative");
606}
607
608
609
614{
615public:
617 virtual void DoRun (void);
618 void Check (const double result, const double expect,
619 const std::string & msg);
620};
621
623 : TestCase ("Test case for bug 863")
624{}
625void
626Int64x64Bug863TestCase::Check (const double result, const double expect,
627 const std::string & msg)
628{
629 bool pass = result == expect;
630
631 std::cout << GetParent ()->GetName () << " Bug 863: "
632 << (pass ? "pass " : "FAIL ")
633 << "res: " << result
634 << " exp: " << expect
635 << ": " << msg
636 << std::endl;
637
638 NS_TEST_ASSERT_MSG_EQ (result, expect, msg);
639}
640
641void
643{
644 std::cout << std::endl;
645 std::cout << GetParent ()->GetName () << " Bug 863: " << GetName ()
646 << std::endl;
647
648 int64x64_t a = int64x64_t (0.9);
649 a /= int64x64_t (1);
650 Check (a.GetDouble (), 0.9, "The original testcase");
651
652 a = int64x64_t (0.5);
653 a /= int64x64_t (0.5);
654 Check (a.GetDouble (), 1.0, "Simple test for division");
655
656 a = int64x64_t (-0.5);
657 Check (a.GetDouble (), -0.5, "Check that we actually convert doubles correctly");
658
659 a /= int64x64_t (0.5);
660 Check (a.GetDouble (), -1.0, "first argument negative");
661
662 a = int64x64_t (0.5);
663 a /= int64x64_t (-0.5);
664 Check (a.GetDouble (), -1.0, "second argument negative");
665
666 a = int64x64_t (-0.5);
667 a /= int64x64_t (-0.5);
668 Check (a.GetDouble (), 1.0, "both arguments negative");
669}
670
671
676{
677public:
679 virtual void DoRun (void);
680 void Check (const uint64_t low, const std::string & value,
681 const int64_t tolerance = 0);
682};
683
685 : TestCase ("Test case for bug 1786")
686{}
687void
689 const std::string & str,
690 const int64_t tolerance /* = 0 */)
691{
692 int64x64_t value (0, low);
693 std::ostringstream oss;
694 oss << std::scientific << std::setprecision (22) << value;
695
696 if (tolerance == 0)
697 {
698 bool pass = oss.str () == str;
699
700 std::cout << GetParent ()->GetName () << " Bug 1786: "
701 << (pass ? "pass " : "FAIL ")
702 << " 0x" << std::hex << std::setw (16) << low << std::dec
703 << " = " << oss.str ();
704 if (!pass)
705 {
706 std::cout << ", expected " << str;
707 }
708 std::cout << std::endl;
709
710 NS_TEST_EXPECT_MSG_EQ (oss.str (), str,
711 "Fraction string not correct");
712 }
713 else
714 {
715 // No obvious way to implement a tolerance on the strings
716
717 std::cout << GetParent ()->GetName () << " Bug 1786: "
718 << "skip "
719 << " 0x" << std::hex << std::setw (16) << low << std::dec
720 << " = " << oss.str ()
721 << ", expected " << str
722 << std::endl;
723
724 }
725}
726void
728{
729 std::cout << std::endl;
730 std::cout << GetParent ()->GetName () << " But 1786: " << GetName ()
731 << std::endl;
732
733 int64_t tolerance = 0;
735 {
736 // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
737 tolerance = 1;
738 }
739
740 // Some of these values differ from the DoubleTestCase
741 // by one count in the last place
742 // because operator<< truncates the last output digit,
743 // instead of rounding.
744 Check ( 1ULL, "+0.0000000000000000000542");
745 Check ( 2ULL, "+0.0000000000000000001084");
746 Check ( 3ULL, "+0.0000000000000000001626");
747 Check ( 4ULL, "+0.0000000000000000002168");
748 Check ( 5ULL, "+0.0000000000000000002710");
749 Check ( 6ULL, "+0.0000000000000000003253");
750 Check ( 7ULL, "+0.0000000000000000003795");
751 Check ( 8ULL, "+0.0000000000000000004337");
752 Check ( 9ULL, "+0.0000000000000000004879");
753 Check ( 0xAULL, "+0.0000000000000000005421");
754 Check ( 0xFULL, "+0.0000000000000000008132");
755 Check ( 0xF0ULL, "+0.0000000000000000130104");
756 Check ( 0xF00ULL, "+0.0000000000000002081668");
757 Check ( 0xF000ULL, "+0.0000000000000033306691");
758 Check ( 0xF0000ULL, "+0.0000000000000532907052");
759 Check ( 0xF00000ULL, "+0.0000000000008526512829");
760 Check ( 0xF000000ULL, "+0.0000000000136424205266");
761 Check ( 0xF0000000ULL, "+0.0000000002182787284255");
762 Check ( 0xF00000000ULL, "+0.0000000034924596548080");
763 Check ( 0xF000000000ULL, "+0.0000000558793544769287");
764 Check ( 0xF0000000000ULL, "+0.0000008940696716308594");
765 Check ( 0xF00000000000ULL, "+0.0000143051147460937500");
766 Check ( 0xF000000000000ULL, "+0.0002288818359375000000");
767 Check ( 0xF0000000000000ULL, "+0.0036621093750000000000");
768 Check ( 0xF00000000000000ULL, "+0.0585937500000000000000");
769 std::cout << std::endl;
770 Check (0x7FFFFFFFFFFFFFFDULL, "+0.4999999999999999998374", tolerance);
771 Check (0x7FFFFFFFFFFFFFFEULL, "+0.4999999999999999998916", tolerance);
772 Check (0x7FFFFFFFFFFFFFFFULL, "+0.4999999999999999999458", tolerance);
773 Check (0x8000000000000000ULL, "+0.5000000000000000000000");
774 Check (0x8000000000000001ULL, "+0.5000000000000000000542", tolerance);
775 Check (0x8000000000000002ULL, "+0.5000000000000000001084", tolerance);
776 Check (0x8000000000000003ULL, "+0.5000000000000000001626", tolerance);
777 std::cout << std::endl;
778 Check (0xF000000000000000ULL, "+0.9375000000000000000000");
779 Check (0xFF00000000000000ULL, "+0.9960937500000000000000");
780 Check (0xFFF0000000000000ULL, "+0.9997558593750000000000");
781 Check (0xFFFF000000000000ULL, "+0.9999847412109375000000");
782 Check (0xFFFFF00000000000ULL, "+0.9999990463256835937500");
783 Check (0xFFFFFF0000000000ULL, "+0.9999999403953552246094");
784 Check (0xFFFFFFF000000000ULL, "+0.9999999962747097015381");
785 Check (0xFFFFFFFF00000000ULL, "+0.9999999997671693563461");
786 Check (0xFFFFFFFFF0000000ULL, "+0.9999999999854480847716");
787 Check (0xFFFFFFFFFF000000ULL, "+0.9999999999990905052982");
788 Check (0xFFFFFFFFFFF00000ULL, "+0.9999999999999431565811");
789 Check (0xFFFFFFFFFFFF0000ULL, "+0.9999999999999964472863");
790 Check (0xFFFFFFFFFFFFF000ULL, "+0.9999999999999997779554");
791 Check (0xFFFFFFFFFFFFFF00ULL, "+0.9999999999999999861222");
792 Check (0xFFFFFFFFFFFFFFF0ULL, "+0.9999999999999999991326");
793 Check (0xFFFFFFFFFFFFFFF5ULL, "+0.9999999999999999994037", tolerance);
794 Check (0xFFFFFFFFFFFFFFF6ULL, "+0.9999999999999999994579", tolerance);
795 Check (0xFFFFFFFFFFFFFFF7ULL, "+0.9999999999999999995121", tolerance);
796 Check (0xFFFFFFFFFFFFFFF8ULL, "+0.9999999999999999995663", tolerance);
797 Check (0xFFFFFFFFFFFFFFF9ULL, "+0.9999999999999999996205", tolerance);
798 Check (0xFFFFFFFFFFFFFFFAULL, "+0.9999999999999999996747", tolerance);
799 Check (0xFFFFFFFFFFFFFFFBULL, "+0.9999999999999999997289", tolerance);
800 Check (0xFFFFFFFFFFFFFFFCULL, "+0.9999999999999999997832", tolerance);
801 Check (0xFFFFFFFFFFFFFFFDULL, "+0.9999999999999999998374", tolerance);
802 Check (0xFFFFFFFFFFFFFFFEULL, "+0.9999999999999999998916", tolerance);
803 Check (0xFFFFFFFFFFFFFFFFULL, "+0.9999999999999999999458", tolerance);
804}
805
806
808{
809public:
811 virtual void DoRun (void);
812
813 void Check (const bool result, const bool expect,
814 const std::string & msg);
815};
817 : TestCase ("Basic compare operations")
818{}
819void
820Int64x64CompareTestCase::Check (const bool result, const bool expect,
821 const std::string & msg)
822{
823 bool pass = result == expect;
824
825 std::cout << GetParent ()->GetName () << " Compare: "
826 << (pass ? "pass " : "FAIL ")
827 << msg
828 << std::endl;
829
830 NS_TEST_ASSERT_MSG_EQ (result, expect, msg);
831}
832
833void
835{
836 std::cout << std::endl;
837 std::cout << GetParent ()->GetName () << " Compare: " << GetName ()
838 << std::endl;
839
840 const int64x64_t zero ( 0, 0);
841 const int64x64_t one ( 1, 0);
842 const int64x64_t two ( 2, 0);
843 const int64x64_t mone (-1, 0);
844 const int64x64_t mtwo (-2, 0);
845 const int64x64_t frac = int64x64_t (0, 0xc000000000000000ULL); // 0.75
846 const int64x64_t zerof = zero + frac;
847 const int64x64_t onef = one + frac;
848 const int64x64_t monef = mone - frac;
849 const int64x64_t mtwof = mtwo - frac;
850
851 Check ( zerof == zerof, true, "equality, zero");
852 Check ( onef == onef, true, "equality, positive");
853 Check ( mtwof == mtwof, true, "equality, negative");
854 Check ( zero == one, false, "equality false, zero");
855 Check ( one == two, false, "equality false, unsigned");
856 Check ( one == mone, false, "equality false, signed");
857 Check ( onef == one, false, "equality false, fraction");
858 std::cout << std::endl;
859
860 Check ( zerof != zerof, false, "inequality, zero");
861 Check ( onef != onef, false, "inequality, positive");
862 Check ( mtwof != mtwof, false, "inequality, negative");
863 Check ( zero != one, true, "inequality true, zero");
864 Check ( one != two, true, "inequality true, unsigned");
865 Check ( one != mone, true, "inequality true, signed");
866 Check ( onef != one, true, "inequality true, fraction");
867 std::cout << std::endl;
868
869 Check ( zerof < onef, true, "less, zerof");
870 Check ( zero < zerof, true, "less, zero");
871 Check ( one < onef, true, "less, positive");
872 Check ( monef < mone, true, "less, negative");
873 Check ( onef < one, false, "less, false, positive");
874 Check ( mtwo < mtwof, false, "less, false, negative");
875 std::cout << std::endl;
876
877 Check ( zerof <= zerof, true, "less equal, equal, zerof");
878 Check ( zero <= zerof, true, "less equal, less, zero");
879 Check ( onef <= onef, true, "less equal, equal, positive");
880 Check ( monef <= mone, true, "less equal, less, negative");
881 Check ( onef <= one, false, "less equal, false, positive");
882 Check ( mtwo <= mtwof, false, "less equal, false, negative");
883 std::cout << std::endl;
884
885 Check ( onef > zerof, true, "greater, zerof");
886 Check ( zerof > zero, true, "greater, zero");
887 Check ( onef > one, true, "greater, positive");
888 Check ( mone > monef, true, "greater, negative");
889 Check ( one > onef, false, "greater, false, positive");
890 Check ( mtwof > mtwo, false, "greater, false, negative");
891 std::cout << std::endl;
892
893 Check ( zerof >= zerof, true, "greater equal, equal, zerof");
894 Check ( zerof >= zero, true, "greater equal, greater, zero");
895 Check ( onef >= onef, true, "greater equal, equal, positive");
896 Check ( mone >= monef, true, "greater equal, greater, negative");
897 Check ( one >= onef, false, "greater equal, false, positive");
898 Check ( mtwof >= mtwo, false, "greater equal, false, negative");
899 std::cout << std::endl;
900
901 Check ( zero == false, true, "zero == false");
902 Check ( one == true, true, "one == true");
903 Check ( zerof != false, true, "zerof != false");
904 Check ( (!zero) == true, true, "!zero == true");
905 Check ( (!zerof) == false, true, "!zerof == false");
906 Check ( (!one) == false, true, "!one == false");
907 Check ( (+onef) == onef, true, "unary positive");
908 Check ( (-onef) == monef, true, "unary negative");
909}
910
911
913{
914public:
916 virtual void DoRun (void);
917 void Check (const int64_t factor);
918 void CheckCase (const uint64_t factor,
919 const int64x64_t result, const int64x64_t expect,
920 const std::string & msg,
921 const double tolerance = 0);
922};
923
925 : TestCase ("Invert and MulByInvert")
926{}
927void
929 const int64x64_t result,
930 const int64x64_t expect,
931 const std::string & msg,
932 const double tolerance /* = 0 */)
933{
934 bool pass = Abs (result - expect) <= tolerance;
935
936 std::cout << GetParent ()->GetName () << " Invert: ";
937
938 if (pass)
939 {
940 std::cout << "pass: " << factor << ": ";
941
942 }
943 else
944 {
945 std::cout << "FAIL: " << factor << ": "
946 << "(res: " << result
947 << " exp: " << expect
948 << " tol: " << tolerance << ") ";
949 }
950 std::cout << msg
951 << std::endl;
952
953 NS_TEST_ASSERT_MSG_EQ_TOL (result, expect, int64x64_t (tolerance), msg);
954}
955
956void
957Int64x64InvertTestCase::Check (const int64_t factor)
958{
959 const int64x64_t one (1, 0);
960 const int64x64_t factorI = one / int64x64_t (factor);
961
962 const int64x64_t a = int64x64_t::Invert (factor);
963 int64x64_t b = int64x64_t (factor);
964
965 double tolerance = 0;
967 {
968 // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
969 tolerance = 0.000000000000000001L;
970 }
971
972 b.MulByInvert (a);
973 CheckCase (factor, b, one, "x * x^-1 == 1", tolerance);
974
975 int64x64_t c = int64x64_t (1);
976 c.MulByInvert (a);
977 CheckCase (factor, c, factorI, "1 * x^-1 == 1 / x");
978
979 int64x64_t d = int64x64_t (1);
980 d /= (int64x64_t (factor));
981 CheckCase (factor, d, c, "1/x == x^-1");
982
983 int64x64_t e = int64x64_t (-factor);
984 e.MulByInvert (a);
985 CheckCase (factor, e, -one, "-x * x^-1 == -1", tolerance);
986}
987
988void
990{
991 std::cout << std::endl;
992 std::cout << GetParent ()->GetName () << " Invert: " << GetName ()
993 << std::endl;
994
995 Check (2);
996 Check (3);
997 Check (4);
998 Check (5);
999 Check (6);
1000 Check (10);
1001 Check (99);
1002 Check (100);
1003 Check (1000);
1004 Check (10000);
1005 Check (100000);
1006 Check (100000);
1007 Check (1000000);
1008 Check (10000000);
1009 Check (100000000);
1010 Check (1000000000);
1011 Check (10000000000LL);
1012 Check (100000000000LL);
1013 Check (1000000000000LL);
1014 Check (10000000000000LL);
1015 Check (100000000000000LL);
1016 Check (1000000000000000LL);
1017}
1018
1019
1021{
1022public:
1024 virtual void DoRun (void);
1025 void Check (const int64_t intPart);
1026 void Check (const long double value,
1027 const int64_t intPart,
1028 const uint64_t lo);
1029
1030private:
1031 long double m_last;
1034};
1035
1037 : TestCase ("Construct from floating point.")
1038{}
1039
1040void
1041Int64x64DoubleTestCase::Check (const long double value,
1042 const int64_t intPart,
1043 const uint64_t lo)
1044{
1045 // Construct the expected value
1046 int64x64_t expect = int64x64_t (0, lo);
1047 expect += intPart;
1048
1049 // Actual value of conversion from double
1050 const int64x64_t result = int64x64_t (value);
1051
1052 // Make tolerance depend on magnitude of value
1054 long double margin = 0;
1056 {
1057 // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
1058 margin = 1.0;
1059 }
1061 {
1062 // Valgrind uses 64-bit doubles for long doubles
1063 // See ns-3 bug 1882
1064 // Need non-zero margin to ensure final tolerance is non-zero
1065 margin = 1.0;
1067 }
1068
1069 const int64x64_t tolerance = (margin + std::fabs (value)) * epsilon;
1070
1071 const int64x64_t delta = Abs (result - expect);
1072 const bool skip = value == m_last;
1073 const bool pass = delta <= tolerance;
1074
1075 // Save stream format flags
1076 std::ios_base::fmtflags ff = std::cout.flags ();
1077 std::cout << std::fixed << std::setprecision (22);
1078
1079 std::cout << GetParent ()->GetName () << " Double: "
1080 << (skip ? "skip " : (pass ? "pass " : "FAIL "))
1081 << std::showpos << value << " == "
1082 << Printer (result)
1083 << std::endl;
1084
1085 // Log non-zero delta
1086 if ( delta > int64x64_t () )
1087 {
1088 std::cout << GetParent ()->GetName ()
1089 << std::left << std::setw (43) << " expected"
1090 << std::right << Printer (expect)
1091 << std::endl;
1092
1093 if (delta == tolerance)
1094 {
1095 std::cout << GetParent ()->GetName ()
1096 << std::left << std::setw (43) << " delta = tolerance"
1097 << std::right << Printer (delta)
1098 << std::endl;
1099 }
1100 else
1101 {
1102 std::cout << GetParent ()->GetName ()
1103 << std::left << std::setw (43) << " delta"
1104 << std::right << Printer (delta)
1105 << std::endl;
1106 std::cout << GetParent ()->GetName ()
1107 << std::left << std::setw (43) << " +/-"
1108 << std::right << Printer (tolerance)
1109 << std::endl;
1110 }
1111
1112 ++m_deltaCount;
1113
1114 if ( delta > m_deltaMax )
1115 {
1116 m_deltaMax = delta;
1117 }
1118 }
1119
1120 NS_TEST_ASSERT_MSG_EQ_TOL (result, expect, tolerance,
1121 "int64x64_t (long double) failed");
1122 m_last = value;
1123 std::cout.flags (ff);
1124
1125}
1126
1127void
1128Int64x64DoubleTestCase::Check (const int64_t intPart)
1129{
1130 std::cout << std::endl;
1131 std::cout << GetParent ()->GetName () << " Double: "
1132 << "integer: " << intPart
1133 << std::endl;
1134 m_last = static_cast<long double> (intPart);
1135 m_deltaCount = 0;
1136
1137 // Nudging the integer part eliminates deltas around 0
1138 long double v = static_cast<long double> (intPart);
1139
1140 Check (v + 0.0000000000000000000542L, intPart, 0x1ULL);
1141 Check (v + 0.0000000000000000001084L, intPart, 0x2ULL);
1142 Check (v + 0.0000000000000000001626L, intPart, 0x3ULL);
1143 Check (v + 0.0000000000000000002168L, intPart, 0x4ULL);
1144 Check (v + 0.0000000000000000002710L, intPart, 0x5ULL);
1145 Check (v + 0.0000000000000000003253L, intPart, 0x6ULL);
1146 Check (v + 0.0000000000000000003795L, intPart, 0x7ULL);
1147 Check (v + 0.0000000000000000004337L, intPart, 0x8ULL);
1148 Check (v + 0.0000000000000000004879L, intPart, 0x9ULL);
1149 Check (v + 0.0000000000000000005421L, intPart, 0xAULL);
1150 Check (v + 0.0000000000000000008132L, intPart, 0xFULL);
1151 Check (v + 0.0000000000000000130104L, intPart, 0xF0ULL);
1152 Check (v + 0.0000000000000002081668L, intPart, 0xF00ULL);
1153 Check (v + 0.0000000000000033306691L, intPart, 0xF000ULL);
1154 Check (v + 0.0000000000000532907052L, intPart, 0xF0000ULL);
1155 Check (v + 0.0000000000008526512829L, intPart, 0xF00000ULL);
1156 Check (v + 0.0000000000136424205266L, intPart, 0xF000000ULL);
1157 Check (v + 0.0000000002182787284255L, intPart, 0xF0000000ULL);
1158 Check (v + 0.0000000034924596548080L, intPart, 0xF00000000ULL);
1159 Check (v + 0.0000000558793544769287L, intPart, 0xF000000000ULL);
1160 Check (v + 0.0000008940696716308594L, intPart, 0xF0000000000ULL);
1161 Check (v + 0.0000143051147460937500L, intPart, 0xF00000000000ULL);
1162 Check (v + 0.0002288818359375000000L, intPart, 0xF000000000000ULL);
1163 Check (v + 0.0036621093750000000000L, intPart, 0xF0000000000000ULL);
1164 Check (v + 0.0585937500000000000000L, intPart, 0xF00000000000000ULL);
1165 std::cout << std::endl;
1166 Check (v + 0.4999999999999999998374L, intPart, 0x7FFFFFFFFFFFFFFDULL);
1167 Check (v + 0.4999999999999999998916L, intPart, 0x7FFFFFFFFFFFFFFEULL);
1168 Check (v + 0.4999999999999999999458L, intPart, 0x7FFFFFFFFFFFFFFFULL);
1169 Check (v + 0.5000000000000000000000L, intPart, 0x8000000000000000ULL);
1170 Check (v + 0.5000000000000000000542L, intPart, 0x8000000000000001ULL);
1171 Check (v + 0.5000000000000000001084L, intPart, 0x8000000000000002ULL);
1172 Check (v + 0.5000000000000000001626L, intPart, 0x8000000000000003ULL);
1173 std::cout << std::endl;
1174 Check (v + 0.9375000000000000000000L, intPart, 0xF000000000000000ULL);
1175 Check (v + 0.9960937500000000000000L, intPart, 0xFF00000000000000ULL);
1176 Check (v + 0.9997558593750000000000L, intPart, 0xFFF0000000000000ULL);
1177 Check (v + 0.9999847412109375000000L, intPart, 0xFFFF000000000000ULL);
1178 Check (v + 0.9999990463256835937500L, intPart, 0xFFFFF00000000000ULL);
1179 Check (v + 0.9999999403953552246094L, intPart, 0xFFFFFF0000000000ULL);
1180 Check (v + 0.9999999962747097015381L, intPart, 0xFFFFFFF000000000ULL);
1181 Check (v + 0.9999999997671693563461L, intPart, 0xFFFFFFFF00000000ULL);
1182 Check (v + 0.9999999999854480847716L, intPart, 0xFFFFFFFFF0000000ULL);
1183 Check (v + 0.9999999999990905052982L, intPart, 0xFFFFFFFFFF000000ULL);
1184 Check (v + 0.9999999999999431565811L, intPart, 0xFFFFFFFFFFF00000ULL);
1185 Check (v + 0.9999999999999964472863L, intPart, 0xFFFFFFFFFFFF0000ULL);
1186 Check (v + 0.9999999999999997779554L, intPart, 0xFFFFFFFFFFFFF000ULL);
1187 Check (v + 0.9999999999999999861222L, intPart, 0xFFFFFFFFFFFFFF00ULL);
1188 Check (v + 0.9999999999999999991326L, intPart, 0xFFFFFFFFFFFFFFF0ULL);
1189 Check (v + 0.9999999999999999994037L, intPart, 0xFFFFFFFFFFFFFFF5ULL);
1190 Check (v + 0.9999999999999999994579L, intPart, 0xFFFFFFFFFFFFFFF6ULL);
1191 Check (v + 0.9999999999999999995121L, intPart, 0xFFFFFFFFFFFFFFF7ULL);
1192 Check (v + 0.9999999999999999995663L, intPart, 0xFFFFFFFFFFFFFFF8ULL);
1193 Check (v + 0.9999999999999999996205L, intPart, 0xFFFFFFFFFFFFFFF9ULL);
1194 Check (v + 0.9999999999999999996747L, intPart, 0xFFFFFFFFFFFFFFFAULL);
1195 Check (v + 0.9999999999999999997289L, intPart, 0xFFFFFFFFFFFFFFFBULL);
1196 Check (v + 0.9999999999999999997832L, intPart, 0xFFFFFFFFFFFFFFFCULL);
1197 Check (v + 0.9999999999999999998374L, intPart, 0xFFFFFFFFFFFFFFFDULL);
1198 Check (v + 0.9999999999999999998916L, intPart, 0xFFFFFFFFFFFFFFFEULL);
1199 Check (v + 0.9999999999999999999458L, intPart, 0xFFFFFFFFFFFFFFFFULL);
1200
1201 std::cout << GetParent ()->GetName () << " Double: "
1202 << "integer: " << intPart
1203 << ": delta count: " << m_deltaCount
1204 << ", max: " << Printer (m_deltaMax)
1205 << std::endl;
1206}
1207
1208void
1210{
1211 std::cout << std::endl;
1212 std::cout << GetParent ()->GetName () << " Double: " << GetName ()
1213 << std::endl;
1214
1215 // Save stream format flags
1216 std::ios_base::fmtflags ff = std::cout.flags ();
1217 std::cout << std::scientific << std::setprecision (21);
1218
1220
1221 std::cout << GetParent ()->GetName () << " Double: "
1222 << std::endl;
1223
1224 Check (-2);
1225 Check (-1);
1226 Check ( 0);
1227 Check ( 1);
1228 Check ( 2);
1229
1230 std::cout << GetParent ()->GetName () << " Double: "
1231 << "max delta: " << Printer (m_deltaMax)
1232 << std::endl;
1233
1234 std::cout.flags (ff);
1235}
1236
1237
1239{
1240public:
1242 virtual void DoRun (void);
1243};
1244
1246 : TestCase ("Print the implementation")
1247{}
1248
1249void
1251{
1252 std::cout << std::endl;
1253 std::cout << GetParent ()->GetName () << " Impl: " << GetName ()
1254 << std::endl;
1255
1256
1257 std::cout << "int64x64_t::implementation: ";
1259 {
1260 /* *NS_CHECK_STYLE_OFF* */
1261 case (int64x64_t::int128_impl) : std::cout << "int128_impl"; break;
1262 case (int64x64_t::cairo_impl) : std::cout << "cairo_impl"; break;
1263 case (int64x64_t::ld_impl) : std::cout << "ld_impl"; break;
1264 default : std::cout << "unknown!";
1265 /* *NS_CHECK_STYLE_ON* */
1266 }
1267 std::cout << std::endl;
1268
1269#if defined (INT64X64_USE_CAIRO) && !defined (PYTHON_SCAN)
1270 std::cout << "cairo_impl64: " << cairo_impl64 << std::endl;
1271 std::cout << "cairo_impl128: " << cairo_impl128 << std::endl;
1272#endif
1273
1274 if (RUNNING_ON_VALGRIND != 0)
1275 {
1276 std::cout << "Running with valgrind" << std::endl;
1277 }
1278
1279}
1280
1281static class Int64x64TestSuite : public TestSuite
1282{
1283public:
1285 : TestSuite ("int64x64", UNIT)
1286 {
1299 }
1301
1302} // namespace test
1303
1304} // namespace int64x64
1305
1306} // namespace ns3
1307
const char * cairo_impl64
Definition: cairo-wideint.c:47
const char * cairo_impl128
encapsulates test code
Definition: test.h:994
@ QUICK
Fast test.
Definition: test.h:999
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
TestCase * GetParent() const
Get the parent of this TestCsse.
Definition: test.cc:376
std::string GetName(void) const
Definition: test.cc:370
A suite of tests to run.
Definition: test.h:1188
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1197
void Check(const int test, const int64x64_t value, const int64x64_t expect)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const uint64_t low, const std::string &value, const int64_t tolerance=0)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const double result, const double expect, const std::string &msg)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const double result, const double expect, const std::string &msg)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const bool result, const bool expect, const std::string &msg)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const int64_t hi, const uint64_t lo)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const std::string &str, const int64_t tolerance=0)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const std::string &str, const int64_t hi, const uint64_t lo, const int64_t tolerance=0)
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Check(const int64x64_t value, const int64_t expectInt, const int64_t expectRnd)
void CheckCase(const uint64_t factor, const int64x64_t result, const int64x64_t expect, const std::string &msg, const double tolerance=0)
virtual void DoRun(void)
Implementation to actually run this TestCase.
Pretty printer for test cases.
int64x64_t m_value
The int64x64_t value.
friend std::ostream & operator<<(std::ostream &os, const Printer &p)
Output streamer, the main reason for this class.
bool m_haveInt
Do we have a full int64x64_t value?
int64_t m_high
The high (integer) word.
Printer(const int64x64_t value)
Construct from an int64x64_t Q64.64 value.
Printer(const int64_t high, const uint64_t low)
Construct from high and low words of Q64.64 representation.
uint64_t m_low
The low (fractional) word.
High precision numerical type, implementing Q64.64 fixed precision.
int64_t GetInt(void) const
Truncate to an integer.
@ int128_impl
Native int128_t implementation.
@ ld_impl
long double implementation
@ cairo_impl
cairo wideint implementation
int64_t Round(void) const
Round to the nearest int.
void MulByInvert(const int64x64_t &o)
Multiply this value by a Q0.128 value, presumably representing an inverse, completing a division oper...
static enum impl_type implementation
Type tag for this implementation.
int64_t GetHigh(void) const
Get the integer portion.
uint64_t GetLow(void) const
Get the fractional portion of this value, unscaled.
double GetDouble(void) const
Get this value as a double.
static int64x64_t Invert(const uint64_t v)
Compute the inverse of an integer value.
static double zero
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
Definition: int64x64.h:230
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Definition: int64x64.h:205
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition: int64x64.h:218
#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:141
#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_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
Definition: test.h:491
#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:323
#define HP_MAX_64
Floating point value of HP_MASK_LO + 1 We really want:
std::ostream & operator<<(std::ostream &os, const Printer &p)
ns3::int64x64::test::Int64x64TestSuite g_int64x64TestSuite
Every class exported by the ns3 library is enclosed in the ns3 namespace.
#define RUNNING_ON_VALGRIND
Definition: valgrind.h:5235