-
Notifications
You must be signed in to change notification settings - Fork 7
Replace map with vector to remove key-pair restriction for System data #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ede0c36
add scope setter
boulderdaze 6857d0b
temp test
boulderdaze 823337a
add aerosol scope test
boulderdaze eb71b78
add checks for mutually exclusive function
boulderdaze 4e7b3e4
new line
boulderdaze 3b00396
error message
boulderdaze b8b1f00
code cleanup
boulderdaze a0417ea
make system others param as list
boulderdaze cf435cb
add utils to set model, phase specific species
boulderdaze b27ba51
add unit tests for util function
boulderdaze 9147b0d
add test file
boulderdaze 4bcfc0a
resolve merge conflict
boulderdaze 90f592e
address the code review
boulderdaze 55ff7c3
revert back
boulderdaze b5403ba
remove unnecessary header
boulderdaze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (C) 2023-2025 University Corporation for Atmospheric Research | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| namespace micm | ||
| { | ||
| inline std::string JoinStrings(const std::vector<std::string>& names) | ||
| { | ||
| std::string result; | ||
| for (size_t i = 0; i < names.size(); ++i) | ||
| { | ||
| if (!names[i].empty()) | ||
| { | ||
| if (!result.empty()) | ||
| result += "."; | ||
| result += names[i]; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| } // namespace micm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| // Copyright (C) 2023-2025 University Corporation for Atmospheric Research | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #include <micm/util/utils.hpp> | ||
|
|
||
| #include <gtest/gtest.h> | ||
|
|
||
| TEST(JoinStrings, EmptyVector) | ||
| { | ||
| std::vector<std::string> names; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, ""); | ||
| } | ||
|
|
||
| TEST(JoinStrings, SingleString) | ||
| { | ||
| std::vector<std::string> names = { "species" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "species"); | ||
| } | ||
|
|
||
| TEST(JoinStrings, TwoStrings) | ||
| { | ||
| std::vector<std::string> names = { "accumulation", "aqueous" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "accumulation.aqueous"); | ||
| } | ||
|
|
||
| TEST(JoinStrings, ThreeStrings) | ||
| { | ||
| std::vector<std::string> names = { "accumulation", "aqueous", "CO2" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "accumulation.aqueous.CO2"); | ||
| } | ||
|
|
||
| TEST(JoinStrings, EmptyStringAtStart) | ||
| { | ||
| std::vector<std::string> names = { "", "accumulation", "aqueous" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "accumulation.aqueous"); | ||
| } | ||
|
|
||
| TEST(JoinStrings, EmptyStringInMiddle) | ||
| { | ||
| std::vector<std::string> names = { "accumulation", "", "aqueous" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "accumulation.aqueous"); | ||
| } | ||
|
|
||
| TEST(JoinStrings, EmptyStringAtEnd) | ||
| { | ||
| std::vector<std::string> names = { "accumulation", "aqueous", "" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "accumulation.aqueous"); | ||
| } | ||
|
|
||
| TEST(JoinStrings, MultipleEmptyStrings) | ||
| { | ||
| std::vector<std::string> names = { "", "accumulation", "", "aqueous", "" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "accumulation.aqueous"); | ||
| } | ||
|
|
||
| TEST(JoinStrings, StringsWithDots) | ||
| { | ||
| std::vector<std::string> names = { "accumulation.mode", "aqueous.phase" }; | ||
| std::string result = micm::JoinStrings(names); | ||
| EXPECT_EQ(result, "accumulation.mode.aqueous.phase"); | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.