1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822 | // *****************************************************************************
/*!
\file tests/unit/Base/TestPUPUtil.cpp
\copyright 2012-2015 J. Bakosi,
2016-2018 Los Alamos National Security, LLC.,
2019-2021 Triad National Security, LLC.,
2022-2025 J. Bakosi
All rights reserved. See the LICENSE file for details.
\brief Unit tests for Base/PUPUtil.hpp
\details Unit tests for Base/PUPUtil.hpp
*/
// *****************************************************************************
#include "NoWarning/tut.hpp"<--- Include file: "NoWarning/tut.hpp" not found.
#include "TUTConfig.hpp"<--- Include file: "TUTConfig.hpp" not found.
#include "PUPUtil.hpp"
#include "MigratedTypes.hpp"
#include "XystConfig.hpp"
#include "NoWarning/tutsuite.decl.h"<--- Include file: "NoWarning/tutsuite.decl.h" not found.
#include "migrated.decl.h"<--- Include file: "migrated.decl.h" not found.
#ifndef DOXYGEN_GENERATING_OUTPUT
namespace unittest {
extern CProxy_TUTSuite g_suiteProxy;
} // unittest::
namespace tut {
//! All tests in group inherited from this base
struct PUPUtil_common {};
//! Test group shortcuts
using PUPUtil_group = test_group< PUPUtil_common, MAX_TESTS_IN_GROUP >;
using PUPUtil_object = PUPUtil_group::object;
//! Define test group
static PUPUtil_group PUPUtil( "Base/PUPUtil" );
//! Test definitions for group
//! Charm++ chare to test Pack/Unpack utilities during network migration
class Migrated : public CBase_Migrated {
public:
//! Constructor taking (and migrating) a default strongly-typed enum
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Enum_default e ) : m_enum_default(e)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 1,
"Charm:migrate enum 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
using underlying_type =
typename std::underlying_type< charm::Enum_default >::type;
std::string expected = std::to_string(
static_cast< underlying_type >( charm::Enum_default::F1 ) );
std::string actual = std::to_string(
static_cast< underlying_type >( m_enum_default ) );
// Evaluate test
ensure( "strongly-typed enum different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_enum_default == charm::Enum_default::F1 );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a uint8_t strongly-typed enum
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Enum_uint8_t e ) : m_enum_uint8_t(e)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 2,
"Charm:migrate uint8_t enum 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
using underlying_type =
typename std::underlying_type< charm::Enum_uint8_t >::type;
std::string expected = std::to_string(
static_cast< underlying_type >( charm::Enum_uint8_t::F1 ) );
std::string actual = std::to_string(
static_cast< underlying_type >( m_enum_uint8_t ) );
// Evaluate test
ensure( "strongly-typed enum different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_enum_uint8_t == charm::Enum_uint8_t::F1 );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a C-style enum
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Enum_cstyle e ) : m_enum_cstyle(e)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 3,
"Charm:migrate C-style enum 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = std::to_string( charm::Enum_cstyle::F1 );
std::string actual = std::to_string( m_enum_cstyle );
// Evaluate test
ensure( "C-style enum different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_enum_cstyle == charm::Enum_cstyle::F1 );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a std::pair<int,double>
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Pair p ) : m_pair(p)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 4,
"Charm:migrate std::pair<int,double> 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
double precision = 1.0e-15; // required floating-point precision
// Evaluate test
ensure_equals( "std::pair (1st) different after migrated: "
"expected `2` actual `" + std::to_string(m_pair.first) +
"`", m_pair.first, 2.0, precision );
ensure_equals( "std::pair (2nd) different after migrated: "
"expected `3.14` actual `" + std::to_string(m_pair.second)
+ "`", m_pair.second, 3.14, precision );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a std::vector< std::string >
// cppcheck-suppress uninitMemberVar
// cppcheck-suppress passedByValue
explicit Migrated( charm::Vector v ) : m_vector(v)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 5,
"Charm:migrate std::vector< std::string > 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = "[ \"1\", \"blah\", \"boohoo\" ]";
std::string actual = "[ " + m_vector[0] +
", " + m_vector[1] +
", " + m_vector[2] + " ]";
// Evaluate test
ensure( "std::vector different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_vector == charm::Vector{ "1", "blah", "boohoo" } );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a std::tuple
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Tuple t ) : m_tuple(t)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 6,
"Charm:migrate std::tuple 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = "[ 2, 6.42, {\"woodoo\", \"boohoo\"}, "
"32, {{14, \"blah\"}, {15, \"blahblah\"}} ]";
ensure_equals( "std::tuple different after migrated: vector size is "
"different", std::get< 2 >( m_tuple ).size(), 2UL );
ensure_equals( "std::tuple different after migrated: map size is "
"different", std::get< 4 >( m_tuple ).size(), 2UL );
using underlying_type_def =
typename std::underlying_type< charm::Enum_default >::type;
using underlying_type_uin =
typename std::underlying_type< charm::Enum_uint8_t >::type;
const auto& m = std::get< 4 >( m_tuple );
const auto& i1 = m.find( charm::Enum_uint8_t::F1 );
std::string m1, m2;
if ( i1 != end(m) )
m1 = "{" + std::to_string(
static_cast< underlying_type_uin >(
charm::Enum_uint8_t::F1 ) )
+ ", \"" + i1->second + "\"}";
else
fail("std::tuple different after migrated: cannot find 1st key in map");
const auto& i2 = m.find( charm::Enum_uint8_t::F2 );
if ( i2 != end(m) )
m2 = "{" + std::to_string(
static_cast< underlying_type_uin >(
charm::Enum_uint8_t::F2 ) )
+ ", \"" + i2->second + "\"}";
else
fail("std::tuple different after migrated: cannot find 2nd key in map");
std::string actual = "[ " + std::to_string( std::get< 0 >( m_tuple ) ) +
", " + std::to_string( std::get< 1 >( m_tuple ) ) +
", {\"" + std::get< 2 >( m_tuple )[ 0 ] +
"\", \"" + std::get< 2 >( m_tuple )[ 1 ] +
"\"}, " + std::to_string(
static_cast< underlying_type_def >(
std::get< 3 >( m_tuple ) ) ) +
", {" + m1 + ", " + m2 + "} ]";
// Evaluate test
ensure( "std::tuple different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_tuple ==
charm::Tuple{ 2, 6.42, {"woodoo", "boohoo"},
charm::Enum_default::F1,
std::map< charm::Enum_uint8_t, std::string >{
{ charm::Enum_uint8_t::F1, "blah" },
{ charm::Enum_uint8_t::F2, "blahblah" } } } );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a std::array
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Array a ) : m_array(a)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 7,
"Charm:migrate std::array<int,2> 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = "[ 12, 2 ]";
std::string actual = "[ " + std::to_string( m_array[0] ) + ", "
+ std::to_string( m_array[1] ) + " ]";
// Evaluate test
ensure( "std::array<int,2> different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_array == charm::Array{ { 12, 2 } } );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a std::unordered_map
// cppcheck-suppress uninitMemberVar
// cppcheck-suppress passedByValue
explicit Migrated( charm::UnorderedMap m ) : m_unordered_map(m)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 8,
"Charm:migrate std::unordered_map<int,str> 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = R"([ {11, "eleven"} {12, "twelve"} ])";
std::string actual = "[ ";
for (const auto& n : m_unordered_map) {
actual += "{" + std::to_string(n.first) + ", " + n.second + "} ";
}
actual += "]";
// Evaluate test
ensure( "std::unordered_map<int,str> different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_unordered_map ==
charm::UnorderedMap{ {11,"eleven"}, {12,"twelve"} } );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a std::unordered_set
// cppcheck-suppress uninitMemberVar
// cppcheck-suppress passedByValue
explicit Migrated( charm::UnorderedSet s ) : m_unordered_set(s)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 9,
"Charm:migrate std::unordered_set<int> 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = R"([ {11} {12} ])";
std::string actual = "[ ";
for (auto n : m_unordered_set) actual += "{" + std::to_string(n) + "} ";
actual += "]";
// Evaluate test
ensure( "std::unordered_set<int> different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_unordered_set ==
charm::UnorderedSet{ 11, 12 } );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a std::optional< std::string >
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::OptionalStr o ) : m_optional_str(o)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 10,
"Charm:migrate std::optional<str> 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = "blah";
std::string actual = o ? *o : "";
// Evaluate test
ensure( "std::optional<str> different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_optional_str == charm::OptionalStr{ { "blah" } } );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) an uninitialized std::optional< int >
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::OptionalInt o ) : m_optional_int(o)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 11,
"Charm:migrate std::optional<int> 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = "std::nullopt";
std::string actual = o ? std::to_string(*o) : "std::nullopt";
// Evaluate test
ensure( "std::optional<int> different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_optional_int == charm::OptionalInt{ std::nullopt } );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! Constructor taking (and migrating) a tk::tuple::tagged_tuple
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::TaggedTuple t ) : m_tagged_tuple(t)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 12,
"Charm:migrate tk::tuple::tagged_tuple 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = R"([ "Bob", 32, "bob@bob.bob" ])";
std::string actual = "[ " +
m_tagged_tuple.get< charm::tag::name >() + ", " +
std::to_string( m_tagged_tuple.get< charm::tag::age >() ) +
m_tagged_tuple.get< charm::tag::email >() + " ]";
// Evaluate test
ensure("tk::tuple::tagged_tuple different after migrated: "
"expected `" + expected + "` actual `" + actual + "`",
m_tagged_tuple == charm::TaggedTuple{{"Bob", 32, "bob@bob.bob"}});
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! \brief Constructor taking (and migrating) a std::variant<int,double>
//! holding int
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Variant v, int value ) : m_variant(v)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 13,
"Charm:migrate std::variant<int,double>(int) 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = "[ " + std::to_string(value) + " ]";
std::string actual = "[ " +
std::to_string( std::get< int >( m_variant ) ) + " ]";
// Evaluate test
ensure_equals( "std::variant<int,double>(int) different after migrated:"
" expected `" + expected + "` actual `" + actual + "`",
std::get< int >( m_variant ), value );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
//! \brief Constructor taking (and migrating) a std::variant<int,double>
//! holding double
// cppcheck-suppress uninitMemberVar
explicit Migrated( charm::Variant v, double value ) : m_variant(v)
{
// Create test result struct, assume test is ok
tut::test_result tr( "Base/PUPUtil", 14,
"Charm:migrate std::variant<int,double>(double) 2",
tut::test_result::result_type::ok );
try {
// Generate error message with expected and actual value in case if fail
std::string expected = "[ " + std::to_string(value) + " ]";
std::string actual = "[ " +
std::to_string( std::get< double >( m_variant ) ) + " ]";
// Evaluate test
ensure_equals( "rk::Variant<int,double>(double) different after "
"migrated: expected `" + expected + "` actual `" + actual +
"`", std::get< double >( m_variant ), value,
1.0e-15 );
} catch ( const failure& ex ) {
tr.result = ex.result();
tr.exception_typeid = ex.type();
tr.message = ex.what();
}
// Send back a new test result, with tag "2", signaling the second part.
unittest::g_suiteProxy.evaluateTest(
{ tr.group, tr.name, std::to_string(tr.result), tr.message,
tr.exception_typeid } );
}
charm::Enum_default m_enum_default;
charm::Enum_uint8_t m_enum_uint8_t;
charm::Enum_cstyle m_enum_cstyle;
charm::Pair m_pair;
charm::Vector m_vector;
charm::Tuple m_tuple;
charm::Array m_array;
charm::UnorderedMap m_unordered_map;
charm::UnorderedSet m_unordered_set;
charm::OptionalStr m_optional_str;
charm::OptionalInt m_optional_int;
charm::TaggedTuple m_tagged_tuple;
charm::Variant m_variant;
};
//! Test Pack/Unpack of a default strongly-typed enum
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 1 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate enum 1" );
CProxy_Migrated::ckNew( charm::Enum_default::F1 );
}
//! Test Pack/Unpack of a uint8_t strongly-typed enum
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 2 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate uint8_t enum 1" );
CProxy_Migrated::ckNew( charm::Enum_uint8_t::F1 );
}
//! Test Pack/Unpack of a C-style enum
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 3 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate C-style enum 1" );
CProxy_Migrated::ckNew( charm::Enum_cstyle::F1 );
}
//! Test Pack/Unpack of a std::pair< int, double >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 4 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::pair<int,double> 1" );
CProxy_Migrated::ckNew( charm::Pair( 2, 3.14 ) );
}
//! Test Pack/Unpack of a std::vector< std::string >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 5 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::vector< std::string > 1" );
CProxy_Migrated::ckNew( charm::Vector{"1", "blah", "boohoo"} );
}
//! \brief Test Pack/Unpack of a std::tuple< int, double,
//! std::vector< std::string >, strongly-typed enum,
//! std::map< strongly-typed(uint8_t) enum, std::string > >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 6 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::tuple 1" );
CProxy_Migrated::ckNew(
charm::Tuple{ 2, 6.42, {"woodoo", "boohoo"},
charm::Enum_default::F1,
std::map< charm::Enum_uint8_t, std::string >{
{ charm::Enum_uint8_t::F1, "blah" },
{ charm::Enum_uint8_t::F2, "blahblah" } } } );
}
//! Test Pack/Unpack of a std::array< int, 2 >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 7 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::array<int,2> 1" );
CProxy_Migrated::ckNew( charm::Array{ { 12, 2 } } );
}
//! Test Pack/Unpack of a std::unordered_map< int, std::string >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 8 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::unordered_map<int,str> 1" );
CProxy_Migrated::ckNew( charm::UnorderedMap{ {11,"eleven"}, {12,"twelve"} } );
}
//! Test Pack/Unpack of a std::unordered_set< int >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 9 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::unordered_set<int> 1" );
CProxy_Migrated::ckNew( charm::UnorderedSet{ 11, 12 } );
}
//! Test Pack/Unpack of a std::optional< std::string >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 10 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::optional<str> 1" );
CProxy_Migrated::ckNew( charm::OptionalStr{ {"blah"} } );
}
//! Test Pack/Unpack of an uninitialized std::optional< int >
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 11 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::optional<none> 1" );
CProxy_Migrated::ckNew( charm::OptionalInt{ std::nullopt } );
}
//! Test Pack/Unpack of tk::tuple::tagged_tuple
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 12 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate tk::tuple::tagged_tuple 1" );
CProxy_Migrated::ckNew( charm::TaggedTuple{{"Bob", 32, "bob@bob.bob"}} );
}
//! Test Pack/Unpack of std::variant<int,double> holding an int
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 13 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::variant<int,double>(int) 1" );
std::variant< int, double > v{213};
CProxy_Migrated::ckNew( charm::Variant(v), 213 );
}
//! Test Pack/Unpack of std::variant<int,double> holding a double
//! \details Every Charm++ migration test, such as this one, consists of two
//! unit tests: one for send and one for receive. Both trigger a TUT test,
//! but the receive side is created manually, i.e., without the awareness of
//! the TUT library. Unfortunately thus, there is no good way to count up
//! these additional tests, and thus if a test such as this is added to the
//! suite this number must be updated in UnitTest/TUTSuite.h in
//! unittest::TUTSuite::m_migrations.
template<> template<>
void PUPUtil_object::test< 14 >() {
// This test spawns a new Charm++ chare. The "1" at the end of the test name
// signals that this is only the first part of this test: the part up to
// firing up an asynchronous Charm++ chare. The second part creates a new test
// result, sending it back to the suite if successful. If that chare never
// executes, the suite will hang waiting for that chare to call back.
set_test_name( "Charm:migrate std::variant<int,double>(double) 1" );
std::variant< int, double > v{3.14};
CProxy_Migrated::ckNew( charm::Variant(v), 3.14 );
}
} // tut::
#endif // DOXYGEN_GENERATING_OUTPUT
#include "NoWarning/migrated.def.h"<--- Include file: "NoWarning/migrated.def.h" not found.
|