Skip to content

Commit f959cd4

Browse files
committed
Fix missing dataset definitions in CoreTest
1 parent f740cb4 commit f959cd4

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

test/CoreTest.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
using namespace openPMD;
2727

28+
Dataset globalDataset(Datatype::CHAR, {1});
29+
2830
TEST_CASE("versions_test", "[core]")
2931
{
3032
auto const apiVersion = getVersion();
@@ -439,11 +441,11 @@ TEST_CASE("record_constructor_test", "[core]")
439441
ps["position"][RecordComponent::SCALAR].resetDataset(dset);
440442
ps["positionOffset"][RecordComponent::SCALAR].resetDataset(dset);
441443

442-
REQUIRE(r["x"].unitSI() == 1);
444+
REQUIRE(r["x"].resetDataset(dset).unitSI() == 1);
443445
REQUIRE(r["x"].numAttributes() == 1); /* unitSI */
444-
REQUIRE(r["y"].unitSI() == 1);
446+
REQUIRE(r["y"].resetDataset(dset).unitSI() == 1);
445447
REQUIRE(r["y"].numAttributes() == 1); /* unitSI */
446-
REQUIRE(r["z"].unitSI() == 1);
448+
REQUIRE(r["z"].resetDataset(dset).unitSI() == 1);
447449
REQUIRE(r["z"].numAttributes() == 1); /* unitSI */
448450
std::array<double, 7> zeros{{0., 0., 0., 0., 0., 0., 0.}};
449451
REQUIRE(r.unitDimension() == zeros);
@@ -488,13 +490,15 @@ TEST_CASE("recordComponent_modification_test", "[core]")
488490

489491
r["x"].setUnitSI(2.55999e-7);
490492
r["y"].setUnitSI(4.42999e-8);
491-
REQUIRE(r["x"].unitSI() == static_cast<double>(2.55999e-7));
493+
REQUIRE(
494+
r["x"].resetDataset(dset).unitSI() == static_cast<double>(2.55999e-7));
492495
REQUIRE(r["x"].numAttributes() == 1); /* unitSI */
493-
REQUIRE(r["y"].unitSI() == static_cast<double>(4.42999e-8));
496+
REQUIRE(
497+
r["y"].resetDataset(dset).unitSI() == static_cast<double>(4.42999e-8));
494498
REQUIRE(r["y"].numAttributes() == 1); /* unitSI */
495499

496500
r["z"].setUnitSI(1);
497-
REQUIRE(r["z"].unitSI() == static_cast<double>(1));
501+
REQUIRE(r["z"].resetDataset(dset).unitSI() == static_cast<double>(1));
498502
REQUIRE(r["z"].numAttributes() == 1); /* unitSI */
499503
}
500504

@@ -505,13 +509,13 @@ TEST_CASE("mesh_constructor_test", "[core]")
505509
Mesh &m = o.iterations[42].meshes["E"];
506510

507511
std::vector<double> pos{0};
508-
REQUIRE(m["x"].unitSI() == 1);
512+
REQUIRE(m["x"].resetDataset(globalDataset).unitSI() == 1);
509513
REQUIRE(m["x"].numAttributes() == 2); /* unitSI, position */
510514
REQUIRE(m["x"].position<double>() == pos);
511-
REQUIRE(m["y"].unitSI() == 1);
515+
REQUIRE(m["y"].resetDataset(globalDataset).unitSI() == 1);
512516
REQUIRE(m["y"].numAttributes() == 2); /* unitSI, position */
513517
REQUIRE(m["y"].position<double>() == pos);
514-
REQUIRE(m["z"].unitSI() == 1);
518+
REQUIRE(m["z"].resetDataset(globalDataset).unitSI() == 1);
515519
REQUIRE(m["z"].numAttributes() == 2); /* unitSI, position */
516520
REQUIRE(m["z"].position<double>() == pos);
517521
REQUIRE(m.geometry() == Mesh::Geometry::cartesian);
@@ -534,9 +538,9 @@ TEST_CASE("mesh_modification_test", "[core]")
534538
Series o = Series("./MyOutput_%T.json", Access::CREATE);
535539

536540
Mesh &m = o.iterations[42].meshes["E"];
537-
m["x"];
538-
m["y"];
539-
m["z"];
541+
m["x"].resetDataset(globalDataset);
542+
m["y"].resetDataset(globalDataset);
543+
m["z"].resetDataset(globalDataset);
540544

541545
m.setGeometry(Mesh::Geometry::spherical);
542546
REQUIRE(m.geometry() == Mesh::Geometry::spherical);

0 commit comments

Comments
 (0)