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

pcb2gcode / pcb2gcode / 21021097492

15 Jan 2026 05:42AM UTC coverage: 70.124% (+10.1%) from 60.064%
21021097492

push

github

web-flow
Merge pull request #752 from eyal0/integration_tests_in_ci

ci: Include integration tests as part of coverage.

4430 of 7541 branches covered (58.75%)

Branch coverage included in aggregate %.

3710 of 4067 relevant lines covered (91.22%)

15236187.44 hits per line

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

61.22
/common.cpp
1
/*
2
 * This file is part of pcb2gcode.
3
 * 
4
 * Copyright (C) 2015 Nicola Corna <nicola@corna.info>
5
 * 
6
 * pcb2gcode is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 * 
11
 * pcb2gcode is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with pcb2gcode.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19

20
#include "common.hpp"
21

22
#include <fstream>
23
#include <boost/algorithm/string.hpp>
24

25
#include <boost/format.hpp>
26
using boost::format;
27
using std::string;
28

29
#include <boost/system/api_config.hpp>  // for BOOST_POSIX_API or BOOST_WINDOWS_API
30

31
#include "units.hpp"
32

33
bool workSide( const boost::program_options::variables_map &options, string type )
262✔
34
{
35
    const string side = type + "-side";
262✔
36
    const string front = type + "-front";
262!
37
    
38
    if( options.count(front) )
39
        return options[front].as<bool>();
×
40
    else
41
    {
42
        switch (options[side].as<BoardSide::BoardSide>()) {
262✔
43
            case BoardSide::FRONT:
44
                return true;
45
            case BoardSide::BACK:
7✔
46
                return false;
7✔
47
            case BoardSide::AUTO:
249✔
48
            default:
49
                if( options.count("front") || !options.count("back") )
818!
50
                    return true;    // back+front, front only, <nothing>
51
                else
52
                    return false;   // back only
118✔
53
        }
54
    }
55
}
56

57
// Based on the explanation here:
58
// https://www.geeksforgeeks.org/python-os-path-join-method/
59
string build_filename(const string& a, const string& b) {
1,020!
60
#ifdef BOOST_WINDOWS_API
61
  static constexpr auto seperator = '\\';
62
#endif
63

64
#ifdef BOOST_POSIX_API
65
  static constexpr auto seperator = '/';
66
#endif
67

68
  if (a.size() == 0 || b.front() == seperator) {
1,020!
69
    return b;
×
70
  }
71
  if (b.size() == 0) {
1,020!
72
    if (a.back() != seperator) {
×
73
      return a + seperator;
×
74
    } else {
75
      return a;
×
76
    }
77
  }
78
  if (a.back() != seperator) {
1,020!
79
    return a + seperator + b;
2,040!
80
  } else {
81
    return a + b;
×
82
  }
83
}
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