• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mbits-os / quick_dra / 22038263728

15 Feb 2026 03:31PM UTC coverage: 93.378% (+6.4%) from 87.008%
22038263728

Pull #39

github

web-flow
Merge 74a89bbd4 into 7d773e4d9
Pull Request #39: testing

58 of 67 new or added lines in 23 files covered. (86.57%)

75 existing lines in 12 files now uncovered.

4033 of 4319 relevant lines covered (93.38%)

1107.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.97
/libs/libmodels/src/models/parser_debug.cpp
1
// Copyright (c) 2026 midnightBITS
2
// This code is licensed under MIT license (see LICENSE for details)
3

4
#include <fmt/ranges.h>
5
#include <quick_dra/base/str.hpp>
6
#include <quick_dra/models/types.hpp>
7

8
namespace quick_dra::v1 {
9
        namespace {
10
                std::string from_rate(rate const& r) {
61✔
11
                        std::vector<std::string> result{};
181✔
12
                        result.reserve(2);
181✔
13
                        if (r.payer != percent{}) {
61✔
14
                                result.push_back(fmt::format("payer {}%", r.payer));
145✔
15
                        }
72✔
16
                        if (r.insured != percent{}) {
61✔
17
                                result.push_back(fmt::format("insured {}%", r.insured));
193✔
18
                        }
96✔
19
                        if (result.empty()) {
61✔
20
                                result.push_back("payer 0%"s);
×
21
                        }
22
                        return join(result, ", "_sep);
241✔
23
                }
181✔
24
        }  // namespace
25

26
        void config::debug_print(verbose level) const noexcept {
22✔
27
                if (level == verbose::none) {
22✔
28
                        return;
10✔
29
                }
6✔
30

36✔
31
                if (level == verbose::names_only) {
19✔
32
                        fmt::print("-- payer: {} {}\n", payer.first_name, payer.last_name);
10✔
33
                        fmt::print("-- insured:\n");
10✔
34
                        for (auto const& obj : insured) {
13✔
35
                                fmt::print("--   - {} {}\n", obj.first_name, obj.last_name);
12✔
36
                        }
7✔
37
                } else if (level == verbose::names_and_summary) {
46✔
38
                        fmt::print("-- payer: {} {} ({})\n", payer.first_name,
12✔
39
                                   payer.last_name, payer.tax_id);
9✔
40
                        fmt::print("-- insured:\n");
10✔
41
                        for (auto const& obj : insured) {
13✔
42
                                auto const scale = obj.part_time_scale.value_or(ratio{});
10✔
43
                                fmt::print("--   - {} {} ({}), {}/{} of {}\n", obj.first_name,
18✔
44
                                           obj.last_name, obj.document, std::max(1u, scale.num),
11✔
45
                                           std::max(1u, scale.den),
10✔
46
                                           obj.salary
6✔
47
                                               .transform([](auto const& value) {
7✔
48
                                                       return fmt::format("{} zł", value);
12✔
49
                                               })
7✔
50
                                               .value_or("<minimal pay>"));
16✔
51
                        }
7✔
52
                        return;
10✔
53
                } else {
24✔
54
                        fmt::print("-- payer:\n");
37✔
55
                        fmt::print("--   name: {} {}\n", payer.first_name, payer.last_name);
37✔
56
                        fmt::print("--   social id: {}\n", payer.social_id);
37✔
57
                        fmt::print("--   tax id: {}\n", payer.tax_id);
37✔
58
                        fmt::print("--   ident: {} {}\n", payer.kind, payer.document);
37✔
59

24✔
60
                        fmt::print("-- insured:\n");
37✔
61
                        for (auto const& obj : insured) {
25✔
62
                                auto const scale = obj.part_time_scale.value_or(ratio{});
37✔
63

24✔
64
                                fmt::print("--   - name: {} {}\n", obj.first_name,
37✔
65
                                           obj.last_name);
36✔
66
                                fmt::print("--     insurance title: {}\n",
37✔
67
                                           fmt::join(obj.title.split(), " "));
52✔
68
                                fmt::print("--     ident: {} {}\n", obj.kind, obj.document);
37✔
69
                                fmt::print("--     salary: {}/{} of {}\n",
41✔
70
                                           std::max(1u, scale.num), std::max(1u, scale.den),
44✔
71
                                           obj.salary
24✔
72
                                               .transform([](auto const& value) {
25✔
73
                                                       return fmt::format("{} zł", value);
34✔
74
                                               })
19✔
75
                                               .value_or("<minimal pay>"));
64✔
76
                        }
25✔
77
                }
24✔
78

30✔
79
                if (level < verbose::parameters) {
16✔
80
                        return;
28✔
81
                }
18✔
82

12✔
83
                fmt::print("-- parameters\n");
7✔
84
                fmt::print("--   cost of obtaining: {} zł / {} zł\n",
23✔
85
                           params.costs_of_obtaining.local,
18✔
86
                           params.costs_of_obtaining.remote);
18✔
87
                fmt::print("--   health: {}\n", from_rate(params.contributions.health));
25✔
88
                fmt::print("--   pension insurance: {}\n",
19✔
89
                           from_rate(params.contributions.pension_insurance));
24✔
90
                fmt::print("--   disability insurance: {}\n",
19✔
91
                           from_rate(params.contributions.disability_insurance));
24✔
92
                fmt::print("--   health insurance: {}\n",
19✔
93
                           from_rate(params.contributions.health_insurance));
24✔
94
                fmt::print("--   accident insurance: {}\n",
19✔
95
                           from_rate(params.contributions.accident_insurance));
24✔
96
                fmt::print("--   tax scale for month reported:\n");
19✔
97
                for (auto const& [amount, tax] : params.scale)
31✔
98
                        fmt::print("--     over {} zł at {}%\n", amount, tax);
21✔
99
        }
13✔
100

101
        void tax_config::debug_print(verbose level) const noexcept {
22✔
102
                if (level < verbose::parameters) {
22✔
103
                        return;
46✔
104
                }
30✔
105

12✔
106
                fmt::print("-- costs of obtaining per month:\n");
7✔
107
                for (auto const& [date, coo] : costs_of_obtaining) {
25✔
108
                        fmt::print(
23✔
109
                            "--   {}-{:02}: {} zł / {} zł\n", static_cast<int>(date.year()),
20✔
110
                            static_cast<unsigned>(date.month()), coo.local, coo.remote);
24✔
111
                }
13✔
112

12✔
113
                fmt::print("-- minimal pay per month:\n");
19✔
114
                for (auto const& [date, amount] : minimal_pay) {
133✔
115
                        fmt::print("--   {}-{:02}: {} zł\n", static_cast<int>(date.year()),
155✔
116
                                   static_cast<unsigned>(date.month()), amount);
168✔
117
                }
85✔
118

12✔
119
                fmt::print("-- tax scale per month:\n");
19✔
120
                for (auto const& [date, levels] : scale) {
43✔
121
                        fmt::print("--   {}-{:02}:\n", static_cast<int>(date.year()),
41✔
122
                                   static_cast<unsigned>(date.month()));
40✔
123
                        for (auto const& [amount, tax] : levels) {
85✔
124
                                fmt::print("--     over {} zł at {}%\n", amount, tax);
89✔
125
                        }
49✔
126
                }
25✔
127

12✔
128
                fmt::print("-- insurance rates per month:\n");
19✔
129
                for (auto const& [date, rates] : contributions) {
13✔
130
                        fmt::print("--   {}-{:02}:\n", static_cast<int>(date.year()),
21✔
131
                                   static_cast<unsigned>(date.month()));
20✔
132
                        fmt::print("--     health: {}\n", from_rate(rates.health));
25✔
133
                        fmt::print("--     pension insurance: {}\n",
19✔
134
                                   from_rate(rates.pension_insurance));
24✔
135
                        fmt::print("--     disability insurance: {}\n",
19✔
136
                                   from_rate(rates.disability_insurance));
24✔
137
                        fmt::print("--     health insurance: {}\n",
19✔
138
                                   from_rate(rates.health_insurance));
24✔
139
                        fmt::print("--     accident insurance: {}\n",
19✔
140
                                   from_rate(rates.accident_insurance));
24✔
141
                }
13✔
142
        }
13✔
143
}  // namespace quick_dra::v1
144

145
namespace quick_dra {
146
        void compiled_templates::debug_print() const noexcept {
147
                fmt::print("-- templates:\n");
148

149
                for (auto const& [kedu, report] : reports) {
UNCOV
150
                        fmt::print("--   [{}]:\n", kedu);
×
UNCOV
151
                        quick_dra::debug_print(report);
×
152
                }
153
        }
×
154
}  // namespace quick_dra
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc