mirror of
https://github.com/boostorg/mysql.git
synced 2026-02-14 00:42:53 +00:00
First field tests
This commit is contained in:
@@ -30,7 +30,7 @@ public:
|
||||
field& operator=(field&&) = default;
|
||||
~field() = default;
|
||||
|
||||
field(std::nullptr_t) noexcept : repr_(null_t()) {}
|
||||
explicit field(std::nullptr_t) noexcept : repr_(null_t()) {}
|
||||
field(signed char v) noexcept : repr_(std::int64_t(v)) {}
|
||||
field(short v) noexcept : repr_(std::int64_t(v)) {}
|
||||
field(int v) noexcept : repr_(std::int64_t(v)) {}
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
field(unsigned int v) noexcept : repr_(std::uint64_t(v)) {}
|
||||
field(unsigned long v) noexcept : repr_(std::uint64_t(v)) {}
|
||||
field(unsigned long long v) noexcept : repr_(std::uint64_t(v)) {}
|
||||
field(std::string&& v) noexcept : repr_(std::move(v)) {}
|
||||
field(std::string v) noexcept : repr_(std::move(v)) {}
|
||||
field(float v) noexcept : repr_(v) {}
|
||||
field(double v) noexcept : repr_(v) {}
|
||||
field(const date& v) noexcept : repr_(v) {}
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
field& operator=(unsigned int v) noexcept { repr_.emplace<std::uint64_t>(v); return *this; }
|
||||
field& operator=(unsigned long v) noexcept { repr_.emplace<std::uint64_t>(v); return *this; }
|
||||
field& operator=(unsigned long long v) noexcept { repr_.emplace<std::uint64_t>(v); return *this; }
|
||||
field& operator=(std::string&& v) { repr_.emplace<std::string>(std::move(v)); return *this; }
|
||||
field& operator=(std::string v) { repr_.emplace<std::string>(std::move(v)); return *this; }
|
||||
field& operator=(float v) noexcept { repr_.emplace<float>(v); return *this; }
|
||||
field& operator=(double v) noexcept { repr_.emplace<double>(v); return *this; }
|
||||
field& operator=(const date& v) noexcept { repr_.emplace<date>(v); return *this; }
|
||||
@@ -98,7 +98,6 @@ public:
|
||||
datetime* if_datetime() noexcept { return boost::variant2::get_if<datetime>(&repr_); }
|
||||
time* if_time() noexcept { return boost::variant2::get_if<time>(&repr_); }
|
||||
|
||||
|
||||
const std::int64_t& as_int64() const { return internal_as<std::int64_t>(); }
|
||||
const std::uint64_t& as_uint64() const { return internal_as<std::uint64_t>(); }
|
||||
const std::string& as_string() const { return internal_as<std::string>(); }
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
* Caution: `value(NULL)` will __NOT__ match this overload. It will try to construct
|
||||
* a `boost::string_view` from a NULL C string, causing undefined behavior.
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR field_view(std::nullptr_t) noexcept : repr_(null_t()) {}
|
||||
BOOST_CXX14_CONSTEXPR explicit field_view(std::nullptr_t) noexcept : repr_(null_t()) {}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR field_view(signed char v) noexcept : repr_(std::int64_t(v)) {}
|
||||
BOOST_CXX14_CONSTEXPR field_view(short v) noexcept : repr_(std::int64_t(v)) {}
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
BOOST_CXX14_CONSTEXPR field_view(const time& v) noexcept : repr_(v) {}
|
||||
|
||||
// TODO: hide this
|
||||
BOOST_CXX14_CONSTEXPR field_view(detail::string_view_offset v) noexcept : repr_(v) {}
|
||||
BOOST_CXX14_CONSTEXPR explicit field_view(detail::string_view_offset v) noexcept : repr_(v) {}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline field_kind kind() const noexcept;
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ add_executable(
|
||||
# unit/detail/protocol/row_deserialization.cpp
|
||||
|
||||
unit/field_view.cpp
|
||||
unit/field.cpp
|
||||
|
||||
# unit/metadata.cpp
|
||||
# unit/value_constexpr.cpp
|
||||
|
||||
1037
test/unit/field.cpp
Normal file
1037
test/unit/field.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,16 +8,9 @@
|
||||
#include <boost/mysql/field_view.hpp>
|
||||
#include <boost/test/tools/context.hpp>
|
||||
#include <boost/test/unit_test_suite.hpp>
|
||||
#include <boost/type_index.hpp>
|
||||
#include <boost/test/data/monomorphic/collection.hpp>
|
||||
#include <boost/test/data/test_case.hpp>
|
||||
#include <boost/utility/string_view_fwd.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
#include "test_common.hpp"
|
||||
|
||||
BOOST_TEST_DONT_PRINT_LOG_VALUE(boost::mysql::date)
|
||||
@@ -27,7 +20,6 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(boost::mysql::time)
|
||||
using namespace boost::mysql::test;
|
||||
using boost::mysql::field_view;
|
||||
using boost::mysql::field_kind;
|
||||
using boost::typeindex::type_index;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user