@@ -29,22 +29,22 @@ namespace CppUtils::UnitTest::Language::CSV::Mapping
2929 using namespace CppUtils::String::Literals;
3030
3131 using CSVMapping = CppUtils::Type::Mapping<
32- CppUtils::Type::Pair<"String view "_token, "A"_excelColumn>,
33- CppUtils::Type::Pair<"String"_token, "B"_excelColumn>,
32+ CppUtils::Type::Pair<"String 1 "_token, "A"_excelColumn>,
33+ CppUtils::Type::Pair<"String 2 "_token, "B"_excelColumn>,
3434 CppUtils::Type::Pair<"Unsigned integer"_token, "C"_excelColumn>,
3535 CppUtils::Type::Pair<"Signed integer"_token, "D"_excelColumn>,
3636 CppUtils::Type::Pair<"Floating point"_token, "E"_excelColumn>>;
3737
3838 using StructMapping = CppUtils::Type::Mapping<
39- CppUtils::Type::Pair<"String view "_token, &Object::a>,
40- CppUtils::Type::Pair<"String"_token, &Object::b>,
39+ CppUtils::Type::Pair<"String 1 "_token, &Object::a>,
40+ CppUtils::Type::Pair<"String 2 "_token, &Object::b>,
4141 CppUtils::Type::Pair<"Unsigned integer"_token, &Object::c>,
4242 CppUtils::Type::Pair<"Signed integer"_token, &Object::d>,
4343 CppUtils::Type::Pair<"Floating point"_token, &Object::e>>;
4444
4545 using FileStructMapping = CppUtils::Type::Mapping<
46- CppUtils::Type::Pair<"String view "_token, &FileObject::a>,
47- CppUtils::Type::Pair<"String"_token, &FileObject::b>,
46+ CppUtils::Type::Pair<"String 1 "_token, &FileObject::a>,
47+ CppUtils::Type::Pair<"String 2 "_token, &FileObject::b>,
4848 CppUtils::Type::Pair<"Unsigned integer"_token, &FileObject::c>,
4949 CppUtils::Type::Pair<"Signed integer"_token, &FileObject::d>,
5050 CppUtils::Type::Pair<"Floating point"_token, &FileObject::e>>;
@@ -133,6 +133,17 @@ namespace CppUtils::UnitTest::Language::CSV::Mapping
133133 }};
134134 });
135135
136+ suite.addTest("load CSV File with CRLF", [&] {
137+ CppUtils::FileSystem::TemporaryDirectory{[&suite](const auto& directory) {
138+ const auto filePath = directory / "test_crlf.csv";
139+ CppUtils::FileSystem::String::write(filePath, "a;b;c;d;e\r\nfoo;bar;42;-1;3.14\r\n"sv);
140+
141+ const auto objects = CppUtils::Language::CSV::loadFile<FileObject, FileObjectMapping>(filePath, ";", "\n", 1uz);
142+
143+ suite.expectEqual(objects, std::vector<FileObject>{{"foo", "bar", 42, -1, 3.14f}});
144+ }};
145+ });
146+
136147 suite.addTest("load CSV Directory", [&] {
137148 CppUtils::FileSystem::TemporaryDirectory{[&suite](const auto& directory) {
138149 CppUtils::FileSystem::String::write(directory / "test1.csv", "a;b;c;d;e\nfoo;bar;1;-10;1.1\n"sv);
0 commit comments