summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-01-03 00:08:58 -0600
committerDominick Allen <djallen@librehumanitas.org>2025-01-03 00:08:58 -0600
commitd93307d810b3f4ee8044f7308e360d9ea9c7cf22 (patch)
tree08cfe9ae27c2a9d5bd11881089b9a3333a3c11b8 /test
parent1ac94c8aff47b549f30b370be2191bcc0157826c (diff)
More fixups to csv logic.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/test_csv.cpp73
2 files changed, 75 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0a1a1e7..cdc8c6e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -82,3 +82,5 @@ fud_add_test(test_string_convert SOURCES test_string_convert.cpp)
# fud_add_test(test_ext_array SOURCES
# test_ext_array.cpp
# test_ext_unique_array.cpp)
+
+configure_file(nuclides.csv ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
diff --git a/test/test_csv.cpp b/test/test_csv.cpp
index cb93a32..65c02ef 100644
--- a/test/test_csv.cpp
+++ b/test/test_csv.cpp
@@ -138,6 +138,79 @@ TEST(FudCsv, ParseCsvFromFilename)
}
}
+TEST(FudCsv, ParseNuclides)
+{
+ Vector<StringView> expectedHeaders{};
+ auto pushExpected = [&](StringView item) {
+ auto pushStatus = expectedHeaders.pushBack(StringView{u8"z"});
+ fudAssert(pushStatus == FudStatus::Success);
+ };
+ pushExpected(StringView{u8"z"});
+ pushExpected(StringView{u8"n"});
+ pushExpected(StringView{u8"symbol"});
+ pushExpected(StringView{u8"radius"});
+ pushExpected(StringView{u8"unc_r"});
+ pushExpected(StringView{u8"abundance"});
+ pushExpected(StringView{u8"unc_a"});
+ pushExpected(StringView{u8"energy_shift"});
+ pushExpected(StringView{u8"energy"});
+ pushExpected(StringView{u8"unc_e"});
+ pushExpected(StringView{u8"ripl_shift"});
+ pushExpected(StringView{u8"jp"});
+ pushExpected(StringView{u8"half_life"});
+ pushExpected(StringView{u8"operator_hl"});
+ pushExpected(StringView{u8"unc_hl"});
+ pushExpected(StringView{u8"unit_hl"});
+ pushExpected(StringView{u8"half_life_sec"});
+ pushExpected(StringView{u8"unc_hls"});
+ pushExpected(StringView{u8"decay_1"});
+ pushExpected(StringView{u8"decay_1_%"});
+ pushExpected(StringView{u8"unc_1"});
+ pushExpected(StringView{u8"decay_2"});
+ pushExpected(StringView{u8"decay_2_%"});
+ pushExpected(StringView{u8"unc_2"});
+ pushExpected(StringView{u8"decay_3"});
+ pushExpected(StringView{u8"decay_3_%"});
+ pushExpected(StringView{u8"unc_3"});
+ pushExpected(StringView{u8"isospin"});
+ pushExpected(StringView{u8"magnetic_dipole"});
+ pushExpected(StringView{u8"unc_md"});
+ pushExpected(StringView{u8"electric_quadrupole"});
+ pushExpected(StringView{u8"unc_eq"});
+ pushExpected(StringView{u8"qbm"});
+ pushExpected(StringView{u8"unc_qb"});
+ pushExpected(StringView{u8"qbm_n"});
+ pushExpected(StringView{u8"unc_qbmn"});
+ pushExpected(StringView{u8"qa"});
+ pushExpected(StringView{u8"unc_qa"});
+ pushExpected(StringView{u8"qec"});
+ pushExpected(StringView{u8"unc_qec"});
+ pushExpected(StringView{u8"sn"});
+ pushExpected(StringView{u8"unc_sn"});
+ pushExpected(StringView{u8"sp"});
+ pushExpected(StringView{u8"unc_sp"});
+ pushExpected(StringView{u8"binding"});
+ pushExpected(StringView{u8"unc_ba"});
+ pushExpected(StringView{u8"atomic_mass"});
+ pushExpected(StringView{u8"unc_am"});
+ pushExpected(StringView{u8"massexcess"});
+ pushExpected(StringView{u8"unc_me"});
+ pushExpected(StringView{u8"me_systematics"});
+ pushExpected(StringView{u8"discovery"});
+ pushExpected(StringView{u8"ENSDFpublicationcut-off"});
+ pushExpected(StringView{u8"ENSDFauthors"});
+ pushExpected(StringView{u8"Extraction_date"});
+
+ StringView nuclidesFilename{u8"test/nuclides.csv"};
+ Csv csv{Csv::makeDefault()};
+ auto parseStatus = Csv::parseFromFilenameUnbuffered(csv, nuclidesFilename);
+ if (parseStatus != FudStatus::Success) {
+ debugPrint(u8"Error parsing file: {}\n", FudStatusToString(parseStatus));
+ }
+ ASSERT_EQ(parseStatus, FudStatus::Success);
+
+}
+
} // namespace fud
//NOLINTEND(readability-magic-numbers)