Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Nov 21, 2023
1 parent 679350f commit e080c15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/struct_pack/tests/test_optimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TEST_CASE("test width too big") {
buffer.push_back(0b11000);
auto result = struct_pack::deserialize<struct_pack::DISABLE_ALL_META_INFO,
std::string>(buffer);
REQUIRE(!result.has_value());
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand All @@ -21,7 +21,7 @@ TEST_CASE("test width too big") {
std::size_t len = 0;
auto result = struct_pack::deserialize<struct_pack::DISABLE_ALL_META_INFO,
std::string>(buffer, len);
REQUIRE(!result.has_value());
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand All @@ -34,7 +34,7 @@ TEST_CASE("test width too big") {
buffer.push_back(0b11000);
auto result =
struct_pack::get_field<std::pair<std::string, std::string>, 0>(buffer);
REQUIRE(!result.has_value());
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand All @@ -47,7 +47,7 @@ TEST_CASE("test width too big") {
buffer.push_back(0b11);
auto result = struct_pack::deserialize<
std::pair<std::string, struct_pack::compatible<int>>>(buffer);
REQUIRE(!result.has_value());
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand Down
13 changes: 7 additions & 6 deletions src/struct_pack/tests/test_serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <type_traits>
#include <utility>
#include <variant>

#include "ylt/struct_pack/compatible.hpp"

#define private public
Expand Down Expand Up @@ -1288,7 +1289,7 @@ TEST_CASE("test width too big") {
buffer.push_back(0b11000);
auto result = struct_pack::deserialize<struct_pack::DISABLE_ALL_META_INFO,
std::string>(buffer);
REQUIRE(!result.has_value());
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand All @@ -1302,7 +1303,7 @@ TEST_CASE("test width too big") {
std::size_t len = 0;
auto result = struct_pack::deserialize<struct_pack::DISABLE_ALL_META_INFO,
std::string>(buffer, len);
REQUIRE(!result.has_value());
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand All @@ -1315,7 +1316,7 @@ TEST_CASE("test width too big") {
buffer.push_back(0b11000);
auto result =
struct_pack::get_field<std::pair<std::string, std::string>, 0>(buffer);
REQUIRE(!result.has_value());
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand All @@ -1326,9 +1327,9 @@ TEST_CASE("test width too big") {
SUBCASE("4") {
std::string buffer;
buffer.push_back(0b11);
auto result =
struct_pack::deserialize<std::pair<std::string, struct_pack::compatible<int>>>(buffer);
REQUIRE(!result.has_value());
auto result = struct_pack::deserialize<
std::pair<std::string, struct_pack::compatible<int>>>(buffer);
REQUIRE(result.has_value() == false);
if constexpr (SIZE_WIDTH < 8) {
CHECK(result.error() == struct_pack::errc::too_width_size);
}
Expand Down

0 comments on commit e080c15

Please sign in to comment.