GCC Code Coverage Report


Directory: ./
File: src/timeseries.cpp
Date: 2024-04-18 12:22:13
Exec Total Coverage
Lines: 16 17 94.1%
Functions: 2 2 100.0%
Branches: 18 30 60.0%

Line Branch Exec Source
1 #include "timeseries.hpp"
2
3 1 Timeseries::Timeseries(System *system, Integrator *integrator, const YAML::Node &config)
4
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 : system(system), integrator(integrator) {
5
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 if (config["keys"].IsSequence()) {
6
6/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
3 for (auto &k : config["keys"]) {
7
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 this->keys.push_back(k.as<std::string>());
8
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
3 }
9 } else {
10 throw std::invalid_argument("No timeseries keys found!");
11 }
12 1 int reserveSize = 10000;
13
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->time.reserve(reserveSize);
14
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 for (const std::string &key : this->keys) {
15
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->data[key].reserve(reserveSize);
16 }
17 1 }
18
19 3 void Timeseries::record() {
20 3 time.push_back(system->t);
21
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
6 for (const std::string &key : keys) {
22 3 data.at(key).push_back(functions.at(key)(system, integrator));
23 }
24 3 }
25