-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add precompiled headers, switch to debug build mode. Signed-off-by: Melg Eight <public.melg8@gmail.com>
- Loading branch information
Showing
15 changed files
with
129 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-FileCopyrightText: © 2024 Melg Eight <public.melg8@gmail.com> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#ifndef PRECOMPILED_HEADERS_H | ||
#define PRECOMPILED_HEADERS_H | ||
|
||
#include <fmt/color.h> | ||
#include <fmt/core.h> | ||
#include <fmt/format.h> | ||
#include <spdlog/spdlog.h> | ||
#include <ctre.hpp> | ||
#include <glaze/glaze.hpp> | ||
#include <libassert/assert.hpp> | ||
#include <magic_enum/magic_enum.hpp> | ||
#include <range/v3/algorithm/for_each.hpp> | ||
#include <range/v3/range/conversion.hpp> | ||
#include <range/v3/view/filter.hpp> | ||
#include <range/v3/view/join.hpp> | ||
|
||
#include <cctype> | ||
#include <chrono> | ||
#include <coroutine> | ||
#include <cstdlib> | ||
#include <functional> | ||
#include <iostream> | ||
#include <map> | ||
#include <string> | ||
#include <string_view> | ||
#include <utility> | ||
#include <vector> | ||
|
||
#endif // PRECOMPILED_HEADERS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
sources/coal/tests/unit_tests/sources/span_reinterpret_test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-FileCopyrightText: © 2024 Melg Eight <public.melg8@gmail.com> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include <testing_framework.h> | ||
|
||
namespace coal::test { | ||
|
||
template <class T> | ||
[[nodiscard]] std::span<T> ReinterpretAsSpanOf( | ||
std::span<std::byte> s) noexcept { | ||
auto data = s.data(); | ||
if (!data || s.empty()) { | ||
return {}; | ||
} | ||
const auto bytes = s.size_bytes(); | ||
const auto count = bytes / static_cast<int>(sizeof(T)); | ||
return std::span<T>{reinterpret_cast<T*>(data), count}; | ||
} | ||
|
||
SCENARIO("reinterpretation of span of bytes into span of uint8_t values") { | ||
std::vector<std::byte> data{std::byte(0), std::byte(1), std::byte(2), | ||
std::byte(3), std::byte(4)}; | ||
|
||
const std::span<uint8_t> span = ReinterpretAsSpanOf<uint8_t>(data); | ||
|
||
CHECK(span.size() == 5); | ||
CHECK(span[0] == uint8_t{0}); | ||
CHECK(span[1] == uint8_t{1}); | ||
CHECK(span[2] == uint8_t{2}); | ||
CHECK(span[3] == uint8_t{3}); | ||
CHECK(span[4] == uint8_t{4}); | ||
} | ||
|
||
} // namespace coal::test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters