INSTINCT Code Coverage Report


Directory: src/
File: util/Random/RandomNumberGenerator.cpp
Date: 2025-02-07 16:54:41
Exec Total Coverage
Lines: 6 12 50.0%
Functions: 1 2 50.0%
Branches: 2 8 25.0%

Line Branch Exec Source
1 /// This file is part of INSTINCT, the INS Toolkit for Integrated
2 /// Navigation Concepts and Training by the Institute of Navigation of
3 /// the University of Stuttgart, Germany.
4 ///
5 /// This Source Code Form is subject to the terms of the Mozilla Public
6 /// License, v. 2.0. If a copy of the MPL was not distributed with this
7 /// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9 /// @file RandomNumberGenerator.cpp
10 /// @brief Random Number generator
11 /// @author T. Topp (topp@ins.uni-stuttgart.de)
12 /// @date 2023-08-24
13
14 #include "RandomNumberGenerator.hpp"
15
16 namespace NAV
17 {
18
19 void to_json(json& j, const RandomNumberGenerator& rng)
20 {
21 j = json{
22 { "useSeed", rng.useSeed },
23 { "seed", rng.seed },
24 };
25 }
26 112 void from_json(const json& j, RandomNumberGenerator& rng)
27 {
28
1/2
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
112 if (j.contains("useSeed"))
29 {
30 112 j.at("useSeed").get_to(rng.useSeed);
31 }
32
1/2
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
112 if (j.contains("seed"))
33 {
34 112 j.at("seed").get_to(rng.seed);
35 }
36 112 }
37
38 } // namespace NAV
39