diff --git a/applications/test/Tuple2/Test-Tuple2.C b/applications/test/Tuple2/Test-Tuple2.C index 378d727b6f..2f679b4a31 100644 --- a/applications/test/Tuple2/Test-Tuple2.C +++ b/applications/test/Tuple2/Test-Tuple2.C @@ -25,10 +25,11 @@ Application Test-Tuple2 Description + Test construction, comparision etc for Tuple2 and Pair. \*---------------------------------------------------------------------------*/ -#include "Pair.H" +#include "labelPair.H" #include "Tuple2.H" #include "label.H" #include "scalar.H" @@ -67,6 +68,26 @@ struct special2 }; +// Print info +void printTuple2(const Tuple2& t) +{ + Info<< "tuple: " << t << nl; + + Info<< "first @: " << long(t.first().data()) << nl; + Info<< "second @: " << long(t.second().data()) << nl; +} + + +// Print info +void printTuple2(const Pair& t) +{ + Info<< "tuple: " << t << nl; + + Info<< "first @: " << long(t.first().data()) << nl; + Info<< "second @: " << long(t.second().data()) << nl; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -74,11 +95,14 @@ int main() { typedef Tuple2 indexedScalar; + Info<< "null constructed Tuple: " << indexedScalar() << nl; + Info<< "null constructed Pair: " << Pair() << nl; + indexedScalar t2(1, 3.2); - Info<< "tuple: " + Info<< "Foam::Tuple2: " << t2 << " => " - << t2.first() << " " << t2.second() << nl; + << t2.first() << ' ' << t2.second() << nl; // As list. Generated so that we have duplicate indices List list1(3*4); @@ -113,25 +137,83 @@ int main() << nl << list1 << nl; - Info<< nl << nl << "Pairs" << nl; + { + Info<< nl << nl << "Foam::Pair" << nl; - typedef Pair