modifying tests to find out where crash is...

This commit is contained in:
ThePhD 2017-08-11 09:59:42 -04:00
parent 10a59b2036
commit 644a5c549b
5 changed files with 56 additions and 43 deletions

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2017-08-11 07:26:11.352579 UTC // Generated 2017-08-11 13:58:32.882633 UTC
// This header was generated with sol v2.18.0 (revision eb1560d) // This header was generated with sol v2.18.0 (revision 10a59b2)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -226,6 +226,8 @@ namespace sol {
template <typename T> template <typename T>
struct as_table_t; struct as_table_t;
template <typename T> template <typename T>
struct as_container_t;
template <typename T>
struct nested; struct nested;
template <typename T> template <typename T>
struct light; struct light;
@ -14110,7 +14112,7 @@ namespace sol {
template <typename T, typename Op, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler> template <typename T, typename Op, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler>
inline void make_reg_op(Regs& l, int& index, const char* name) { inline void make_reg_op(Regs& l, int& index, const char* name) {
l[index] = { name, &c_call<decltype(&operator_wrap<T, Op>), &operator_wrap<T, Op>> }; l[index] = luaL_Reg{ name, &c_call<decltype(&operator_wrap<T, Op>), &operator_wrap<T, Op>> };
++index; ++index;
} }
@ -14122,7 +14124,7 @@ namespace sol {
template <typename T, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler> template <typename T, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler>
inline void make_to_string_op(Regs& l, int& index) { inline void make_to_string_op(Regs& l, int& index) {
const char* name = to_string(meta_function::to_string).c_str(); const char* name = to_string(meta_function::to_string).c_str();
l[index] = { name, &c_call<decltype(&default_to_string<T>), &default_to_string<T>> }; l[index] = luaL_Reg{ name, &c_call<decltype(&default_to_string<T>), &default_to_string<T>> };
++index; ++index;
} }
@ -14134,7 +14136,7 @@ namespace sol {
template <typename T, typename Regs, meta::enable<meta::has_deducible_signature<T>> = meta::enabler> template <typename T, typename Regs, meta::enable<meta::has_deducible_signature<T>> = meta::enabler>
inline void make_call_op(Regs& l, int& index) { inline void make_call_op(Regs& l, int& index) {
const char* name = to_string(meta_function::call).c_str(); const char* name = to_string(meta_function::call).c_str();
l[index] = { name, &c_call<decltype(&T::operator()), &T::operator()> }; l[index] = luaL_Reg{ name, &c_call<decltype(&T::operator()), &T::operator()> };
++index; ++index;
} }
@ -14146,7 +14148,7 @@ namespace sol {
template <typename T, typename Regs, meta::enable<meta::has_size<T>> = meta::enabler> template <typename T, typename Regs, meta::enable<meta::has_size<T>> = meta::enabler>
inline void make_length_op(Regs& l, int& index) { inline void make_length_op(Regs& l, int& index) {
const char* name = to_string(meta_function::length).c_str(); const char* name = to_string(meta_function::length).c_str();
l[index] = { name, &c_call<decltype(&T::size), &T::size> }; l[index] = luaL_Reg{ name, &c_call<decltype(&T::size), &T::size> };
++index; ++index;
} }
@ -14225,7 +14227,7 @@ namespace sol {
} }
if (!properties[static_cast<int>(meta_function::pairs)]) { if (!properties[static_cast<int>(meta_function::pairs)]) {
const char* name = to_string(meta_function::pairs).c_str(); const char* name = to_string(meta_function::pairs).c_str();
l[index] = { name, container_usertype_metatable<as_container_t<T>>::pairs_call }; l[index] = luaL_Reg{ name, container_usertype_metatable<as_container_t<T>>::pairs_call };
++index; ++index;
} }
if (!properties[static_cast<int>(meta_function::length)]) { if (!properties[static_cast<int>(meta_function::length)]) {
@ -14238,7 +14240,7 @@ namespace sol {
usertype_detail::make_call_op<T>(l, index); usertype_detail::make_call_op<T>(l, index);
} }
if (destructfunc != nullptr) { if (destructfunc != nullptr) {
l[index] = { to_string(meta_function::garbage_collect).c_str(), destructfunc }; l[index] = luaL_Reg{ to_string(meta_function::garbage_collect).c_str(), destructfunc };
++index; ++index;
} }
return index; return index;
@ -14317,7 +14319,8 @@ namespace sol {
indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(usertype_detail::walk_all_bases<false>), indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(usertype_detail::walk_all_bases<false>),
baseclasscheck(nullptr), baseclasscast(nullptr), baseclasscheck(nullptr), baseclasscast(nullptr),
secondarymeta(contains_variable()), secondarymeta(contains_variable()),
properties({}) { properties() {
properties.fill(false);
std::initializer_list<typename usertype_detail::mapping_t::value_type> ilist{ { std::initializer_list<typename usertype_detail::mapping_t::value_type> ilist{ {
std::pair<std::string, usertype_detail::call_information>( usertype_detail::make_string(std::get<I * 2>(functions)), std::pair<std::string, usertype_detail::call_information>( usertype_detail::make_string(std::get<I * 2>(functions)),
usertype_detail::call_information(&usertype_metatable::real_find_call<I * 2, I * 2 + 1, true>, usertype_detail::call_information(&usertype_metatable::real_find_call<I * 2, I * 2 + 1, true>,
@ -14885,18 +14888,17 @@ namespace sol {
private: private:
template<std::size_t... I, typename Tuple> template<std::size_t... I, typename Tuple>
simple_usertype_metatable(usertype_detail::verified_tag, std::index_sequence<I...>, lua_State* L, Tuple&& args) simple_usertype_metatable(usertype_detail::verified_tag, std::index_sequence<I...>, lua_State* L, Tuple&& args)
: callconstructfunc(lua_nil), : callconstructfunc(lua_nil),
indexfunc(lua_nil), newindexfunc(lua_nil), indexfunc(lua_nil), newindexfunc(lua_nil),
indexbase(&usertype_detail::simple_core_indexing_call<T, true>), newindexbase(&usertype_detail::simple_core_indexing_call<T, false>), indexbase(&usertype_detail::simple_core_indexing_call<T, true>), newindexbase(&usertype_detail::simple_core_indexing_call<T, false>),
indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(&usertype_detail::walk_all_bases<false>), indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(&usertype_detail::walk_all_bases<false>),
baseclasscheck(nullptr), baseclasscast(nullptr), baseclasscheck(nullptr), baseclasscast(nullptr),
mustindex(false), secondarymeta(false), properties() { mustindex(false), secondarymeta(false), properties() {
properties.fill(false);
(void)detail::swallow{ 0, (void)detail::swallow{ 0,
(add(L, detail::forward_get<I * 2>(args), detail::forward_get<I * 2 + 1>(args)),0)... (add(L, detail::forward_get<I * 2>(args), detail::forward_get<I * 2 + 1>(args)),0)...
}; };
std::array<luaL_Reg, 29> regs{};
int index = 0;
} }
template<typename... Args> template<typename... Args>
@ -14992,6 +14994,8 @@ namespace sol {
case meta_function::new_index: case meta_function::new_index:
umx.newindexfunc = second; umx.newindexfunc = second;
break; break;
default:
break;
} }
} }
break; break;

View File

@ -323,12 +323,14 @@ namespace sol {
private: private:
template<std::size_t... I, typename Tuple> template<std::size_t... I, typename Tuple>
simple_usertype_metatable(usertype_detail::verified_tag, std::index_sequence<I...>, lua_State* L, Tuple&& args) simple_usertype_metatable(usertype_detail::verified_tag, std::index_sequence<I...>, lua_State* L, Tuple&& args)
: callconstructfunc(lua_nil), : callconstructfunc(lua_nil),
indexfunc(lua_nil), newindexfunc(lua_nil), indexfunc(lua_nil), newindexfunc(lua_nil),
indexbase(&usertype_detail::simple_core_indexing_call<T, true>), newindexbase(&usertype_detail::simple_core_indexing_call<T, false>), indexbase(&usertype_detail::simple_core_indexing_call<T, true>), newindexbase(&usertype_detail::simple_core_indexing_call<T, false>),
indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(&usertype_detail::walk_all_bases<false>), indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(&usertype_detail::walk_all_bases<false>),
baseclasscheck(nullptr), baseclasscast(nullptr), baseclasscheck(nullptr), baseclasscast(nullptr),
mustindex(false), secondarymeta(false), properties() { mustindex(false), secondarymeta(false), properties() {
properties.fill(false);
(void)detail::swallow{ 0, (void)detail::swallow{ 0,
(add(L, detail::forward_get<I * 2>(args), detail::forward_get<I * 2 + 1>(args)),0)... (add(L, detail::forward_get<I * 2>(args), detail::forward_get<I * 2 + 1>(args)),0)...
}; };

View File

@ -432,7 +432,7 @@ namespace sol {
template <typename T, typename Op, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler> template <typename T, typename Op, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler>
inline void make_reg_op(Regs& l, int& index, const char* name) { inline void make_reg_op(Regs& l, int& index, const char* name) {
l[index] = { name, &c_call<decltype(&operator_wrap<T, Op>), &operator_wrap<T, Op>> }; l[index] = luaL_Reg{ name, &c_call<decltype(&operator_wrap<T, Op>), &operator_wrap<T, Op>> };
++index; ++index;
} }
@ -444,7 +444,7 @@ namespace sol {
template <typename T, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler> template <typename T, typename Supports, typename Regs, meta::enable<Supports> = meta::enabler>
inline void make_to_string_op(Regs& l, int& index) { inline void make_to_string_op(Regs& l, int& index) {
const char* name = to_string(meta_function::to_string).c_str(); const char* name = to_string(meta_function::to_string).c_str();
l[index] = { name, &c_call<decltype(&default_to_string<T>), &default_to_string<T>> }; l[index] = luaL_Reg{ name, &c_call<decltype(&default_to_string<T>), &default_to_string<T>> };
++index; ++index;
} }
@ -456,7 +456,7 @@ namespace sol {
template <typename T, typename Regs, meta::enable<meta::has_deducible_signature<T>> = meta::enabler> template <typename T, typename Regs, meta::enable<meta::has_deducible_signature<T>> = meta::enabler>
inline void make_call_op(Regs& l, int& index) { inline void make_call_op(Regs& l, int& index) {
const char* name = to_string(meta_function::call).c_str(); const char* name = to_string(meta_function::call).c_str();
l[index] = { name, &c_call<decltype(&T::operator()), &T::operator()> }; l[index] = luaL_Reg{ name, &c_call<decltype(&T::operator()), &T::operator()> };
++index; ++index;
} }
@ -468,7 +468,7 @@ namespace sol {
template <typename T, typename Regs, meta::enable<meta::has_size<T>> = meta::enabler> template <typename T, typename Regs, meta::enable<meta::has_size<T>> = meta::enabler>
inline void make_length_op(Regs& l, int& index) { inline void make_length_op(Regs& l, int& index) {
const char* name = to_string(meta_function::length).c_str(); const char* name = to_string(meta_function::length).c_str();
l[index] = { name, &c_call<decltype(&T::size), &T::size> }; l[index] = luaL_Reg{ name, &c_call<decltype(&T::size), &T::size> };
++index; ++index;
} }
@ -547,7 +547,7 @@ namespace sol {
} }
if (!properties[static_cast<int>(meta_function::pairs)]) { if (!properties[static_cast<int>(meta_function::pairs)]) {
const char* name = to_string(meta_function::pairs).c_str(); const char* name = to_string(meta_function::pairs).c_str();
l[index] = { name, container_usertype_metatable<as_container_t<T>>::pairs_call }; l[index] = luaL_Reg{ name, container_usertype_metatable<as_container_t<T>>::pairs_call };
++index; ++index;
} }
if (!properties[static_cast<int>(meta_function::length)]) { if (!properties[static_cast<int>(meta_function::length)]) {
@ -560,7 +560,7 @@ namespace sol {
usertype_detail::make_call_op<T>(l, index); usertype_detail::make_call_op<T>(l, index);
} }
if (destructfunc != nullptr) { if (destructfunc != nullptr) {
l[index] = { to_string(meta_function::garbage_collect).c_str(), destructfunc }; l[index] = luaL_Reg{ to_string(meta_function::garbage_collect).c_str(), destructfunc };
++index; ++index;
} }
return index; return index;
@ -639,7 +639,8 @@ namespace sol {
indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(usertype_detail::walk_all_bases<false>), indexbaseclasspropogation(usertype_detail::walk_all_bases<true>), newindexbaseclasspropogation(usertype_detail::walk_all_bases<false>),
baseclasscheck(nullptr), baseclasscast(nullptr), baseclasscheck(nullptr), baseclasscast(nullptr),
secondarymeta(contains_variable()), secondarymeta(contains_variable()),
properties({}) { properties() {
properties.fill(false);
std::initializer_list<typename usertype_detail::mapping_t::value_type> ilist{ { std::initializer_list<typename usertype_detail::mapping_t::value_type> ilist{ {
std::pair<std::string, usertype_detail::call_information>( usertype_detail::make_string(std::get<I * 2>(functions)), std::pair<std::string, usertype_detail::call_information>( usertype_detail::make_string(std::get<I * 2>(functions)),
usertype_detail::call_information(&usertype_metatable::real_find_call<I * 2, I * 2 + 1, true>, usertype_detail::call_information(&usertype_metatable::real_find_call<I * 2, I * 2 + 1, true>,

View File

@ -1007,7 +1007,7 @@ TEST_CASE("containers/as_container", "test that we can force a container to be t
#if SOL_LUA_VERSION > 501 #if SOL_LUA_VERSION > 501
REQUIRE_NOTHROW([&]() { REQUIRE_NOTHROW([&]() {
lua.script(R"( lua.safe_script(R"(
mop = my_object.new(20) mop = my_object.new(20)
for i, v in pairs(mop) do for i, v in pairs(mop) do
assert(i == v) assert(i == v)
@ -1027,6 +1027,7 @@ c_mo = mo
c_iterable = mo:iterable() c_iterable = mo:iterable()
)"); )");
}()); }());
my_object& mo = lua["c_mo"]; my_object& mo = lua["c_mo"];
my_object& mo_iterable = lua["c_iterable"]; my_object& mo_iterable = lua["c_iterable"];
REQUIRE(&mo == &mo_iterable); REQUIRE(&mo == &mo_iterable);

View File

@ -922,17 +922,22 @@ TEST_CASE("containers/pointer types", "check that containers with unique usertyp
std::vector<base_t*> v2; std::vector<base_t*> v2;
v2.push_back(&d1); v2.push_back(&d1);
v2.push_back(&d2); v2.push_back(&d2);
REQUIRE_NOTHROW([&]() {
lua["c1"] = std::move(v1);
lua["c2"] = &v2;
}());
lua["c1"] = std::move(v1); REQUIRE_NOTHROW([&]() {
lua["c2"] = &v2; lua.safe_script("b1 = c1[1]");
base_t* b1 = lua["b1"];
int val1 = b1->get();
REQUIRE(val1 == 250);
}());
lua.safe_script("b1 = c1[1]"); REQUIRE_NOTHROW([&]() {
base_t* b1 = lua["b1"]; lua.safe_script("b2 = c2[2]");
int val1 = b1->get(); base_t* b2 = lua["b2"];
REQUIRE(val1 == 250); int val2 = b2->get();
REQUIRE(val2 == 500);
lua.safe_script("b2 = c2[2]"); }());
base_t* b2 = lua["b2"];
int val2 = b2->get();
REQUIRE(val2 == 500);
} }