| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "telnov_counting_the_frequency/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <chrono> | ||
| 4 | #include <cstdint> | ||
| 5 | #include <string> | ||
| 6 | |||
| 7 | #include "telnov_counting_the_frequency/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace telnov_counting_the_frequency { | ||
| 10 | |||
| 11 | 24 | TelnovCountingTheFrequencySEQ::TelnovCountingTheFrequencySEQ(const InType &in) { | |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | 24 | GetInput() = in; | |
| 14 | GetOutput() = 0; | ||
| 15 | 24 | } | |
| 16 | |||
| 17 | 24 | bool TelnovCountingTheFrequencySEQ::ValidationImpl() { | |
| 18 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | return (GetInput() > 0) && (GetOutput() == 0); |
| 19 | } | ||
| 20 | |||
| 21 | 24 | bool TelnovCountingTheFrequencySEQ::PreProcessingImpl() { | |
| 22 | 24 | GetOutput() = 2 * GetInput(); | |
| 23 | 24 | return GetOutput() > 0; | |
| 24 | } | ||
| 25 | |||
| 26 | 24 | bool TelnovCountingTheFrequencySEQ::RunImpl() { | |
| 27 | const std::string &s = GlobalData::g_data_string; | ||
| 28 | int64_t cnt = 0; | ||
| 29 |
2/2✓ Branch 0 taken 48000000 times.
✓ Branch 1 taken 24 times.
|
48000024 | for (char c : s) { |
| 30 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 47999880 times.
|
48000000 | if (c == 'X') { |
| 31 | 120 | cnt++; | |
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | 24 | GetOutput() = static_cast<int>(cnt); | |
| 36 | |||
| 37 | using Clock = std::chrono::high_resolution_clock; | ||
| 38 | 24 | auto delay_start = Clock::now(); | |
| 39 |
2/2✓ Branch 1 taken 297747 times.
✓ Branch 2 taken 24 times.
|
297771 | while (std::chrono::duration<double>(Clock::now() - delay_start).count() < 0.001) { |
| 40 | } | ||
| 41 | |||
| 42 | 24 | return true; | |
| 43 | } | ||
| 44 | |||
| 45 | 24 | bool TelnovCountingTheFrequencySEQ::PostProcessingImpl() { | |
| 46 | 24 | return GetOutput() == GetInput(); | |
| 47 | } | ||
| 48 | |||
| 49 | } // namespace telnov_counting_the_frequency | ||
| 50 |