|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
The DNDSR project uses the doctest (v2.4.11) framework for C++ unit testing. Test sources live under test/cpp/DNDS/ and are built only when DNDS_BUILD_TESTS=ON.
Every MPI-aware test is registered with CTest at four process counts (np = 1, 2, 4, 8) so that correctness under parallel execution is verified automatically.
| CMake target | CTest names | Source file |
|---|---|---|
dnds_test_array | dnds_array | test_Array.cpp |
dnds_test_mpi | dnds_mpi_np{1,2,4} | test_MPI.cpp |
dnds_test_array_transformer | dnds_array_transformer_np{1,2,4} | test_ArrayTransformer.cpp |
dnds_test_array_derived | dnds_array_derived_np{1,2,4} | test_ArrayDerived.cpp |
dnds_test_array_dof | dnds_array_dof_np{1,2,4} | test_ArrayDOF.cpp |
dnds_test_index_mapping | dnds_index_mapping_np{1,2,4} | test_IndexMapping.cpp |
dnds_test_serializer | dnds_serializer_np{1,2,4} | test_Serializer.cpp |
Because doctest includes <cstring> which transitively pulls in the POSIX index() function from <strings.h>, the bare name index is ambiguous when using namespace DNDS; is active. All test files therefore qualify the DNDS type aliases as DNDS::index, DNDS::real, and DNDS::rowsize in declarations.
Serial-only tests covering every DNDS::Array data layout:
Array<real, 3>: compile-time fixed row size. Validates Size(), RowSize(), element read/write via operator() and operator[], DataSize(), DataSizeBytes().Array<real, DynamicSize>: runtime-uniform row size.Array<real, NonUniformSize, 4>: per-row variable sizes up to a compile-time maximum.Array<real, NonUniformSize, DynamicSize>: per-row variable sizes up to a runtime maximum.Array<real, NonUniformSize>: compressed sparse row. Tests lambda-based Resize, Compress/Decompress round-trips, ResizeRow in decompressed mode.clone(), CopyData(), copy constructor, SwapData() independence checks.GetArraySignature(), ParseArraySignatureTuple(), ArraySignatureIsCompatible().Run at np = 1, 2, 4, 8. All expected values are formulated in terms of mpi.size so they hold for any rank count.
setWorld(), field validity, equality.MPI_SUM and MPI_MAX for real and index; AllreduceOneReal, AllreduceOneIndex.MPI_SUCCESS.std::array, Eigen::Matrix.HIndexed/InSituPack.Exercises ghost (halo) communication at np = 1, 2, 4, 8.
createGlobalMapping(), globalSize(), AssertConsistent().std::array<real,9> as the element type.initPersistentPull / startPersistentPull / waitPersistentPull, then modify father and re-pull.pushOnce(), verify father received values.Covers every derived array type at np = 1, 2, 4, 8.
operator[], rowPtr()), ghost communication, clone, fixed-size variant.InitializeWriteRow, BatchSize, operator(), ghost communication.ResizeBatch.Tests every vector-space operation on DNDS::ArrayDof at np = 1, 2, 4, 8. All MPI-global reductions (norm2, dot, min, max, sum, componentWiseNorm1) use rank-aware expected values.
setConstant (scalar and matrix)operator+= (scalar, array, matrix)operator-=, operator*= (scalar, element-wise, matrix)operator/=addTonorm2, norm2(other) (L2 distance)dotmin, max, sumcomponentWiseNorm1, componentWiseNorm1(other)operator= (value copy), clone (deep copy)ArrayDof<N,1> *= ArrayDof<1,1>)dot(x, x) == norm2(x)^2Tests global/local index mapping at np = 1, 2, 4, 8.
search() for first/last/middle/out-of-range indices.searchInMain, searchInGhost, searchInAllGhost, search, search_indexAppend, operator() reverse mapping, empty ghost set.Round-trip write/read verification at np = 1, 2, 4, 8.
WriteInt/ReadInt, WriteIndex/ReadIndex, WriteReal/ReadReal, WriteString/ReadString.WriteRealVector, WriteIndexVector, WriteRowsizeVector.CreatePath, GoToPath, GetCurrentPath, ListCurrentPath.WriteInt/ReadInt, WriteIndex/ReadIndex, WriteReal/ReadReal, WriteString/ReadString (HDF5 attributes).WriteRealVector, WriteIndexVector with explicit ArrayGlobalOffset; read with ArrayGlobalOffset_Unknown auto-detection from the rank_offsets companion dataset.ArrayGlobalOffset_Unknown and explicit offset.GoToPath, GetCurrentPath, ListCurrentPath (groups materialized by writing content).