STYLE: fix/correct some tests. Remove useless tests

This commit is contained in:
Mark Olesen
2021-06-29 12:28:11 +02:00
parent 6a390f6ad1
commit 8884d58a52
27 changed files with 62 additions and 188 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,11 +28,12 @@ License
#include "HashTable.H"
#include "List.H"
#include "SortableList.H"
#include "DynamicList.H"
#include "FlatOutput.H"
#include "IOstreams.H"
#include "StringStream.H"
#include "ListOps.H"
#include "flipOp.H"
using namespace Foam;
@ -209,12 +210,16 @@ int main()
<< "/" << table1.keys().size()
<< nl;
SortableList<word> sortKeys
// DynamicList<word> sortKeys
List<word> sortKeys
(
ListOps::create<word>
(
table1.keys().begin(),
table1.keys().end()
table1.keys().end(),
noOp{}
)
);
sort(sortKeys);
Info<<"sortKeys: " << flatOutput(sortKeys) << nl;
}

View File

@ -33,6 +33,8 @@ Description
#include "IOstreams.H"
#include "argList.H"
#include "ITstream.H"
#include "ListOps.H"
#include "flipOp.H"
using namespace Foam;
@ -109,7 +111,7 @@ void doTest
<< nl
<< "====" << nl << endl;
ITstream its(name, input);
ITstream its(input);
Info<< "got " << its.size() << " tokens - index at "
<< its.tokenIndex() << endl;
@ -164,7 +166,15 @@ int main(int argc, char *argv[])
string stringInput("( string ; input \"string\" to tokenize )");
List<char> listInput(stringInput.cbegin(), stringInput.cend());
List<char> listInput
(
ListOps::create<char>
(
stringInput.cbegin(),
stringInput.cend(),
Foam::noOp{}
)
);
doTest("empty", "", true, true);

View File

@ -1,8 +0,0 @@
Test-alloc.C
/*
Test-new.C
Test-malloc.C
Test.C
*/
EXE = $(FOAM_USER_APPBIN)/Test-alloc

View File

@ -1,2 +0,0 @@
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
/* EXE_LIBS = -lfiniteVolume */

View File

@ -1,27 +0,0 @@
#include <iostream>
#include <unistd.h>
using namespace std;
int main()
{
int *ptrs[500000];
// for (;;);
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
ptrs[i] = new int[1];
delete[] ptrs[i];
}
for (;;);
cerr << "allocating double\n";
double* array = new double[500000];
for (;;);
}

View File

@ -1,30 +0,0 @@
#include "stream.h"
#include <unistd.h>
#include <cstdlib>
main()
{
int *ptrs[500000];
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
ptrs[i] = (int*)malloc(sizeof(int));
}
// for (;;);
cerr << "deallocating ints\n";
for (i=0; i<500000; i++)
{
free(ptrs[i]);
}
cerr << "allocating double\n";
double* array = (double*)malloc(500000*sizeof(double));
for (;;);
}

View File

@ -1,30 +0,0 @@
#include <stream.h>
main()
{
int* intPtrs[500000];
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
intPtrs[i] = new int[1];
}
cerr << "allocated ints\n";
cerr << "deallocating ints\n";
for (i=0; i<500000; i++)
{
delete[] intPtrs[i];
}
cerr << "deallocated ints\n";
cerr << "alloacting doubles\n";
double* doubles = new double[500000];
for (;;);
}

View File

@ -1,64 +0,0 @@
#include <cstdlib>
class Int
{
int I;
public:
Int(){}
operator int()
{
return I;
}
};
template<class T>
class List : public T
{
T* v;
int sz;
public:
List()
{
v = new T[sz=10];
}
List(int s)
{
v = new T[sz=s];
}
~List()
{
delete[] v;
}
inline int size() const;
};
template<class T>
inline int List<T>::size() const
{
return sz;
}
#include <stream.h>
main()
{
typedef List<Int> intList;
intList list(10);
cout << list.size() << "\n";
return 0;
}

View File

@ -390,7 +390,7 @@ int main(int argc, char *argv[])
// Info<< list5 << " indices: " << list5.toc() << nl;
Info<< "\nassign from indices\n";
list4.read
list4.readList
(
IStringStream
(

View File

@ -58,6 +58,8 @@ int main(int argc, char *argv[])
Info<< fvc::div(U);
Info<< "End\n" << endl;
return 0;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -187,9 +187,7 @@ int main(int argc, char *argv[])
Sout.precision(16);
const scalar SMALLS(1e-6);
const vector SMALLV(SMALLS, SMALLS, SMALLS);
const scalar GREATS(1e6);
const vector GREATV(GREATS, GREATS, GREATS);
// scalarField summation
{
@ -203,9 +201,9 @@ int main(int argc, char *argv[])
}
// vectorField summation
{
vectorField vfield(10, SMALLV);
vectorField vfield(10, vector::uniform(SMALLS));
vfield[8] = GREATV;
vfield[8] = vector::uniform(GREATS);
vfield[9] = -vfield[8];
Info<< "vectorField:" << vfield.size() << nl
<< " sum :" << sum(vfield) << nl
@ -213,9 +211,9 @@ int main(int argc, char *argv[])
}
// sphericalTensorField summation
{
sphericalTensorField tfield(10, SMALLS);
sphericalTensorField tfield(10, sphericalTensor(SMALLS));
tfield[8] = GREATS;
tfield[8] = sphericalTensor(GREATS);
tfield[9] = -tfield[8];
Info<< "sphericalTensorField:" << tfield.size() << nl
<< " sum :" << sum(tfield) << nl
@ -243,7 +241,6 @@ int main(int argc, char *argv[])
}
return 0;
}

View File

@ -60,6 +60,8 @@ int main(int argc, char *argv[])
}
Info<< "End\n" << endl;
return 0;
}

View File

@ -68,6 +68,8 @@ int main(int argc, char *argv[])
);
Info<< "End\n" << endl;
return 0;
}

View File

@ -68,6 +68,8 @@ int main()
phi.write("phi", "xmgr");
Info<< "End\n" << endl;
return 0;
}

View File

@ -60,6 +60,8 @@ int main()
);
Info<< "End\n" << endl;
return 0;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -157,7 +157,6 @@ int main(int argc, char *argv[])
{
ITstream input
(
"input",
"(plain list with some with list duplicates)"
);

View File

@ -74,6 +74,9 @@ int main(void)
Info.operator Foam::OSstream&() << "stop" << endl;
static_cast<OSstream&>(Info) << "\nEnd\n" << nl;
return 0;
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -79,8 +79,7 @@ int main(int argc, char *argv[])
"hij_",
};
labelRange range(-10, 40);
labelList values(range.begin(), range.end());
labelList values(identity(40, -10));
Info<<"words: " << flatOutput(words) << endl;
Info<<"values: " << flatOutput(values) << endl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
{
Info<< nl;
for (const word& item : readDir(".", listType))
for (const auto& item : readDir(".", listType))
{
Info<< " " << item << nl;
}

View File

@ -1,11 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsurfMesh \
-lmeshTools \
-lsampling \
-lgeometricVoF

View File

@ -74,7 +74,7 @@ int main(int argc, char *argv[])
);
Info<< "create field phi\n" << endl;
surfaceScalarField phi = fvc::interpolate(U) & mesh.Sf();
surfaceScalarField phi(fvc::interpolate(U) & mesh.Sf());
dictionary dict = mesh.solverDict(alpha1.name());
@ -120,6 +120,7 @@ int main(int argc, char *argv[])
Info<< "Time " << runTime.cpuTimeIncrement() << endl;
#if 0
distFunc.constructRDF
(
surf->interfaceCell(),
@ -128,6 +129,7 @@ int main(int argc, char *argv[])
2,
exchangeFields_
);
#endif
}
runTime.write();

View File

@ -94,6 +94,8 @@ int main()
}
Info<< "\nEnd" << endl;
return 0;
}

View File

@ -72,7 +72,7 @@ void testDivide(const List<Tuple2<T, scalar>>& list)
void testModulo(const List<Tuple2<scalar, scalar>>& list)
{
const scalarModuloOp<> bop;
const scalarModuloOp<scalar> bop;
for (const auto& pair : list)
{

View File

@ -189,4 +189,6 @@ int main()
Snull<< sf4[1] << endl << endl;
}
return 0;
}

View File

@ -36,4 +36,6 @@ int main()
Snull<< vf4[1] << endl << endl;
}
return 0;
}

View File

@ -119,6 +119,8 @@ int main()
}
Info<< "\nEnd" << endl;
return 0;
}

View File

@ -91,7 +91,7 @@ void exptl_reading(Istream& is, wordRes& list)
bool testReadList_wordRes(const std::string& input)
{
ITstream is("input", input);
ITstream is(input);
wordRes list;
exptl_reading(is, list);