"Fossies" - the Fresh Open Source Software Archive 
Member "dune-typetree-2.8.0/test/testtypetreetransformation.cc" (31 Aug 2021, 1573 Bytes) of package /linux/misc/dune/dune-typetree-2.8.0.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #include "config.h"
2
3 #include "typetreetestswitch.hh"
4
5 #if TEST_TYPETREE_INVALID
6
7 int main()
8 {
9 return 0;
10 }
11
12 #else
13
14 #include "typetreetestutility.hh"
15 #include "typetreetargetnodes.hh"
16
17 int main(int argc, char** argv)
18 {
19
20 // basic tests
21
22 // leaf node
23 TreePrinter treePrinter;
24 SimpleLeaf sl1;
25
26 Dune::TypeTree::applyToTree(sl1,treePrinter);
27
28 Dune::TypeTree::TransformTree<SimpleLeaf,TestTransformation>::transformed_type tl1 =
29 Dune::TypeTree::TransformTree<SimpleLeaf,TestTransformation>::transform(sl1,TestTransformation());
30
31 typedef SimpleDynamicPower<SimpleLeaf> SDP;
32 SDP sdp(sl1,sl1,sl1);
33
34 typedef SimplePower<SimpleLeaf,3> SP1;
35 SP1 sp1_1;
36 sp1_1.setChild(0,sl1);
37 sp1_1.setChild(1,sl1);
38 sp1_1.setChild(2,sl1);
39
40 SimpleLeaf sl2;
41 SP1 sp1_2(sl2,false);
42
43 typedef SimpleComposite<SimpleLeafDerived,SP1,SimpleLeaf> SVC1;
44
45 SVC1 svc1_1(SimpleLeafDerived(),sp1_2,sl1);
46
47 Dune::TypeTree::applyToTree(sp1_1,TreePrinter());
48
49 TestTransformation trafo;
50
51 Dune::TypeTree::TransformTree<SDP,TestTransformation>::transformed_type tsdp1_1 =
52 Dune::TypeTree::TransformTree<SDP,TestTransformation>::transform(sdp,trafo);
53
54 Dune::TypeTree::TransformTree<SP1,TestTransformation>::transformed_type tp1_1 =
55 Dune::TypeTree::TransformTree<SP1,TestTransformation>::transform(sp1_1,trafo);
56
57 Dune::TypeTree::TransformTree<SVC1,TestTransformation>::transformed_type tvc1_1 =
58 Dune::TypeTree::TransformTree<SVC1,TestTransformation>::transform(svc1_1,TestTransformation());
59
60 Dune::TypeTree::applyToTree(tvc1_1,TreePrinter());
61
62 return 0;
63 }
64
65 #endif