diff --git a/applications/test/HashTable2/Test-HashTable2.C b/applications/test/HashTable2/Test-HashTable2.C index 02f12a1e00..1cb7c33437 100644 --- a/applications/test/HashTable2/Test-HashTable2.C +++ b/applications/test/HashTable2/Test-HashTable2.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -31,9 +31,53 @@ Description #include "HashTable.H" #include "HashPtrTable.H" #include "Map.H" +#include "FlatOutput.H" using namespace Foam; + +// Simple wrapper for testing purposes +class Label +{ + label data_; + +public: + + Label() + : + data_(0) + {} + + Label(label val) + : + data_(val) + {} + + ~Label() + { + Info<<"delete label: " << data_ << endl; + } + + // Some arbitrary non-const method (for testing) + label increment() + { + return ++data_; + } + + // Some arbitrary method (for testing) + std::string info() const + { + return "boxed label=" + std::to_string(data_); + } + + friend Ostream& operator<<(Ostream& os, const Label& val) + { + os << val.data_; + return os; + } +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -46,7 +90,7 @@ int main(int argc, char *argv[]) }; Info<< "table1: " << table1 << nl - << "toc: " << table1.toc() << endl; + << "toc: " << flatOutput(table1.toc()) << nl; HashTable> table2 { @@ -56,31 +100,156 @@ int main(int argc, char *argv[]) }; Info<< "table2: " << table2 << nl - << "toc: " << table2.toc() << endl; + << "toc: " << flatOutput(table2.toc()) << nl; Map