Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix skip_sapces_and_newline #232

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iguana/xml_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ inline constexpr auto has_equal = [](uint64_t chunk) IGUANA__INLINE_LAMBDA {

template <typename It>
IGUANA_INLINE void skip_sapces_and_newline(It &&it, It &&end) {
while (it != end && (*it < 33)) {
while (it != end && (static_cast<uint8_t>(*it) < 33)) {
++it;
}
}
Expand Down
2 changes: 1 addition & 1 deletion iguana/yaml_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace iguana {
// return true when it==end
template <typename It>
IGUANA_INLINE bool skip_space_till_end(It &&it, It &&end) {
while (it != end && *it < 33) ++it;
while (it != end && (static_cast<uint8_t>(*it) < 33)) ++it;
return it == end;
}

Expand Down
23 changes: 13 additions & 10 deletions test/test_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
#include <list>
#include <vector>
#define DOCTEST_CONFIG_IMPLEMENT
#include <iostream>
#include <optional>

#include "doctest.h"
#include "iguana/xml_reader.hpp"
#include "iguana/xml_writer.hpp"
#include <iostream>
#include <optional>

struct Owner_t {
std::string ID;
Expand Down Expand Up @@ -196,7 +197,7 @@ TEST_CASE("test some type") {
CHECK(s.hasdescription == true);
CHECK(s.c == 'X');
CHECK(*s.d_v == 3.14159);
CHECK(s.name == "John Doe");
CHECK(s.name == "张三");
CHECK(s.addr == "123 Main St");
CHECK(s.status == enum_status::stop);
};
Expand All @@ -216,7 +217,7 @@ TEST_CASE("test some type") {
<hasdescription>true</hasdescription>
<c>X</c>
<d_v>3.14159</d_v>
<name>John Doe</name>
<name>张三</name>
<addr>123 Main St</addr>
<status>1</status>
</some_type_t>
Expand Down Expand Up @@ -547,11 +548,12 @@ enum class Color {
};
enum class Status { stop = 10, start };
namespace iguana {
template <> struct enum_value<Fruit> {
template <>
struct enum_value<Fruit> {
constexpr static std::array<int, 6> value = {9999, -4, 10, 99, 7, 100000};
};

} // namespace iguana
} // namespace iguana
struct test_enum_t {
Fruit a;
Fruit b;
Expand All @@ -564,7 +566,7 @@ struct test_enum_t {
};
REFLECTION(test_enum_t, a, b, c, d, e, f, g, h);

#if defined(__clang__) || defined(_MSC_VER) || \
#if defined(__clang__) || defined(_MSC_VER) || \
(defined(__GNUC__) && __GNUC__ > 8)

TEST_CASE("test enum") {
Expand Down Expand Up @@ -605,10 +607,11 @@ TEST_CASE("test enum") {

enum class State { STOP = 10, START };
namespace iguana {
template <> struct enum_value<State> {
template <>
struct enum_value<State> {
constexpr static std::array<int, 1> value = {10};
};
} // namespace iguana
} // namespace iguana

struct enum_exception_t {
State a;
Expand Down Expand Up @@ -641,7 +644,7 @@ class some_object {
int id;
std::string name;

public:
public:
some_object() = default;
some_object(int i, std::string str) : id(i), name(str) {}
int get_id() const { return id; }
Expand Down
Loading