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

Return-To-The-Roots / libsiedler2 / 15190243458

22 May 2025 03:09PM UTC coverage: 81.681% (-0.02%) from 81.697%
15190243458

push

github

Flamefire
Use C++17 variable templates for traits

4 of 4 new or added lines in 2 files covered. (100.0%)

1 existing line in 1 file now uncovered.

5199 of 6365 relevant lines covered (81.68%)

4234.45 hits per line

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

73.91
/src/FileEntry.cpp
1
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
2
//
3
// SPDX-License-Identifier: GPL-2.0-or-later
4

5
#include "FileEntry.h"
6
#include "s25util/strAlgos.h"
7
#include <boost/range/combine.hpp>
8

9
bool libsiedler2::operator<(const FileEntry& left, const FileEntry& right)
26✔
10
{
11
    if(left.nr < 0 || right.nr < 0)
26✔
12
    {
13
        // If any has a number, it is first
14
        if(left.nr >= 0)
14✔
15
            return true;
6✔
16
        if(right.nr >= 0)
8✔
17
            return false;
6✔
18
    } else if(left.nr < right.nr)
12✔
UNCOV
19
        return true;
×
20
    else if(left.nr > right.nr)
12✔
21
        return false;
12✔
22
    // Palettes come first
23
    if(left.bobtype != right.bobtype)
2✔
24
    {
25
        if(left.bobtype == BobType::Palette)
×
26
            return true;
×
27
        else if(right.bobtype == BobType::Palette)
×
28
            return false;
×
29
    }
30
    // Both negative or same
31
    for(const auto it : boost::combine(left.name, right.name))
2✔
32
    {
33
        auto const lhs = s25util::toLower(it.get<0>());
2✔
34
        auto const rhs = s25util::toLower(it.get<1>());
2✔
35
        if(lhs < rhs)
2✔
36
            return true;
2✔
37
        else if(lhs > rhs)
2✔
38
            return false;
2✔
39
    }
40
    return left.name.size() < right.name.size();
×
41
}
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