Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace mechanism_configuration
/// @brief A list of products
std::vector<ReactionComponent> products;
/// @brief An identifier, optional, uniqueness not enforced
std::string name;
std::string name;
/// @brief An identifier for the condensed phase where this reaction occurs
std::string condensed_phase;
/// @brief Unknown properties, prefixed with two underscores (__)
Expand Down
10 changes: 6 additions & 4 deletions test/integration/test_development_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

using namespace mechanism_configuration;

TEST(ParserBase, ParsesFullDevelopmentConfiguration)
TEST(ParseDevFullConfig, ParseValidConfig)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand Down Expand Up @@ -34,10 +34,12 @@ TEST(ParserBase, ParsesFullDevelopmentConfiguration)
EXPECT_EQ(mechanism.reactions.photolysis.size(), 1);
EXPECT_EQ(mechanism.reactions.simpol_phase_transfer.size(), 1);
EXPECT_EQ(mechanism.reactions.surface.size(), 1);
EXPECT_EQ(mechanism.reactions.troe.size(), 1);
EXPECT_EQ(mechanism.reactions.taylor_series.size(), 1);
EXPECT_EQ(mechanism.reactions.ternary_chemical_activation.size(), 1);
EXPECT_EQ(mechanism.reactions.troe.size(), 1);
EXPECT_EQ(mechanism.reactions.tunneling.size(), 1);
EXPECT_EQ(mechanism.reactions.user_defined.size(), 1);
EXPECT_EQ(mechanism.reactions.wet_deposition.size(), 1);

EXPECT_EQ(mechanism.species[1].constant_concentration.has_value(), true);
EXPECT_EQ(mechanism.species[1].constant_concentration.value(), 1.0e19);
Expand All @@ -52,7 +54,7 @@ TEST(ParserBase, ParsesFullDevelopmentConfiguration)
}
}

TEST(ParserBase, ParserReportsBadFiles)
TEST(ParseDevFullConfig, ReportsBadFiles)
{
development::Parser parser;
std::vector<std::string> extensions = { ".yaml", ".json" };
Expand All @@ -66,7 +68,7 @@ TEST(ParserBase, ParserReportsBadFiles)
}
}

TEST(ParserBase, ParserReportsDirectory)
TEST(ParseDevFullConfig, ReportsDirectory)
{
development::Parser parser;
std::string path = "examples/";
Expand Down
6 changes: 3 additions & 3 deletions test/unit/development/models/test_parse_gas_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using namespace mechanism_configuration;

TEST(ParserBase, CanParseValidGasModel)
TEST(ParseGas, ParseValidConfig)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -20,7 +20,7 @@ TEST(ParserBase, CanParseValidGasModel)
}
}

TEST(ParserBase, GasModelMissingPhase)
TEST(ParseGas, MissingPhase)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -41,7 +41,7 @@ TEST(ParserBase, GasModelMissingPhase)
}
}

TEST(ParserBase, GasModelPhaseNotFoundInRegisteredPhases)
TEST(ParseGas, PhaseNotFoundInRegisteredPhases)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand Down
45 changes: 25 additions & 20 deletions test/unit/development/models/test_parse_modal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using namespace mechanism_configuration;

TEST(ParserBase, CanParseValidModalModel)
TEST(ParseModal, ParseValidConfig)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand Down Expand Up @@ -37,47 +37,50 @@ TEST(ParserBase, CanParseValidModalModel)
}
}

TEST(ParserBase, MissingModes)
TEST(ParseModal, MissingModes)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
for (auto& extension : extensions)
{
auto parsed = parser.Parse(std::string("development_unit_configs/models/modal/missing_modes") + extension);
EXPECT_FALSE(parsed);
development::types::Mechanism mechanism = *parsed;

EXPECT_EQ(parsed.errors.size(), 1);
EXPECT_EQ(parsed.errors[0].first, ConfigParseStatus::RequiredKeyNotFound);

for (auto& error : parsed.errors)
std::multiset<ConfigParseStatus> expected = { ConfigParseStatus::RequiredKeyNotFound };
std::multiset<ConfigParseStatus> actual;
for (const auto& [status, message] : parsed.errors)
{
std::cout << error.second << " " << configParseStatusToString(error.first) << std::endl;
actual.insert(status);
std::cout << message << " " << configParseStatusToString(status) << std::endl;
}
EXPECT_EQ(actual, expected);
}
}

TEST(ParserBase, MissingModalMemberData)
TEST(ParseModal, MissingModalMemberData)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
for (auto& extension : extensions)
{
auto parsed = parser.Parse(std::string("development_unit_configs/models/modal/missing_modal_variable") + extension);
EXPECT_FALSE(parsed);
development::types::Mechanism mechanism = *parsed;

EXPECT_EQ(parsed.errors.size(), 2);
EXPECT_EQ(parsed.errors[0].first, ConfigParseStatus::RequiredKeyNotFound);
EXPECT_EQ(parsed.errors[1].first, ConfigParseStatus::RequiredKeyNotFound);
for (auto& error : parsed.errors)

std::multiset<ConfigParseStatus> expected = { ConfigParseStatus::RequiredKeyNotFound,
ConfigParseStatus::RequiredKeyNotFound };
std::multiset<ConfigParseStatus> actual;
for (const auto& [status, message] : parsed.errors)
{
std::cout << error.second << " " << configParseStatusToString(error.first) << std::endl;
actual.insert(status);
std::cout << message << " " << configParseStatusToString(status) << std::endl;
}
EXPECT_EQ(actual, expected);
}
}

TEST(ParserBase, PhaseInModeNotFoundInRegisteredPhase)
TEST(ParseModal, PhaseInModeNotFoundInRegisteredPhase)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -86,13 +89,15 @@ TEST(ParserBase, PhaseInModeNotFoundInRegisteredPhase)
auto parsed =
parser.Parse(std::string("development_unit_configs/models/modal/mode_phase_not_found_in_phases") + extension);
EXPECT_FALSE(parsed);
development::types::Mechanism mechanism = *parsed;

EXPECT_EQ(parsed.errors.size(), 1);
EXPECT_EQ(parsed.errors[0].first, ConfigParseStatus::UnknownPhase);
for (auto& error : parsed.errors)

std::multiset<ConfigParseStatus> expected = { ConfigParseStatus::UnknownPhase };
std::multiset<ConfigParseStatus> actual;
for (const auto& [status, message] : parsed.errors)
{
std::cout << error.second << " " << configParseStatusToString(error.first) << std::endl;
actual.insert(status);
std::cout << message << " " << configParseStatusToString(status) << std::endl;
}
EXPECT_EQ(actual, expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace mechanism_configuration;

TEST(ParserBase, CanParseValidAqueousEquilibriumReaction)
TEST(ParseAqueousEquilibrium, ParseValidConfig)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand Down Expand Up @@ -52,7 +52,7 @@ TEST(ParserBase, CanParseValidAqueousEquilibriumReaction)
}
}

TEST(ParserBase, AqueousEquilibriumDetectsUnknownSpecies)
TEST(ParseAqueousEquilibrium, DetectsUnknownSpecies)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -75,7 +75,7 @@ TEST(ParserBase, AqueousEquilibriumDetectsUnknownSpecies)
}
}

TEST(ParserBase, AqueousEquilibriumDetectsBadReactionComponent)
TEST(ParseAqueousEquilibrium, DetectsBadReactionComponent)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -98,7 +98,7 @@ TEST(ParserBase, AqueousEquilibriumDetectsBadReactionComponent)
}
}

TEST(ParserBase, AqueousEquilibriumDetectsUnknownPhase)
TEST(ParseAqueousEquilibrium, DetectsUnknownPhase)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -120,7 +120,7 @@ TEST(ParserBase, AqueousEquilibriumDetectsUnknownPhase)
}
}

TEST(ParserBase, AqueousEquilibriumUnknownSpeciesUnknownPhaseFailsValidation)
TEST(ValidateAqueousEquilibrium, UnknownSpeciesUnknownPhaseFailsValidation)
{
using namespace development;

Expand Down
12 changes: 6 additions & 6 deletions test/unit/development/reactions/test_parse_arrhenius.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace mechanism_configuration;

TEST(ParserBase, CanParseValidArrheniusReaction)
TEST(ParseArrhenius, ParseValidConfig)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand Down Expand Up @@ -71,7 +71,7 @@ TEST(ParserBase, CanParseValidArrheniusReaction)
}
}

TEST(ParserBase, ArrheniusDetectsUnknownSpecies)
TEST(ParseArrhenius, DetectsUnknownSpecies)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -96,7 +96,7 @@ TEST(ParserBase, ArrheniusDetectsUnknownSpecies)
}
}

TEST(ParserBase, ArrheniusDetectsMutuallyExclusiveOptions)
TEST(ParseArrhenius, DetectsMutuallyExclusiveOptions)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -118,7 +118,7 @@ TEST(ParserBase, ArrheniusDetectsMutuallyExclusiveOptions)
}
}

TEST(ParserBase, ArrheniusDetectsBadReactionComponent)
TEST(ParseArrhenius, DetectsBadReactionComponent)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -140,7 +140,7 @@ TEST(ParserBase, ArrheniusDetectsBadReactionComponent)
}
}

