summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-05-22 16:42:06 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-05-22 16:42:06 +0100
commit2317b4608821b03da0cc288d06b9c0bdb6b60239 (patch)
tree7dd46e3c2c5601e603baa7defa057cd4d41fc4c9 /test
parentMove everything into more sensible places (diff)
downloadmygrate-2317b4608821b03da0cc288d06b9c0bdb6b60239.tar.bz2
mygrate-2317b4608821b03da0cc288d06b9c0bdb6b60239.tar.xz
mygrate-2317b4608821b03da0cc288d06b9c0bdb6b60239.zip
Pass linter checks
Except IWYU, doesn't like the C++20 CTF.
Diffstat (limited to 'test')
-rw-r--r--test/test-bitset.cpp6
-rw-r--r--test/test-rawDataReader.cpp16
-rw-r--r--test/test-streams.cpp19
3 files changed, 33 insertions, 8 deletions
diff --git a/test/test-bitset.cpp b/test/test-bitset.cpp
index 15e43d6..02b3893 100644
--- a/test/test-bitset.cpp
+++ b/test/test-bitset.cpp
@@ -1,10 +1,12 @@
#define BOOST_TEST_MODULE BitSet
-#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
#include "helpers.h"
+#include <array>
#include <bitset.h>
#include <bitset>
+#include <cstddef>
+#include <span>
using namespace MyGrate;
@@ -14,7 +16,7 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(BitSet::Iterator);
BOOST_AUTO_TEST_CASE(bitset)
{
- std::byte bytes[3] {0x00_b, 0xFF_b, 0xa1_b};
+ constexpr std::array<std::byte, 3> bytes {0x00_b, 0xFF_b, 0xa1_b};
BitSet bs {bytes};
BOOST_REQUIRE_EQUAL(bs.size(), 24);
diff --git a/test/test-rawDataReader.cpp b/test/test-rawDataReader.cpp
index 4ac0a8a..b211fe3 100644
--- a/test/test-rawDataReader.cpp
+++ b/test/test-rawDataReader.cpp
@@ -3,10 +3,20 @@
#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
+#include "bitset.h"
#include "helpers.h"
+#include "mariadb_repl.h"
+#include <cstddef>
+#include <cstdint>
+#include <mysql.h>
#include <mysql_types.h>
#include <rawDataReader.h>
+#include <stdexcept>
#include <streamSupport.h>
+#include <string>
+#include <string_view>
+#include <tuple>
+#include <vector>
using namespace MyGrate;
@@ -147,10 +157,10 @@ BOOST_DATA_TEST_CASE(read_field_type,
BOOST_AUTO_TEST_CASE(rdr_from_MARIADB_STRING)
{
- char buf[5] = "test";
- MARIADB_STRING str {buf, strlen(buf)};
+ std::string buf {"test"};
+ MARIADB_STRING str {buf.data(), buf.length()};
RawDataReader rdr {str};
- BOOST_CHECK_EQUAL(rdr.viewValue<std::string_view>(4), "test");
+ BOOST_CHECK_EQUAL(rdr.viewValue<std::string_view>(buf.length()), buf);
}
using SimpleTypes = boost::mpl::list<std::byte, int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t,
diff --git a/test/test-streams.cpp b/test/test-streams.cpp
index 9e79bd6..3958e36 100644
--- a/test/test-streams.cpp
+++ b/test/test-streams.cpp
@@ -2,7 +2,20 @@
#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
+#include "bitset.h"
#include "helpers.h"
+#include "mariadb_repl.h"
+#include "mysql_types.h"
+#include <array>
+#include <cstddef>
+#include <ctime>
+#include <iosfwd>
+#include <string>
+#include <string_view>
+#include <tuple>
+#include <vector>
+struct timespec;
+struct tm;
#include <streamSupport.h>
BOOST_FIXTURE_TEST_SUITE(stream, std::stringstream);
@@ -56,7 +69,7 @@ BOOST_DATA_TEST_CASE(tss,
*this << in;
BOOST_CHECK_EQUAL(this->str(), exp);
}
-constexpr std::byte somebits[3] {0x00_b, 0xFF_b, 0xa1_b};
+constexpr std::array<std::byte, 3> somebits {0x00_b, 0xFF_b, 0xa1_b};
BOOST_DATA_TEST_CASE(bss,
boost::unit_test::data::make<ToStream<MyGrate::BitSet>>({
{{MyGrate::BitSet {somebits}}, "[0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1]"},
@@ -69,8 +82,8 @@ BOOST_DATA_TEST_CASE(bss,
BOOST_AUTO_TEST_CASE(mariadb_string)
{
- char buf[5] = "test";
- MARIADB_STRING str {buf, strlen(buf)};
+ std::string buf {"test"};
+ MARIADB_STRING str {buf.data(), buf.length()};
*this << str;
BOOST_CHECK_EQUAL(this->str(), buf);
}