diff --git a/modules/io/tests/test_star_parser.cc b/modules/io/tests/test_star_parser.cc index c97140079f0b0bb4f569cc8261d941a1fdb31b4a..62f47a6f9df832bc366183fb17931ff6f79346e3 100644 --- a/modules/io/tests/test_star_parser.cc +++ b/modules/io/tests/test_star_parser.cc @@ -287,6 +287,19 @@ BOOST_AUTO_TEST_CASE(star_data_item) BOOST_TEST_MESSAGE(" done."); } +BOOST_AUTO_TEST_CASE(star_ws_data_item) +{ + BOOST_TEST_MESSAGE(" Running star_ws_data_item tests..."); + std::ifstream s("testfiles/ws-data-item.cif"); + DataItemTestParser star_p(s); + BOOST_CHECK_NO_THROW(star_p.Parse()); + BOOST_CHECK_EQUAL(star_p.s1, "a"); + BOOST_CHECK_EQUAL(star_p.s2, "a b c"); + BOOST_CHECK_EQUAL(star_p.s3, "a\n b\nc"); + BOOST_CHECK_EQUAL(star_p.s4, "a'b"); + BOOST_TEST_MESSAGE(" done."); +} + BOOST_AUTO_TEST_CASE(format_diag_stream) { BOOST_TEST_MESSAGE(" Running format_diag_stream tests..."); @@ -359,6 +372,21 @@ BOOST_AUTO_TEST_CASE(star_loop) BOOST_TEST_MESSAGE(" done."); } +BOOST_AUTO_TEST_CASE(star_ws_loop) +{ + BOOST_TEST_MESSAGE(" Running star_ws_loop tests..."); + std::ifstream s("testfiles/ws_loop.cif"); + LoopTestParser star_p(s); + star_p.Parse(); + BOOST_CHECK_EQUAL(star_p.lines[0][0], "1"); + BOOST_CHECK_EQUAL(star_p.lines[0][1], "2"); + BOOST_CHECK_EQUAL(star_p.lines[0][2], "3"); + BOOST_CHECK_EQUAL(star_p.lines[1][0], "a"); + BOOST_CHECK_EQUAL(star_p.lines[1][1], "b"); + BOOST_CHECK_EQUAL(star_p.lines[1][2], "c"); + BOOST_TEST_MESSAGE(" done."); +} + BOOST_AUTO_TEST_CASE(star_items_as_row) { BOOST_TEST_MESSAGE(" Running star_items_as_row tests..."); diff --git a/modules/io/tests/testfiles/ws-data-item.cif b/modules/io/tests/testfiles/ws-data-item.cif new file mode 100644 index 0000000000000000000000000000000000000000..bbcb357013b8091bc14d576631ef069aed92cd03 --- /dev/null +++ b/modules/io/tests/testfiles/ws-data-item.cif @@ -0,0 +1,11 @@ + # Intentinally comment with whitespaces, should not throw error +data_data-item + _data-item.s1 a +_data-item.s2 'a b c' +_data-item.s3 +; +a + b +c +; +_data-item.s4 'a'b' diff --git a/modules/io/tests/testfiles/ws_loop.cif b/modules/io/tests/testfiles/ws_loop.cif new file mode 100644 index 0000000000000000000000000000000000000000..61aeabaf9e004ef1c0f75c6e9ab36ee034bf237c --- /dev/null +++ b/modules/io/tests/testfiles/ws_loop.cif @@ -0,0 +1,9 @@ +data_loop + +loop_ + _loop.s1 + _loop.s2 + _loop.s3 + 1 2 3 + # comment with leading whitespaces should be skipped + a b c