Commit Graph
306 Commits
Author SHA1 Message Date
Simon Gene GottliebandJesse Beder 5d9e4b6251 patch: split fp_to_string.h into fptostring.h and fptostring.cpp 2024-11-07 15:14:36 -06:00
Simon Gene GottliebandJesse Beder f4bca79dc4 fix: fp_to_string uses now 2 spaces 2024-11-07 15:14:36 -06:00
Simon Gene GottliebandJesse Beder d4e00bd473 fix: rename fp_to_string to FpToString to match coding style 2024-11-07 15:14:36 -06:00
Simon Gene GottliebandJesse Beder bd070a7b76 fix: prettier floating point numbers
Add dragonbox to compute the required precision to print floating point
numbers. This avoids uglification of floating point numbers that
happen by default via std::stringstream.

Numbers like 34.34 used to be converted to '34.340000000000003' as strings.
With this version they will be converted to the string '34.34'.

This fixes issue https://github.com/jbeder/yaml-cpp/issues/1289
2024-11-07 15:14:36 -06:00
Reini UrbanandJesse Beder 3d2888cc8a missing keys should throw InvalidNode, not BadConversion
Fixes GH #1274
2024-11-01 10:25:39 -05:00
Federico Di PierroandJesse Beder c2bec4c755 chore(test): moved infiniteloop test to load_node_test suite.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-29 22:21:05 -05:00
Federico Di PierroandJesse Beder 29c59c01d4 new(test): added a test to avoid future issues with LoadAll().
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-29 22:21:05 -05:00
Federico Di PierroandJesse Beder da82fd982c chore(test/integration): refactor some test cases to their own test.
Plus, check that the content is what we actually expect.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-13 10:18:41 +02:00
Federico Di PierroandJesse Beder 1f2b841949 fix(src,include,test): fixed multiple cases where a bad yaml was accepted.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-13 10:18:41 +02:00
Simon Gene GottliebandJesse Beder ee9c4d19be fix: parse files with '\r' symbols as line ending correctly 2024-08-22 07:53:52 -05:00
Simon Gene GottliebandJesse Beder b95aa146ec fix: use C locale by default 2024-07-17 13:39:30 -05:00
Alejandro-FAandJesse Beder c67d701ad8 Fix indentation of empty sequences and add test 2024-01-26 12:30:06 -06:00
Gianfranco CostamagnaandGitHub db03655d58 Make sure CXX_STANDARD can be overridden from outside (#1239) 2023-10-23 07:20:22 -05:00
Gianfranco CostamagnaandGitHub 145eec5f3e Add CMake option YAML_USE_SYSTEM_GTEST to use system googletest if available. (#1035)
There is no need to use the embedded gtest code copy in Linux systems, if they already provide the googletest framework system-wide.
Search for it, and fallback to the embedded one if the system one is not detected.

This patch has been also contributed by Simon Quigley <tsimonq2@debian.org>
2023-10-22 00:06:39 -05:00
c26e047223 CMake: Fixes for generated config (#1212)
* CMake: Add option to set the package install dir.

* CMake: Fix generated config.

- `YAML_CPP_SHARED_LIBS_BUILT` should not be set with a `PATH_VAR` as it
would always evaluate to true.
- `YAML_CPP_LIBRARIES` should used the exported target name including
the namespace, but `check_required_components` shouldn't.
- Use `CMAKE_CURRENT_LIST_DIR` to find the target file, instead of a
`PATH_VAR`. Package managers such as vcpkg move CMake configs after
installing.

* CI: Test the generated CMake package.

* CMake: Create add a deprecated yaml-cpp target.

This target is meant to provide compatibility with versions prior to
0.8.0.

* CMake: mark the yaml-cpp target as IMPORTED.

---------

Co-authored-by: Jesse Beder <jbeder+github@gmail.com>
2023-10-12 11:48:16 -04:00
Gianfranco CostamagnaandGitHub fcbb8193b9 Fix testsuite with gcc-13 (#1216)
cd /<<PKGBUILDDIR>>/build-static/test && /usr/bin/c++ -DYAML_CPP_STATIC_DEFINE -I/<<PKGBUILDDIR>>/test/integration -I/<<PKGBUILDDIR>>/test -I/<<PKGBUILDDIR>>/src -I/<<PKGBUILDDIR>>/include -isystem /usr/src/googletest/googlemock/include -isystem /usr/src/googletest/googlemock -isystem /usr/src/googletest/googletest/include -isystem /usr/src/googletest/googletest -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/yaml-cpp-0.8.0+dfsg-1~build1 -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu++14 -Wno-variadic-macros -Wno-sign-compare -DGTEST_HAS_PTHREAD=1 -MD -MT test/CMakeFiles/yaml-cpp-tests.dir/binary_test.cpp.o -MF CMakeFiles/yaml-cpp-tests.dir/binary_test.cpp.o.d -o CMakeFiles/yaml-cpp-tests.dir/binary_test.cpp.o -c /<<PKGBUILDDIR>>/test/binary_test.cpp
/<<PKGBUILDDIR>>/test/binary_test.cpp: In member function ‘virtual void BinaryTest_DecodingNoCrashOnNegative_Test::TestBody()’:
/<<PKGBUILDDIR>>/test/binary_test.cpp:11:38: error: narrowing conversion of ‘-58’ from ‘int’ to ‘char’ [-Wnarrowing]
   11 |   std::string input{-58, -1, -99, 109};
      |                                      ^
2023-08-19 15:36:16 -04:00
Kefu ChaiandGitHub 35b4498026 node/convert: support conversion for std::string_view (#1148) 2023-07-24 14:51:05 -05:00
Matthijs van der BurghandGitHub 3ff7ab07ac Make sure tests are run in CI (#1170)
* Test(CMake) set NAME and COMMAND in add_test

* (CMake) add enable_testing()

* (CMake) move cmake_dependent_option up, before using them

* (CMake) use YAML_CPP_MAIN_PROJECT in cmake_dependent_option

* (CMake) log values regarding tests

* (CMake) always find CTest, but don't enable tests

* (CMAKE)(temp) fix logging

* (actions) set YAML_CPP_BUILD_TESTS for tests

* (actions) provide YAML_CPP_BUILD_TESTS to ctest

* (actions) set -DYAML_CPP_BUILD_TESTS at build

* (actions) don't fail false

* (actions) build tests in Test step

* (actions) run tests verbose

* (CMake) remove temp logging

* (actions) split building from running tests

* (actions) ctest Debug

* (actions) ctest Debug

* Remove enable_testing
2023-03-04 14:06:01 -06:00
Matthijs van der BurghandGitHub bdc5582b35 Add tests for iterator and const_iterator on sequence (#1169) 2023-03-01 19:27:51 -06:00
James BrownandGitHub 1b50109f7b Include property nodes in the long key check (#1140) 2022-10-04 18:51:53 -05:00
sfalmoandGitHub 4ae4cb7309 Support conversion for std::valarray (#956) 2022-09-20 00:31:51 -05:00
Dr. Andre VehreschildandGitHub 13626af92a Fix escaping anchors in keys (#1101) 2022-04-21 08:19:51 -05:00
Dr. Andre VehreschildandGitHub 4c982d59dc Improve build and fix single cr on windows (#1099) 2022-04-19 12:39:55 -05:00
Dr. Andre VehreschildandGitHub a6db7e32ac Fix single cr not recognized (#1094)
Complies with YAML Standard [5.4](https://yaml.org/spec/1.2.2/#54-line-break-characters) [25] instead of matching `\r` only in combination with `\n`.
2022-03-31 22:16:35 -05:00
Akash PatelandGitHub edadfecdc6 Update gtest to 1.11.0 (#1086)
Properly resolves #1083, #996.
2022-02-17 12:08:56 -06:00