diff --git a/applications/test/PackedList/PackedListTest.C b/applications/test/PackedList/PackedListTest.C index 05f3a077f8..0c8528bd1c 100644 --- a/applications/test/PackedList/PackedListTest.C +++ b/applications/test/PackedList/PackedListTest.C @@ -28,8 +28,11 @@ Description \*---------------------------------------------------------------------------*/ +#include "argList.H" #include "uLabel.H" +#include "IOobject.H" #include "IOstreams.H" +#include "IFstream.H" #include "PackedBoolList.H" using namespace Foam; @@ -39,309 +42,54 @@ using namespace Foam; int main(int argc, char *argv[]) { - Info<< "PackedList max_bits() = " << PackedList<>::max_bits() << nl; + argList::noParallel(); + argList::validArgs.insert("file .. fileN"); - Info<< "\ntest allocation with value\n"; - PackedList<3> list1(5,1); - list1.print(Info); + argList::validOptions.insert("count", ""); + argList::validOptions.insert("info", ""); - Info<< "\ntest assign uniform value\n"; - list1 = 3; - list1.print(Info); + argList args(argc, argv, false, true); - Info<< "\ntest assign uniform value (with overflow)\n"; - list1 = -1; - list1.print(Info); - - Info<< "\ntest zero\n"; - list1 = 0; - list1.print(Info); - - Info<< "\ntest set() with default argument (max_value)\n"; - list1.set(3); - list1.print(Info); - - Info<< "\ntest assign between references\n"; - list1[2] = 3; - list1[4] = list1[2]; - list1.print(Info); - - Info<< "\ntest assign between references, with chaining\n"; - list1[0] = list1[4] = 1; - list1.print(Info); - - Info<< "\ntest assign between references, with chaining and auto-vivify\n"; - list1[1] = list1[8] = list1[10] = list1[14] = 2; - list1.print(Info); - - - Info<< "\ntest operator== between references\n"; - if (list1[1] == list1[8]) + if (args.additionalArgs().empty()) { - Info<< "[1] == [8] (expected)\n"; - } - else - { - Info<< "[1] != [8] (unexpected)\n"; + args.printUsage(); } - if (list1[0] != list1[1]) + forAll(args.additionalArgs(), argI) { - Info<< "[0] != [1] (expected)\n"; + const string& srcFile = args.additionalArgs()[argI]; + Info<< nl << "reading " << srcFile << nl; + + IFstream ifs(srcFile); + List