30 lines
736 B
C++
30 lines
736 B
C++
#include <Void/Binary/Reader.hpp>
|
|
#include <Void/Functional/Result.hpp>
|
|
#include <Void/Math/Numeric.hpp>
|
|
#include <Void/Text/Str.hpp>
|
|
#include <Void/Time/Stopwatch.hpp>
|
|
|
|
#include <array>
|
|
#include <bit>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
int main()
|
|
{
|
|
const auto r = Void::Numeric::checked_mul(6, 7);
|
|
if (!r || *r != 42) {
|
|
return 1;
|
|
}
|
|
if (Void::Str::to_upper("ok") != "OK") {
|
|
return 1;
|
|
}
|
|
const std::array bytes{std::byte{0x2A}};
|
|
Void::Binary::Reader reader{bytes};
|
|
const auto b = reader.read<std::uint8_t>(std::endian::big);
|
|
Void::Time::Stopwatch sw;
|
|
sw.start();
|
|
(void)sw.stop();
|
|
const auto res = Void::Result::ok(b.value_or(0));
|
|
return res && *res == 42 ? 0 : 1;
|
|
}
|