Commit Graph

78 Commits

Author SHA1 Message Date
Shane Grant
970aa9f07d Fixes empty string serialization for debug in VS (#69)
Previously we took the address of the dereferenced begin() iterator
on a string to get the pointer to its data; we now just const_cast
the pointer that is the result of calling data().

The original reason for using the iterator over something like data()
was to avoid the const_cast and to ensure that any copy on write
mechanisms were used, but this doesn't seem necessary given that we
call resize() immediately prior to this.  Valgrind shows no problems
with the new method.  Also added unit tests for this case to string.
2014-03-08 11:08:48 -08:00
Shane Grant
30a22fec28 Renaming load_and_allocate to load_and_construct
Anything associated this that used the verb allocate has been replaced with construct

closes #59
2014-02-21 15:52:26 -08:00
Shane Grant
d89c94d7bb Adding polymorphic unit tests for enble_shared_from_this
Should fix #47
2014-02-11 16:52:57 -08:00
Shane Grant
29578c8c48 Support for std::enable_shared_from_this
Fixes #47

When we detect a shared_ptr being loaded in load_and_allocate that
also is of a type that derives from enable_shared_from_this, extra
work is done to save the state of the enable_shared_from_this before
the user gets to meddle with it via placement new inside of
cereal::allocate.  State is restored after getting back from the user.
2014-02-09 12:31:32 -08:00
Shane Grant
2b25a7b3d6 Considering #44 fixed
Need to do a once over on documentation to finish up, see issue #22
2014-01-22 16:57:07 -08:00
Shane Grant
6f7ca3ea99 adding tests for load_and_allocate
relates #44
2014-01-22 16:33:56 -08:00
Shane Grant
00b18c4d6a progress towards circular loads #44
Passing tests but need to look over this with valgrind some more.  Potentially have some issues here, moreso with
unique_ptr than shared_ptr.
2014-01-22 14:38:27 -08:00
Shane Grant
d5e813aa56 adding units tests for #44 2014-01-16 15:15:11 -08:00
Shane Grant
30836ce2bf Fix for load_and_allocate in regards to issue #42
load_and_allocate did not properly enter into the 'data' NVP that the
ptr_wrapper creates for unique/shared ptr.  When loading these types,
we now go through a wrapper struct to force entry into an extra node to
resolve this issue.

Changes to unittests are for an issue compiling with g++-4.7.3 under
Ubuntu where steady_clock::now() is not defined for some reason
2014-01-07 11:38:28 -08:00
Shane Grant
436a0a275c g++ 4.7.3 compatability fixed
closes #38

Added a preprocessor define CEREAL_OLDER_GCC that exists if using
any GCC 4.7.x or earlier.  If this is defined some type traits change to
our original solution (prior to VS compatible), which is probably what we'd switch
to if VS ever gets around to fully supporting SFINAE and constexpr.

In map and set, as well as in unit tests, use insert instead of emplace for 4.7.x.
2013-12-22 13:25:06 -08:00
Shane Grant
9085b6dc79 Adding tests for #8, fixed bug re #8
Added a test case for versioning which exposed a small bug that related to loading versioned data due to an improper use
of static.
2013-12-21 23:21:24 -08:00
Shane Grant
7ef5a9311b Making some changes on vs2013, replacing some typedefs with using statements now that those are cool 2013-12-21 21:22:46 -08:00
Shane Grant
10b7f7a00f Compiling with pedantic on
see issue #17
2013-12-21 00:08:37 -08:00
Shane Grant
f27eb02caf Compiling with clang and gcc with -Wshadow
See issue #17

Somewhere along the way we've also broken our ability to compile with GCC 4.7.3.  We'll have to decide if we care about
supporting 4.7.3 or not.  The changes that break this are:

-there is no emplace in std::map (or related) in 4.7.3
-there are some enable_ifs in rapidjson's writer.h that are always false (which is fine), but
GCC 4.7.3 doesn't like this
2013-12-20 20:22:17 -08:00
Shane Grant
855002604b unordered json working, needs to be optimized 2013-10-17 10:58:02 -07:00
Shane Grant
7bd5dffff9 working on json unordered loads, almost settled on a solution 2013-10-16 17:16:22 -07:00
Shane Grant
83e06bdc7f Fix and close #19
All containers that used insert during loads (map, unordered_map, set, unordered_set)
now use emplace or emplace_hint and move their loaded values into position.
2013-09-12 10:23:43 -07:00
Shane Grant
3fccebb030 out of order XML working properly:
Errors in unittests turned out to be errors in the way the tests were written,
not in the actual XML archive.

Additional errors were due to improper loads in vector<bool>, which is now
fixed.
2013-09-06 17:14:44 -07:00
Shane Grant
db0f1cf47f Changed the way vector<bool> works to avoid issues with XML.
XML out of order seems to be working fine but the unit tests are running into a crash on the out of order test, which
doesn't show up in the sandbox version of the same thing.  Need to debug this and out of order should be good to go
for XML.
2013-09-06 16:33:23 -07:00
Shane Grant
92559772f1 added unit test for unordered loads and fixed an error with loading/saving vectors of bools.
unit test is currently crashing on the xml load test
2013-09-01 16:11:36 -07:00
Shane Grant
c6b485ea69 done 2013-08-26 22:20:27 -07:00
Shane
de137bbc70 unit tests passing under vs2013 preview (32 bit release)
Still todo:
 * Build under debug/release for both 32 and 64 bit
 * make a project for performance
 * clean up code specific for vs and take a careful look at the changes that json.hpp needed
2013-07-19 23:25:04 -07:00
Shane
2d543a45e2 changed to using automatic linking for boost, now linking against dlls 2013-07-19 22:34:43 -07:00
Shane
da03627ff1 Removed some (but not all) of the line endings I accidentally added while in VS.
Fixed a bunch of issues related to compiling unittests on VS.

Having a problem linking against boost unit tests, so can't run the tests yet.
2013-07-18 21:42:37 -07:00
Shane
66c9bc3647 can't use initializer lists in unittests for vs, need to take them out 2013-07-17 22:49:17 -07:00
Shane
2c522cb0db cleaning up projects 2013-07-15 21:49:05 -07:00
Shane Grant
59c0a9ba8c fixed copyright in tests 2013-07-14 13:42:47 -07:00
Shane Grant
a959458344 adding portable binary to unit tests 2013-07-12 15:17:37 -07:00
Randolph Voorhies
cd9d8c4b31 Working on coverage 2013-07-10 13:14:02 -07:00
Shane Grant
cc8784660c modified unit tests to not use floats for map keys, complex now uses boost_check_close for double types 2013-07-09 10:24:20 -07:00
Randolph Voorhies
035b01b473 JSON looking good, just need to fix up all unit tests 2013-07-08 18:19:12 -07:00
Randolph Voorhies
f830367d9d Writing arrays now works. Reading is next 2013-07-08 17:14:40 -07:00
Shane Grant
f70f34ae6e added polymorphic unit test 2013-07-08 10:29:41 -07:00
Shane Grant
cded3bea43 using BOOST_CHECK_CLOSE for long double comparisons
some documentation updates to both xml and util
2013-07-08 10:13:42 -07:00
Shane Grant
0912411844 Documentation updates and priority_queue now tested for XML 2013-07-07 18:23:21 -07:00
Shane Grant
8fcb6389e8 Made unit tests work for XML, needed to put scope around output archives since they flush on destruction.
Added some documentation to XML output archive describing how it works.

Added attribute size="dynamic" to types that specify a size tag for XML, making it easier for a human to figure out what
they can add or remove data from.

Documentation updates on a few other things.
2013-07-07 18:01:17 -07:00
Shane Grant
39978c7377 added XML to all tests in unittests
Some things are failing, will need to look at this later.

string test is commented out for XML since it doesn't work with wchar yet
priority_queue test is commented out for XML since it doesn't work with empty structs automatically
2013-07-06 16:24:36 -07:00
Shane Grant
a17b067c7e adding bool to pod tests 2013-07-06 16:01:09 -07:00
Shane Grant
1f64755397 added some comments to xml for loadvalue, everything running fine through valgrind now 2013-07-06 15:58:55 -07:00
Shane Grant
283db1b09d fixes a memory issue with rapidxml, we need to make sure that input streams are null terminated (C++ api yeah right!) 2013-07-06 15:52:39 -07:00
Shane Grant
c4ce4260ed testing XML for pod types, getting some strange parsing error that needs to be sorted out. doesn't seem to happen 100%
of the time
2013-07-06 15:28:10 -07:00
Shane Grant
5445bed830 testing for specialized types
reveals that we need an error message if someone specializes but doesn't actually have the save/load functions required
2013-07-05 16:20:22 -07:00
Shane Grant
09fcbc5134 fixed multimap test 2013-07-05 16:07:54 -07:00
Randolph Voorhies
2dcf50a57f Added make_nvp<Archive> to elide unnecessary names 2013-07-03 18:57:42 -07:00
Shane Grant
002b1ceeb1 adding size_tag wrappers, XML output looking good 2013-07-03 11:17:47 -07:00
Shane Grant
7af76f4c97 Added a map of vectors to the unit test 2013-06-20 17:24:03 -07:00
Shane Grant
d5579d696d modifying tests for new file layout 2013-06-20 11:14:33 -07:00
Randolph Voorhies
27ef76de78 Added case for nullptr smart pointers 2013-06-19 19:04:21 -07:00
Randolph Voorhies
8849251bb1 More chrono unit tests 2013-06-19 18:37:06 -07:00
Randolph Voorhies
24ad0341ad Added binary enum serialization 2013-06-19 17:56:30 -07:00