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

mavlink / MAVSDK / 16485391475

24 Jul 2025 01:13AM UTC coverage: 46.33% (+1.2%) from 45.096%
16485391475

push

github

web-flow
Merge pull request #2610 from mavlink/pr-add-libmavlike

Integrate parts of libmav into MAVSDK and add MavlinkDirect plugin

764 of 987 new or added lines in 14 files covered. (77.41%)

10 existing lines in 1 file now uncovered.

16272 of 35122 relevant lines covered (46.33%)

359.99 hits per line

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

82.35
/src/system_tests/fs_helpers.cpp
1
#include "fs_helpers.h"
2
#include "log.h"
3
#include <algorithm>
4
#include <iostream>
5
#include <iterator>
6
#include <filesystem>
7
#include <fstream>
8
#include <cstring>
9

10
using namespace mavsdk;
11

12
bool create_temp_file(const fs::path& path, size_t len, uint8_t start)
121✔
13
{
14
    const auto parent_path = path.parent_path();
121✔
15
    create_directories(parent_path);
121✔
16

17
    std::ofstream tempfile{};
121✔
18
    tempfile.open(path, std::ios::out | std::ios::binary | std::ios::trunc);
121✔
19
    if (tempfile.fail()) {
121✔
NEW
20
        LogWarn() << "Failed to open temp file";
×
21
        return false;
×
22
    }
23

24
    for (size_t i = 0; i < len; ++i) {
151,571✔
25
        const char c = (i + start) % 256;
151,450✔
26
        tempfile.write(&c, 1);
151,450✔
27
    }
28

29
    tempfile.close();
121✔
30

31
    return true;
121✔
32
}
121✔
33

34
bool reset_directories(const fs::path& path)
123✔
35
{
36
    std::error_code ec;
123✔
37
    fs::remove_all(path, ec);
123✔
38

39
    return fs::create_directories(path);
123✔
40
}
41

42
bool are_files_identical(const fs::path& path1, const fs::path& path2)
9✔
43
{
44
    std::ifstream file1(path1, std::ios::binary);
9✔
45
    std::ifstream file2(path2, std::ios::binary);
9✔
46

47
    if (!file1) {
9✔
NEW
48
        LogWarn() << "Could not open " << path1;
×
49
        return false;
×
50
    }
51

52
    if (!file2) {
9✔
NEW
53
        LogWarn() << "Could not open " << path2;
×
54
        return false;
×
55
    }
56

57
    std::istreambuf_iterator<char> begin1(file1);
9✔
58
    std::istreambuf_iterator<char> begin2(file2);
9✔
59
    std::istreambuf_iterator<char> end;
9✔
60

61
    return std::equal(begin1, end, begin2, end);
9✔
62
}
9✔
63

64
bool file_exists(const fs::path& path)
6✔
65
{
66
    return fs::exists(path);
6✔
67
}
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

© 2025 Coveralls, Inc