TEST(ParserBase, ArrheniusDetectsUnknownPhase)
TEST(ParseArrhenius, DetectsUnknownPhase)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -162,7 +162,7 @@ TEST(ParserBase, ArrheniusDetectsUnknownPhase)
}
}

TEST(ParserBase, ArrheniusMutuallyExclusiveEaAndCFailsValidation)
TEST(ValidateArrhenius, MutuallyExclusiveEaAndCFailsValidation)
{
using namespace development;

Expand Down
12 changes: 6 additions & 6 deletions test/unit/development/reactions/test_parse_branched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace mechanism_configuration;

TEST(ParserBase, CanParseValidBranchedReaction)
TEST(ParseBranched, ParseValidConfig)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand Down Expand Up @@ -43,7 +43,7 @@ TEST(ParserBase, CanParseValidBranchedReaction)
}
}

TEST(ParserBase, BranchedDetectsUnknownSpecies)
TEST(ParseBranched, DetectsUnknownSpecies)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -66,7 +66,7 @@ TEST(ParserBase, BranchedDetectsUnknownSpecies)
}
}

TEST(ParserBase, BranchedDetectsBadReactionComponent)
TEST(ParseBranched, DetectsBadReactionComponent)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -88,7 +88,7 @@ TEST(ParserBase, BranchedDetectsBadReactionComponent)
}
}

TEST(ParserBase, BranchedDetectsUnknownPhase)
TEST(ParseBranched, DetectsUnknownPhase)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -110,7 +110,7 @@ TEST(ParserBase, BranchedDetectsUnknownPhase)
}
}

TEST(ParserBase, BranchedMissingRequiredKeyFailsValidation)
TEST(ParseBranched, MissingRequiredKeyFailsValidation)
{
using namespace development;

Expand Down Expand Up @@ -142,7 +142,7 @@ TEST(ParserBase, BranchedMissingRequiredKeyFailsValidation)
EXPECT_EQ(actual, expected);
}

TEST(ParserBase, BranchedUnknownSpeciesAndUnknownPhaseFailsValidation)
TEST(ValidateBranched, UnknownSpeciesAndUnknownPhaseFailsValidation)
{
using namespace development;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace mechanism_configuration;

TEST(ParserBase, CanParseValidCondensedPhaseArrheniusReaction)
TEST(ParseCondensedPhaseArrhenius, ParseValidConfig)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand Down Expand Up @@ -72,7 +72,7 @@ TEST(ParserBase, CanParseValidCondensedPhaseArrheniusReaction)
}
}

TEST(ParserBase, CondensedPhaseArrheniusDetectsUnknownSpecies)
TEST(ParseCondensedPhaseArrhenius, DetectsUnknownSpecies)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -96,7 +96,7 @@ TEST(ParserBase, CondensedPhaseArrheniusDetectsUnknownSpecies)
}
}

TEST(ParserBase, CondensedPhaseArrheniusDetectsMutuallyExclusiveOptions)
TEST(ParseCondensedPhaseArrhenius, DetectsMutuallyExclusiveOptions)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -119,7 +119,7 @@ TEST(ParserBase, CondensedPhaseArrheniusDetectsMutuallyExclusiveOptions)
}
}

TEST(ParserBase, CondensedPhaseArrheniusDetectsBadReactionComponent)
TEST(ParseCondensedPhaseArrhenius, DetectsBadReactionComponent)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -142,7 +142,7 @@ TEST(ParserBase, CondensedPhaseArrheniusDetectsBadReactionComponent)
}
}

TEST(ParserBase, CondensedPhaseArrheniusDetectsWhenRequestedSpeciesAreNotInAqueousPhase)
TEST(ParseCondensedPhaseArrhenius, DetectsWhenRequestedSpeciesAreNotInAqueousPhase)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -165,7 +165,7 @@ TEST(ParserBase, CondensedPhaseArrheniusDetectsWhenRequestedSpeciesAreNotInAqueo
}
}

TEST(ParserBase, CondensedPhaseArrheniusDetectsMissingPhase)
TEST(ParseCondensedPhaseArrhenius, DetectsMissingPhase)
{
development::Parser parser;
std::vector<std::string> extensions = { ".json", ".yaml" };
Expand All @@ -187,7 +187,7 @@ TEST(ParserBase, CondensedPhaseArrheniusDetectsMissingPhase)
}
}

TEST(ParserBase, CondensedPhaseArrheniusMutuallyExclusiveEaAndCFailsValidation)
TEST(ValidateCondensedPhaseArrhenius, MutuallyExclusiveEaAndCFailsValidation)
{
using namespace development;

Expand Down
Loading
Loading