GCC Code Coverage Report


Directory: ./
File: tests/serialization.cc
Date: 2025-05-17 13:07:10
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 10 30 33.3%
Branches: 8 16 50.0%

Line Branch Exec Source
1 // Copyright (c) 2020, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28
29 #include "serialization.hh"
30
31 #include <hpp/util/serialization.hh>
32
33 BOOST_CLASS_EXPORT_IMPLEMENT(Foo)
34
35 template <class Archive>
36 4 void Foo::serialize(Archive& ar, const unsigned int version) {
37 (void)version;
38
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 ar& hpp::serialization::make_nvp("i", i_);
39 4 }
40
41 HPP_SERIALIZATION_IMPLEMENT(Foo);
42
43 BOOST_CLASS_EXPORT_IMPLEMENT(Bar)
44
45 template <class Archive>
46 2 void Bar::load(Archive& ar, const unsigned int version) {
47 (void)version;
48
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 ar& hpp::serialization::make_nvp("i", i_);
49
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
4 f_ = hpp::serialization::cast(ar).template get<Foo>("foo", true);
50 2 }
51
52 template <class Archive>
53 4 void Bar::save(Archive& ar, const unsigned int version) const {
54 (void)version;
55
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 ar& hpp::serialization::make_nvp("i", i_);
56 4 }
57
58 HPP_SERIALIZATION_SPLIT_IMPLEMENT(Bar);
59
60 namespace boost {
61 namespace serialization {
62
63 template <class Archive>
64 4 void serialize(Archive& ar, FooFree& foo, const unsigned int version) {
65 (void)version;
66
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 ar& hpp::serialization::make_nvp("i", foo.i_);
67 4 }
68
69 template <class Archive>
70 2 void load(Archive& ar, BarFree& bar, const unsigned int version) {
71 (void)version;
72
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 ar& hpp::serialization::make_nvp("i", bar.i_);
73 2 }
74
75 template <class Archive>
76 2 void save(Archive& ar, const BarFree& bar, const unsigned int version) {
77 (void)version;
78
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 ar& hpp::serialization::make_nvp("i", bar.i_);
79 2 }
80
81 } // namespace serialization
82 } // namespace boost
83
84 HPP_SERIALIZATION_FREE_IMPLEMENT(FooFree)
85
86 4 HPP_SERIALIZATION_SPLIT_FREE_IMPLEMENT(BarFree)
87