Commit dcce2eca authored by Dominik Charousset's avatar Dominik Charousset

Fix sign warnings

parent 3f4d5566
...@@ -55,29 +55,31 @@ CAF_TEST(signed_arraybuf) { ...@@ -55,29 +55,31 @@ CAF_TEST(signed_arraybuf) {
} }
CAF_TEST(unsigned_arraybuf) { CAF_TEST(unsigned_arraybuf) {
using buf_type = arraybuf<uint8_t>;
std::vector<uint8_t> data = {0x0a, 0x0b, 0x0c, 0x0d}; std::vector<uint8_t> data = {0x0a, 0x0b, 0x0c, 0x0d};
arraybuf<uint8_t> ab{data}; buf_type ab{data};
decltype(data) buf; decltype(data) buf;
std::copy(std::istreambuf_iterator<uint8_t>{&ab}, std::copy(std::istreambuf_iterator<uint8_t>{&ab},
std::istreambuf_iterator<uint8_t>{}, std::istreambuf_iterator<uint8_t>{},
std::back_inserter(buf)); std::back_inserter(buf));
CAF_CHECK_EQUAL(data, buf); CAF_CHECK_EQUAL(data, buf);
// Relative positioning. // Relative positioning.
using pos = arraybuf<uint8_t>::pos_type; using pos_type = buf_type::pos_type;
CAF_CHECK_EQUAL(ab.pubseekoff(2, std::ios::beg, std::ios::in), pos{2}); using int_type = buf_type::int_type;
CAF_CHECK_EQUAL(ab.sbumpc(), static_cast<int>(0x0c)); CAF_CHECK_EQUAL(ab.pubseekoff(2, std::ios::beg, std::ios::in), pos_type{2});
CAF_CHECK_EQUAL(ab.sgetc(), 0x0d); CAF_CHECK_EQUAL(ab.sbumpc(), int_type{0x0c});
CAF_CHECK_EQUAL(ab.pubseekoff(0, std::ios::cur, std::ios::in), pos{3}); CAF_CHECK_EQUAL(ab.sgetc(), int_type{0x0d});
CAF_CHECK_EQUAL(ab.pubseekoff(-2, std::ios::cur, std::ios::in), pos{1}); CAF_CHECK_EQUAL(ab.pubseekoff(0, std::ios::cur, std::ios::in), pos_type{3});
CAF_CHECK_EQUAL(ab.sgetc(), 0x0b); CAF_CHECK_EQUAL(ab.pubseekoff(-2, std::ios::cur, std::ios::in), pos_type{1});
CAF_CHECK_EQUAL(ab.pubseekoff(-4, std::ios::end, std::ios::in), pos{0}); CAF_CHECK_EQUAL(ab.sgetc(), int_type{0x0b});
CAF_CHECK_EQUAL(ab.sgetc(), 0x0a); CAF_CHECK_EQUAL(ab.pubseekoff(-4, std::ios::end, std::ios::in), pos_type{0});
CAF_CHECK_EQUAL(ab.sgetc(), int_type{0x0a});
// Absolute positioning. // Absolute positioning.
CAF_CHECK_EQUAL(ab.pubseekpos(1, std::ios::in), pos{1}); CAF_CHECK_EQUAL(ab.pubseekpos(1, std::ios::in), pos_type{1});
CAF_CHECK_EQUAL(ab.sgetc(), 0x0b); CAF_CHECK_EQUAL(ab.sgetc(), int_type{0x0b});
CAF_CHECK_EQUAL(ab.pubseekpos(3, std::ios::in), pos{3}); CAF_CHECK_EQUAL(ab.pubseekpos(3, std::ios::in), pos_type{3});
CAF_CHECK_EQUAL(ab.sbumpc(), 0x0d); CAF_CHECK_EQUAL(ab.sbumpc(), int_type{0x0d});
CAF_CHECK_EQUAL(ab.in_avail(), 0); CAF_CHECK_EQUAL(ab.in_avail(), std::streamsize{0});
} }
CAF_TEST(containerbuf) { CAF_TEST(containerbuf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment