Skip to content

Commit

Permalink
Merge pull request #232 from bbbgan/master
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Dec 7, 2023
2 parents 056dadd + 3477a71 commit 22c2461
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
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

0 comments on commit 22c2461

Please sign in to comment.