From b2f8f0a5a84d7e6abd60e3cea4281b766c689883 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 22 Dec 2022 10:14:29 +0100 Subject: [PATCH] more TEST_F -> TEST --- .../Consistence/ConsistenceTests.cpp | 14 +++---- Tests/Functional/Fitting/FitTests.cpp | 28 ++++++------- Tests/Functional/LibFit/MinimizerTests.cpp | 40 +++++++++---------- Tests/Unit/GUI/TestDetectorItems.cpp | 6 +-- Tests/Unit/GUI/TestFitParameterModel.cpp | 10 ++--- Tests/Unit/GUI/TestFormFactorItems.cpp | 4 +- Tests/Unit/GUI/TestHelpers.cpp | 4 +- Tests/Unit/GUI/TestInstrumentItems.cpp | 6 +-- Tests/Unit/GUI/TestLinkInstrument.cpp | 4 +- Tests/Unit/GUI/TestMaterialItems.cpp | 20 +++++----- Tests/Unit/GUI/TestProfileItems.cpp | 4 +- Tests/Unit/GUI/TestRealDataModel.cpp | 6 +-- Tests/Unit/GUI/TestScientificSpinBox.cpp | 8 ++-- Tests/Unit/GUI/TestSessionItem.cpp | 20 +++++----- Tests/Unit/GUI/TestSessionItemData.cpp | 6 +-- Tests/Unit/GUI/TestSessionItemUtils.cpp | 8 ++-- Tests/Unit/GUI/TestSessionModel.cpp | 12 +++--- Tests/Unit/GUI/TestSessionXML.cpp | 24 +++++------ Tests/Unit/GUI/TestUpdateTimer.cpp | 4 +- 19 files changed, 95 insertions(+), 133 deletions(-) diff --git a/Tests/Functional/Consistence/ConsistenceTests.cpp b/Tests/Functional/Consistence/ConsistenceTests.cpp index 7db6ab0f776..c6e78888464 100644 --- a/Tests/Functional/Consistence/ConsistenceTests.cpp +++ b/Tests/Functional/Consistence/ConsistenceTests.cpp @@ -27,33 +27,31 @@ int compareTwoReferences(const std::string& name0, const std::string& name1, double limit); -class Consistence : public ::testing::Test {}; - -TEST_F(Consistence, SpecularWithSlicing) +TEST(Consistence, SpecularWithSlicing) { EXPECT_TRUE(compareTwoReferences("SpecularWithSlicing1", "SpecularWithSlicing2", 2e-10)); EXPECT_TRUE(compareTwoReferences("SpecularWithSlicing1", "SpecularWithSlicing3", 2e-10)); } -TEST_F(Consistence, InstrumentDefinitionComparison) +TEST(Consistence, InstrumentDefinitionComparison) { EXPECT_TRUE(compareTwoReferences("InstrumentDefinitionComparison_0", "InstrumentDefinitionComparison_Q", 2e-10)); } -TEST_F(Consistence, TOFResolutionComparison) +TEST(Consistence, TOFResolutionComparison) { EXPECT_TRUE( compareTwoReferences("TOFResolutionComparison_TP", "TOFResolutionComparison_TR", 2e-10)); } -TEST_F(Consistence, PolarizedQAngleReflectivity) +TEST(Consistence, PolarizedQAngleReflectivity) { EXPECT_TRUE(compareTwoReferences("BasicSpecularPP", "PolarizedQAngleReflectivityPP_Q", 2e-10)); EXPECT_TRUE(compareTwoReferences("BasicSpecularMM", "PolarizedQAngleReflectivityMM_Q", 2e-10)); } -TEST_F(Consistence, PolarizedScalarSpinFlip) +TEST(Consistence, PolarizedScalarSpinFlip) { auto* sample = ExemplarySamples::createPlainMultiLayerBySLD(); auto simulation = test::makeSimulation::BasicYPolarizedSpecular(*sample, "PM", false); @@ -63,7 +61,7 @@ TEST_F(Consistence, PolarizedScalarSpinFlip) EXPECT_EQ(r, 0); } -TEST_F(Consistence, PolarizedScalarSpinFlipParticles) +TEST(Consistence, PolarizedScalarSpinFlipParticles) { auto* sample = ExemplarySamples::createCylindersAndPrisms(); auto simulation = test::makeSimulation::MiniZPolarizedGISAS(*sample, "PM"); diff --git a/Tests/Functional/Fitting/FitTests.cpp b/Tests/Functional/Fitting/FitTests.cpp index 31ccec40c72..1e404101c01 100644 --- a/Tests/Functional/Fitting/FitTests.cpp +++ b/Tests/Functional/Fitting/FitTests.cpp @@ -33,8 +33,6 @@ using mumufit::Parameter; using Units::deg; using Units::nm; -class Fitting : public ::testing::Test {}; - bool runFitTest(const std::string& minimizer_name, const std::string& algorithm_name, const SimfitTestPlan& plan, const std::string& options = "") { @@ -156,7 +154,7 @@ const MultipleSpecPlan multispecPlan( // tests // ************************************************************************************************ -TEST_F(Fitting, MigradCylindersInBA) +TEST(Fitting, MigradCylindersInBA) { SimfitTestPlan plan( build_CylBA_MiniGISAS, false, @@ -165,45 +163,45 @@ TEST_F(Fitting, MigradCylindersInBA) EXPECT_TRUE(runFitTest("Minuit2", "Migrad", plan)); } -TEST_F(Fitting, MigradResidualCylindersInBA) +TEST(Fitting, MigradResidualCylindersInBA) { EXPECT_TRUE(runFitTest("Minuit2", "Migrad", cylindersInBAResidualPlan)); } -TEST_F(Fitting, BfgsCylindersInBA) +TEST(Fitting, BfgsCylindersInBA) { EXPECT_TRUE(runFitTest("GSLMultiMin", "BFGS2", cylindersInBAEasyPlan)); } /* TODO: restore -TEST_F(Fitting, SteepestDescentCylindersInBA) +TEST(Fitting, SteepestDescentCylindersInBA) { EXPECT_TRUE(runFitTest("GSLMultiMin", "SteepestDescent", cylindersInBAEasyPlan)); } */ -TEST_F(Fitting, FumuliCylindersInBA) +TEST(Fitting, FumuliCylindersInBA) { EXPECT_TRUE(runFitTest("Minuit2", "Fumili", cylindersInBAResidualPlan)); } -TEST_F(Fitting, LevenbergMarquardtCylindersInBA) +TEST(Fitting, LevenbergMarquardtCylindersInBA) { EXPECT_TRUE(runFitTest("GSLLMA", "", cylindersInBAResidualPlan)); } -TEST_F(Fitting, SimAnCylindersInBA) +TEST(Fitting, SimAnCylindersInBA) { EXPECT_TRUE(runFitTest("GSLSimAn", "", cylindersInBAEasyPlan, "IterationsAtTemp=5;MaxIterations=10;t_min=1.0")); } -TEST_F(Fitting, GeneticCylindersInBA) +TEST(Fitting, GeneticCylindersInBA) { EXPECT_TRUE(runFitTest("Genetic", "", cylindersInBAEasyPlan, "MaxIterations=1;RandomSeed=1")); } -TEST_F(Fitting, RectDetectorFit) +TEST(Fitting, RectDetectorFit) { SimfitTestPlan plan( build_CylBA_Masked, false, @@ -212,22 +210,22 @@ TEST_F(Fitting, RectDetectorFit) EXPECT_TRUE(runFitTest("Minuit2", "Migrad", plan, "Strategy=2")); } -TEST_F(Fitting, SpecularFitTest) +TEST(Fitting, SpecularFitTest) { EXPECT_TRUE(runFitTest("Minuit2", "Migrad", specularPlan)); } -TEST_F(Fitting, SpecularFitTestQ) +TEST(Fitting, SpecularFitTestQ) { EXPECT_TRUE(runFitTest("Minuit2", "Migrad", specularPlanQ)); } -TEST_F(Fitting, MultipleSpecFittingTest) +TEST(Fitting, MultipleSpecFittingTest) { EXPECT_TRUE(runFitTest("Minuit2", "Migrad", multispecPlan)); } -TEST_F(Fitting, OffspecFitTest) +TEST(Fitting, OffspecFitTest) { EXPECT_TRUE(runFitTest("Minuit2", "Migrad", offspecPlan)); } diff --git a/Tests/Functional/LibFit/MinimizerTests.cpp b/Tests/Functional/LibFit/MinimizerTests.cpp index 7ebb367ea45..8e8c945e429 100644 --- a/Tests/Functional/LibFit/MinimizerTests.cpp +++ b/Tests/Functional/LibFit/MinimizerTests.cpp @@ -16,8 +16,6 @@ #include "Tests/Functional/LibFit/PlanCases.h" #include "Tests/GTestWrapper/google_test.h" -class Minimize : public ::testing::Test {}; - bool runMinimizerTest(const std::string& minimizer_name, const std::string& algorithm_name, MinimizerTestPlan& plan, const std::string& options = "") { @@ -27,117 +25,117 @@ bool runMinimizerTest(const std::string& minimizer_name, const std::string& algo } -TEST_F(Minimize, Minuit_Rosenbrock) +TEST(Minimize, Minuit_Rosenbrock) { RosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("Minuit2", "Migrad", plan)); } -TEST_F(Minimize, Minuit_WoodFour) +TEST(Minimize, Minuit_WoodFour) { WoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("Minuit2", "Migrad", plan)); } -TEST_F(Minimize, Minuit_DecayingSin) +TEST(Minimize, Minuit_DecayingSin) { DecayingSinPlan plan; EXPECT_TRUE(runMinimizerTest("Minuit2", "Migrad", plan)); } /* known to fail -TEST_F(Minimize, SteepestDescent_Rosenbrock) +TEST(Minimize, SteepestDescent_Rosenbrock) { RosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "SteepestDescent", plan)); } */ -TEST_F(Minimize, SteepestDescent_WoodFour) +TEST(Minimize, SteepestDescent_WoodFour) { WoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "SteepestDescent", plan)); } -TEST_F(Minimize, ConjugateFR_Rosenbrock) +TEST(Minimize, ConjugateFR_Rosenbrock) { RosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "ConjugateFR", plan)); } -TEST_F(Minimize, ConjugateFR_WoodFour) +TEST(Minimize, ConjugateFR_WoodFour) { WoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "ConjugateFR", plan)); } -TEST_F(Minimize, ConjugatePR_Rosenbrock) +TEST(Minimize, ConjugatePR_Rosenbrock) { RosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "ConjugatePR", plan)); } -TEST_F(Minimize, ConjugatePR_WoodFour) +TEST(Minimize, ConjugatePR_WoodFour) { WoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "ConjugatePR", plan)); } -TEST_F(Minimize, Bfgs_Rosenbrock) +TEST(Minimize, Bfgs_Rosenbrock) { RosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "BFGS", plan)); } -TEST_F(Minimize, Bfgs_WoodFour) +TEST(Minimize, Bfgs_WoodFour) { WoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "BFGS", plan)); } -TEST_F(Minimize, Bfgs2_Rosenbrock) +TEST(Minimize, Bfgs2_Rosenbrock) { RosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "BFGS2", plan)); } -TEST_F(Minimize, Bfgs2_WoodFour) +TEST(Minimize, Bfgs2_WoodFour) { WoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("GSLMultiMin", "BFGS2", plan)); } -TEST_F(Minimize, GSLSimAn_EasyRosenbrock) +TEST(Minimize, GSLSimAn_EasyRosenbrock) { EasyRosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("GSLSimAn", "Simulated annealing", plan)); } -TEST_F(Minimize, GSLSimAn_EasyWoodFour) +TEST(Minimize, GSLSimAn_EasyWoodFour) { EasyWoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("GSLSimAn", "Simulated annealing", plan)); } -TEST_F(Minimize, Genetic_EasyRosenbrock) +TEST(Minimize, Genetic_EasyRosenbrock) { EasyRosenbrockPlan plan; EXPECT_TRUE(runMinimizerTest("Genetic", "Genetic", plan, "RandomSeed=1")); } -TEST_F(Minimize, Genetic_EasyWoodFour) +TEST(Minimize, Genetic_EasyWoodFour) { EasyWoodFourPlan plan; EXPECT_TRUE(runMinimizerTest("Genetic", "Genetic", plan, "RandomSeed=1")); } -TEST_F(Minimize, Fumili_DecayingSin) +TEST(Minimize, Fumili_DecayingSin) { DecayingSinPlan plan; EXPECT_TRUE(runMinimizerTest("Minuit2", "Fumili", plan, "MaxFunctionCalls=10000")); } -TEST_F(Minimize, LevenbergMarquardtV3) +TEST(Minimize, LevenbergMarquardtV3) { DecayingSinPlanV2 plan; EXPECT_TRUE(runMinimizerTest("GSLLMA", "Levenberg-Marquardt", plan)); diff --git a/Tests/Unit/GUI/TestDetectorItems.cpp b/Tests/Unit/GUI/TestDetectorItems.cpp index 2f22a28f1f1..d863d658c0a 100644 --- a/Tests/Unit/GUI/TestDetectorItems.cpp +++ b/Tests/Unit/GUI/TestDetectorItems.cpp @@ -10,9 +10,7 @@ #include "GUI/Support/Type/Unit.h" #include "Tests/GTestWrapper/google_test.h" -class TestDetectorItems : public ::testing::Test {}; - -TEST_F(TestDetectorItems, resolutionFunction) +TEST(TestDetectorItems, resolutionFunction) { InstrumentCollection model; auto* instrument = model.addInstrument<GISASInstrumentItem>(); @@ -30,7 +28,7 @@ TEST_F(TestDetectorItems, resolutionFunction) EXPECT_EQ(Units::rad2deg(gaussian->sigmaX()), 0.02); } -TEST_F(TestDetectorItems, resolutionFunctionUnit) +TEST(TestDetectorItems, resolutionFunctionUnit) { const auto asString = [](const std::variant<QString, Unit>& unit) { return std::holds_alternative<QString>(unit) ? std::get<QString>(unit) diff --git a/Tests/Unit/GUI/TestFitParameterModel.cpp b/Tests/Unit/GUI/TestFitParameterModel.cpp index 9c0b90a9091..90f359356ed 100644 --- a/Tests/Unit/GUI/TestFitParameterModel.cpp +++ b/Tests/Unit/GUI/TestFitParameterModel.cpp @@ -6,9 +6,7 @@ #include "GUI/Model/Model/FitParameterModel.h" #include "Tests/GTestWrapper/google_test.h" -class TestFitParameterModel : public ::testing::Test {}; - -TEST_F(TestFitParameterModel, InitialState) +TEST(TestFitParameterModel, InitialState) { JobItem* jobItem = nullptr; FitSuiteItem fitSuiteItem; @@ -21,7 +19,7 @@ TEST_F(TestFitParameterModel, InitialState) EXPECT_EQ(container, proxy.itemForIndex(QModelIndex())); } -TEST_F(TestFitParameterModel, addFitParameter) +TEST(TestFitParameterModel, addFitParameter) { JobItem* jobItem = nullptr; FitSuiteItem fitSuiteItem; @@ -117,7 +115,7 @@ TEST_F(TestFitParameterModel, addFitParameter) EXPECT_EQ(index, proxy.indexOfItem(fitPar1->startValueItem())); } -TEST_F(TestFitParameterModel, addFitParameterAndLink) +TEST(TestFitParameterModel, addFitParameterAndLink) { JobItem* jobItem = nullptr; FitSuiteItem fitSuiteItem; @@ -177,7 +175,7 @@ TEST_F(TestFitParameterModel, addFitParameterAndLink) EXPECT_EQ(proxy.itemForIndex(linkIndex), link1->linkItem()); } -TEST_F(TestFitParameterModel, addTwoFitParameterAndLinks) +TEST(TestFitParameterModel, addTwoFitParameterAndLinks) { JobItem* jobItem = nullptr; FitSuiteItem fitSuiteItem; diff --git a/Tests/Unit/GUI/TestFormFactorItems.cpp b/Tests/Unit/GUI/TestFormFactorItems.cpp index 7fb31827d89..7a20ecf3821 100644 --- a/Tests/Unit/GUI/TestFormFactorItems.cpp +++ b/Tests/Unit/GUI/TestFormFactorItems.cpp @@ -4,9 +4,7 @@ #include "Sample/HardParticle/Polyhedra.h" #include "Tests/GTestWrapper/google_test.h" -class TestFormFactorItems : public ::testing::Test {}; - -TEST_F(TestFormFactorItems, Pyramid2Item) +TEST(TestFormFactorItems, Pyramid2Item) { // to domain Pyramid2Item item; diff --git a/Tests/Unit/GUI/TestHelpers.cpp b/Tests/Unit/GUI/TestHelpers.cpp index bda415f1ffc..54b125bad62 100644 --- a/Tests/Unit/GUI/TestHelpers.cpp +++ b/Tests/Unit/GUI/TestHelpers.cpp @@ -1,9 +1,7 @@ #include "GUI/Util/Path.h" #include "Tests/GTestWrapper/google_test.h" -class TestHelpers : public ::testing::Test {}; - -TEST_F(TestHelpers, VersionString) +TEST(TestHelpers, VersionString) { int vmajor(0), vminor(0), vpatch(0); diff --git a/Tests/Unit/GUI/TestInstrumentItems.cpp b/Tests/Unit/GUI/TestInstrumentItems.cpp index fd2a8e05b13..2ce22fb5ac9 100644 --- a/Tests/Unit/GUI/TestInstrumentItems.cpp +++ b/Tests/Unit/GUI/TestInstrumentItems.cpp @@ -5,11 +5,9 @@ Q_DECLARE_METATYPE(const InstrumentItem*) -class TestInstrumentCollection : public ::testing::Test {}; - //! Checks whether instrumentAddedRemoved will be emitted as expected -TEST_F(TestInstrumentCollection, instrumentAddedRemoved) +TEST(TestInstrumentCollection, instrumentAddedRemoved) { ProjectDocument document; @@ -28,7 +26,7 @@ TEST_F(TestInstrumentCollection, instrumentAddedRemoved) } //! Test whether instrumentChanged will be emitted as expected -TEST_F(TestInstrumentCollection, instrumentChanged) +TEST(TestInstrumentCollection, instrumentChanged) { qRegisterMetaType<const InstrumentItem*>(); ProjectDocument document; diff --git a/Tests/Unit/GUI/TestLinkInstrument.cpp b/Tests/Unit/GUI/TestLinkInstrument.cpp index afdb4a1de45..33e7b4c2d1b 100644 --- a/Tests/Unit/GUI/TestLinkInstrument.cpp +++ b/Tests/Unit/GUI/TestLinkInstrument.cpp @@ -11,8 +11,6 @@ #include <QSignalSpy> #include <QTest> -class TestLinkInstrument : public ::testing::Test {}; - QList<RealItem*> linkedRealDataItems(RealModel& realModel, const InstrumentItem* instrumentItem) { ASSERT(instrumentItem); @@ -28,7 +26,7 @@ QList<RealItem*> linkedRealDataItems(RealModel& realModel, const InstrumentItem* return result; } -TEST_F(TestLinkInstrument, canLinkToInstrument) +TEST(TestLinkInstrument, canLinkToInstrument) { ProjectDocument document; diff --git a/Tests/Unit/GUI/TestMaterialItems.cpp b/Tests/Unit/GUI/TestMaterialItems.cpp index 012b905dfcd..74f051870b2 100644 --- a/Tests/Unit/GUI/TestMaterialItems.cpp +++ b/Tests/Unit/GUI/TestMaterialItems.cpp @@ -4,9 +4,7 @@ #include "Tests/GTestWrapper/google_test.h" #include <memory> -class TestMaterialModel : public ::testing::Test {}; - -TEST_F(TestMaterialModel, addRefractiveMaterial) +TEST(TestMaterialModel, addRefractiveMaterial) { std::unique_ptr<MaterialModel> model(new MaterialModel); @@ -24,7 +22,7 @@ TEST_F(TestMaterialModel, addRefractiveMaterial) EXPECT_EQ(material->beta(), beta); } -TEST_F(TestMaterialModel, addSLDMaterial) +TEST(TestMaterialModel, addSLDMaterial) { std::unique_ptr<MaterialModel> model(new MaterialModel); @@ -42,7 +40,7 @@ TEST_F(TestMaterialModel, addSLDMaterial) EXPECT_EQ(material->sldIm(), sld_imag); } -TEST_F(TestMaterialModel, cloneMaterialRefractive) +TEST(TestMaterialModel, cloneMaterialRefractive) { std::unique_ptr<MaterialModel> model(new MaterialModel); @@ -69,7 +67,7 @@ TEST_F(TestMaterialModel, cloneMaterialRefractive) EXPECT_EQ(material->beta(), beta); } -TEST_F(TestMaterialModel, cloneMaterialSLD) +TEST(TestMaterialModel, cloneMaterialSLD) { std::unique_ptr<MaterialModel> model(new MaterialModel); @@ -98,7 +96,7 @@ TEST_F(TestMaterialModel, cloneMaterialSLD) //! Checks the method which returns MaterialItem from known identifier. -TEST_F(TestMaterialModel, materialFromIdentifier) +TEST(TestMaterialModel, materialFromIdentifier) { MaterialModel model; MaterialItem* material1 = model.addRefractiveMaterial("aaa", 1.0, 2.0); @@ -110,7 +108,7 @@ TEST_F(TestMaterialModel, materialFromIdentifier) //! Checks the method which returns MaterialItem from material name. -TEST_F(TestMaterialModel, materialFromName) +TEST(TestMaterialModel, materialFromName) { MaterialModel model; MaterialItem* material1 = model.addRefractiveMaterial("aaa", 1.0, 2.0); @@ -122,7 +120,7 @@ TEST_F(TestMaterialModel, materialFromName) //! Default MaterialProperty construction. -TEST_F(TestMaterialModel, defaultMaterialProperty) +TEST(TestMaterialModel, defaultMaterialProperty) { MaterialModel model; @@ -135,7 +133,7 @@ TEST_F(TestMaterialModel, defaultMaterialProperty) EXPECT_EQ(model.defaultMaterial(), mat1); } -TEST_F(TestMaterialModel, serializeRefractiveMaterial) +TEST(TestMaterialModel, serializeRefractiveMaterial) { MaterialItem material; material.setRefractiveIndex(11, 12); @@ -158,7 +156,7 @@ TEST_F(TestMaterialModel, serializeRefractiveMaterial) EXPECT_EQ(target.magnetization().r3(), R3(1, 2, 3)); } -TEST_F(TestMaterialModel, serializeSLDMaterial) +TEST(TestMaterialModel, serializeSLDMaterial) { MaterialItem material; material.setScatteringLengthDensity(complex_t(11, 12)); diff --git a/Tests/Unit/GUI/TestProfileItems.cpp b/Tests/Unit/GUI/TestProfileItems.cpp index 646fb49b96f..3172f753061 100644 --- a/Tests/Unit/GUI/TestProfileItems.cpp +++ b/Tests/Unit/GUI/TestProfileItems.cpp @@ -1,9 +1,7 @@ #include "GUI/Model/Sample/ProfileItems.h" #include "Tests/GTestWrapper/google_test.h" -class TestProfileItems : public ::testing::Test {}; - -TEST_F(TestProfileItems, Profile1DCauchy) +TEST(TestProfileItems, Profile1DCauchy) { // to domain Profile1DCauchyItem item; diff --git a/Tests/Unit/GUI/TestRealDataModel.cpp b/Tests/Unit/GUI/TestRealDataModel.cpp index 4619c78cd1e..e7058dfb8e5 100644 --- a/Tests/Unit/GUI/TestRealDataModel.cpp +++ b/Tests/Unit/GUI/TestRealDataModel.cpp @@ -5,11 +5,9 @@ #include "Tests/GTestWrapper/google_test.h" #include <QSignalSpy> -class TestRealDataModel : public ::testing::Test {}; - //! Checks that LinkInstrumentManager listens instrument model. -TEST_F(TestRealDataModel, realDataAddedRemoved) +TEST(TestRealDataModel, realDataAddedRemoved) { RealModel model; @@ -33,7 +31,7 @@ TEST_F(TestRealDataModel, realDataAddedRemoved) ASSERT_EQ(spy.count(), 4); } -TEST_F(TestRealDataModel, removeNativeData) +TEST(TestRealDataModel, removeNativeData) { RealModel model; diff --git a/Tests/Unit/GUI/TestScientificSpinBox.cpp b/Tests/Unit/GUI/TestScientificSpinBox.cpp index 2dfabe215a0..d48ac17d1b1 100644 --- a/Tests/Unit/GUI/TestScientificSpinBox.cpp +++ b/Tests/Unit/GUI/TestScientificSpinBox.cpp @@ -2,9 +2,7 @@ #include "Tests/GTestWrapper/google_test.h" #include <limits> -class TestScientificSpinBox : public ::testing::Test {}; - -TEST_F(TestScientificSpinBox, testValueFromText) +TEST(TestScientificSpinBox, testValueFromText) { QLocale locale(QLocale::C); locale.setNumberOptions(QLocale::RejectGroupSeparator); @@ -50,7 +48,7 @@ TEST_F(TestScientificSpinBox, testValueFromText) EXPECT_EQ(0.012, to_value_2("0.012")); } -TEST_F(TestScientificSpinBox, testTextFromValue) +TEST(TestScientificSpinBox, testTextFromValue) { int decimals = 3; auto to_string = [&decimals](double val) { return ScientificSpinBox::toString(val, decimals); }; @@ -98,7 +96,7 @@ TEST_F(TestScientificSpinBox, testTextFromValue) EXPECT_EQ("1.26556e+12", to_string(1.265556e+12).toStdString()); } -TEST_F(TestScientificSpinBox, testRound) +TEST(TestScientificSpinBox, testRound) { auto round_3 = [](double val) { return ScientificSpinBox::round(val, 3); }; EXPECT_DOUBLE_EQ(1.232e-12, round_3(1.2323e-12)); diff --git a/Tests/Unit/GUI/TestSessionItem.cpp b/Tests/Unit/GUI/TestSessionItem.cpp index f48850498a9..40e0b863ed8 100644 --- a/Tests/Unit/GUI/TestSessionItem.cpp +++ b/Tests/Unit/GUI/TestSessionItem.cpp @@ -2,9 +2,7 @@ #include "GUI/Support/Data/SessionFlags.h" #include "Tests/GTestWrapper/google_test.h" -class TestSessionItem : public ::testing::Test {}; - -TEST_F(TestSessionItem, initialState) +TEST(TestSessionItem, initialState) { const QString modeltype = "This is the model type"; std::unique_ptr<SessionItem> item(new SessionItem(modeltype)); @@ -14,7 +12,7 @@ TEST_F(TestSessionItem, initialState) // TODO add some more tests for children, roles, tags ... } -TEST_F(TestSessionItem, defaultTag) +TEST(TestSessionItem, defaultTag) { const QString modelType = "TestItem"; @@ -28,7 +26,7 @@ TEST_F(TestSessionItem, defaultTag) EXPECT_EQ(item->numberOfChildren(), 0); } -TEST_F(TestSessionItem, singleTagAndItems) +TEST(TestSessionItem, singleTagAndItems) { const QString tag1 = "TAG1"; const QString modelType = "TestItem"; @@ -92,7 +90,7 @@ TEST_F(TestSessionItem, singleTagAndItems) EXPECT_EQ(item->getItem(tag1, 2), child2); } -TEST_F(TestSessionItem, insertAndTake) +TEST(TestSessionItem, insertAndTake) { const QString tag1 = "TAG1"; const QString modelType = "TestItem"; @@ -117,7 +115,7 @@ TEST_F(TestSessionItem, insertAndTake) delete first; } -TEST_F(TestSessionItem, tagWithLimits) +TEST(TestSessionItem, tagWithLimits) { const QString tag1 = "TAG1"; const QString modelType = "TestItem"; @@ -135,7 +133,7 @@ TEST_F(TestSessionItem, tagWithLimits) EXPECT_FAILED_ASSERT(item->insertChild(-1, nullptr, tag1)); } -TEST_F(TestSessionItem, tagsAndModelTypes) +TEST(TestSessionItem, tagsAndModelTypes) { const QString tag1 = "tag1"; const QString tag2 = "tag2"; @@ -173,7 +171,7 @@ TEST_F(TestSessionItem, tagsAndModelTypes) EXPECT_EQ(item->getItems(tag2), expected2); } -TEST_F(TestSessionItem, takeRow) +TEST(TestSessionItem, takeRow) { const QString tag1 = "tag1"; const QString tag2 = "tag2"; @@ -217,7 +215,7 @@ TEST_F(TestSessionItem, takeRow) EXPECT_EQ(item->getItems(tag2), expected2); } -TEST_F(TestSessionItem, dataRoles) +TEST(TestSessionItem, dataRoles) { std::unique_ptr<SessionItem> item(new SessionItem("Some model type")); item->setRoleProperty(Qt::DisplayRole, 1234); @@ -234,7 +232,7 @@ TEST_F(TestSessionItem, dataRoles) } } -TEST_F(TestSessionItem, modelTypes) +TEST(TestSessionItem, modelTypes) { const QString model1 = "modeltype 1"; const QString model2 = "modeltype 2"; diff --git a/Tests/Unit/GUI/TestSessionItemData.cpp b/Tests/Unit/GUI/TestSessionItemData.cpp index 1955624bb98..4594776251d 100644 --- a/Tests/Unit/GUI/TestSessionItemData.cpp +++ b/Tests/Unit/GUI/TestSessionItemData.cpp @@ -2,16 +2,14 @@ #include "GUI/Support/Data/SessionItemData.h" #include "Tests/GTestWrapper/google_test.h" -class TestSessionItemData : public ::testing::Test {}; - -TEST_F(TestSessionItemData, initialState) +TEST(TestSessionItemData, initialState) { SessionItemData itemData; EXPECT_TRUE(itemData.roles().isEmpty()); EXPECT_FALSE(itemData.data(Qt::DisplayRole).isValid()); } -TEST_F(TestSessionItemData, setData) +TEST(TestSessionItemData, setData) { SessionItemData itemData; diff --git a/Tests/Unit/GUI/TestSessionItemUtils.cpp b/Tests/Unit/GUI/TestSessionItemUtils.cpp index 284baed594f..ef626ad5fb8 100644 --- a/Tests/Unit/GUI/TestSessionItemUtils.cpp +++ b/Tests/Unit/GUI/TestSessionItemUtils.cpp @@ -3,11 +3,9 @@ #include "GUI/Util/ComboProperty.h" #include "Tests/GTestWrapper/google_test.h" -class TestSessionItemUtils : public ::testing::Test {}; - //! Comparing types of variant. -TEST_F(TestSessionItemUtils, VariantType) +TEST(TestSessionItemUtils, VariantType) { EXPECT_TRUE(GUI::Util::Variant::VariantType(QVariant::fromValue(1.0)) == GUI::Util::Variant::VariantType(QVariant::fromValue(2.0))); @@ -32,7 +30,7 @@ TEST_F(TestSessionItemUtils, VariantType) //! Comparing types of variant. -TEST_F(TestSessionItemUtils, CompatibleVariantTypes) +TEST(TestSessionItemUtils, CompatibleVariantTypes) { QVariant undefined; QVariant comboProperty = QVariant::fromValue(ComboProperty()); @@ -50,7 +48,7 @@ TEST_F(TestSessionItemUtils, CompatibleVariantTypes) //! Test variant equality reported by GUI::Util::Variant::isTheSame -TEST_F(TestSessionItemUtils, IsTheSameVariant) +TEST(TestSessionItemUtils, IsTheSameVariant) { // comparing undefined variants QVariant v1, v2; diff --git a/Tests/Unit/GUI/TestSessionModel.cpp b/Tests/Unit/GUI/TestSessionModel.cpp index e8fd1ff5d85..966c6dd19ec 100644 --- a/Tests/Unit/GUI/TestSessionModel.cpp +++ b/Tests/Unit/GUI/TestSessionModel.cpp @@ -14,11 +14,9 @@ #include <QXmlStreamWriter> #include <memory> -class TestSessionModel : public ::testing::Test {}; - //! Testing SessionModel::setData notifications. -TEST_F(TestSessionModel, setData) +TEST(TestSessionModel, setData) { SessionModel model("TestModel"); auto* item = model.insertItem<PropertyItem>(); @@ -46,7 +44,7 @@ TEST_F(TestSessionModel, setData) //! Test if SessionItem can be copied from one model to another. Particularly, we test //! here if a SampleItem can be copied from SampleModel to the JobItem of JobModel -TEST_F(TestSessionModel, copyItem) +TEST(TestSessionModel, copyItem) { auto sample1 = std::make_unique<SampleItem>(); sample1->setSampleName("sample1"); @@ -66,7 +64,7 @@ TEST_F(TestSessionModel, copyItem) EXPECT_NE(jobItem->instrumentItem(), nullptr); } -TEST_F(TestSessionModel, moveItemFromRoot) +TEST(TestSessionModel, moveItemFromRoot) { SessionModel model("TestModel"); auto* poly = model.insertItem<PolygonItem>(); @@ -91,7 +89,7 @@ TEST_F(TestSessionModel, moveItemFromRoot) EXPECT_EQ(poly->getItem(), nullptr); } -TEST_F(TestSessionModel, moveBetweenParents) +TEST(TestSessionModel, moveBetweenParents) { SessionModel model("TestModel"); auto* poly1 = model.insertItem<PolygonItem>(); @@ -109,7 +107,7 @@ TEST_F(TestSessionModel, moveBetweenParents) EXPECT_EQ(poly1->getItem(), point12); } -TEST_F(TestSessionModel, moveWithinSameParent) +TEST(TestSessionModel, moveWithinSameParent) { SessionModel model("TestModel"); auto* poly = model.insertItem<PolygonItem>(); diff --git a/Tests/Unit/GUI/TestSessionXML.cpp b/Tests/Unit/GUI/TestSessionXML.cpp index 9d215ea0b6c..8e7ba89426d 100644 --- a/Tests/Unit/GUI/TestSessionXML.cpp +++ b/Tests/Unit/GUI/TestSessionXML.cpp @@ -47,11 +47,9 @@ void deserialize(ItemType& t, const QByteArray& a) } // namespace -class TestSessionXML : public ::testing::Test {}; - //! Testing to/from xml: simple property item. -TEST_F(TestSessionXML, sessionItem) +TEST(TestSessionXML, sessionItem) { QString expected; @@ -75,7 +73,7 @@ TEST_F(TestSessionXML, sessionItem) //! Testing to/from xml: SphereItem -TEST_F(TestSessionXML, InstrumentItem) +TEST(TestSessionXML, InstrumentItem) { SpecularInstrumentItem instrument; instrument.setBackgroundType<ConstantBackgroundItem>(); @@ -103,7 +101,7 @@ TEST_F(TestSessionXML, InstrumentItem) EXPECT_EQ(a1, a2); } -TEST_F(TestSessionXML, GISASInstrumentItem) +TEST(TestSessionXML, GISASInstrumentItem) { GISASInstrumentItem instrument; const auto a1 = serialize(instrument); @@ -121,7 +119,7 @@ TEST_F(TestSessionXML, GISASInstrumentItem) EXPECT_EQ(a1, a2); } -TEST_F(TestSessionXML, OffspecInstrumentItem) +TEST(TestSessionXML, OffspecInstrumentItem) { OffspecInstrumentItem instrument; const auto a1 = serialize(instrument); @@ -139,7 +137,7 @@ TEST_F(TestSessionXML, OffspecInstrumentItem) EXPECT_EQ(a1, a2); } -TEST_F(TestSessionXML, SpecularInstrumentItem) +TEST(TestSessionXML, SpecularInstrumentItem) { SpecularInstrumentItem instrument; const auto a1 = serialize(instrument); @@ -157,7 +155,7 @@ TEST_F(TestSessionXML, SpecularInstrumentItem) EXPECT_EQ(a1, a2); } -TEST_F(TestSessionXML, DepthProbeInstrumentItem) +TEST(TestSessionXML, DepthProbeInstrumentItem) { DepthProbeInstrumentItem instrument; const auto a1 = serialize(instrument); @@ -177,7 +175,7 @@ TEST_F(TestSessionXML, DepthProbeInstrumentItem) } -TEST_F(TestSessionXML, emptyMultiLayer) +TEST(TestSessionXML, emptyMultiLayer) { SampleItem source; const auto a1 = serialize(source); @@ -190,7 +188,7 @@ TEST_F(TestSessionXML, emptyMultiLayer) EXPECT_EQ(a1, a2); } -TEST_F(TestSessionXML, Layer) +TEST(TestSessionXML, Layer) { MaterialModel materials; LayerItem source(&materials); @@ -203,7 +201,7 @@ TEST_F(TestSessionXML, Layer) EXPECT_EQ(a1, serialize(target)); } -TEST_F(TestSessionXML, Particle) +TEST(TestSessionXML, Particle) { MaterialModel materials; ParticleItem source(&materials); @@ -216,7 +214,7 @@ TEST_F(TestSessionXML, Particle) EXPECT_EQ(a1, serialize(target)); } -TEST_F(TestSessionXML, ParticleWithFF) +TEST(TestSessionXML, ParticleWithFF) { MaterialModel materials; ParticleItem source(&materials); @@ -230,7 +228,7 @@ TEST_F(TestSessionXML, ParticleWithFF) EXPECT_EQ(a1, serialize(target)); } -TEST_F(TestSessionXML, Alignment) +TEST(TestSessionXML, Alignment) { RectangularDetectorItem r; r.setDetectorAlignment(RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM_DPOS); diff --git a/Tests/Unit/GUI/TestUpdateTimer.cpp b/Tests/Unit/GUI/TestUpdateTimer.cpp index 2491d13f1f6..4323d3a6ae5 100644 --- a/Tests/Unit/GUI/TestUpdateTimer.cpp +++ b/Tests/Unit/GUI/TestUpdateTimer.cpp @@ -2,9 +2,7 @@ #include "Tests/GTestWrapper/google_test.h" #include <QSignalSpy> -class TestUpdateTimer : public ::testing::Test {}; - -TEST_F(TestUpdateTimer, updateTimerShort) +TEST(TestUpdateTimer, updateTimerShort) { const int timer_interval(100); UpdateTimer timer(timer_interval); -- GitLab