diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-10 18:16:57 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-10 18:16:57 +0200 |
commit | 7d31e295dc782afc92f3215d1571e629a5407fbf (patch) | |
tree | 2be6f774be1b41f65dd4e8c015712dacee42c21b /deep_test | |
parent | ae582acdb1bfb3fb4171682b884545d174e95aa9 (diff) | |
download | lanes-7d31e295dc782afc92f3215d1571e629a5407fbf.tar.gz lanes-7d31e295dc782afc92f3215d1571e629a5407fbf.tar.bz2 lanes-7d31e295dc782afc92f3215d1571e629a5407fbf.zip |
Removed .demote_full_userdata
Diffstat (limited to 'deep_test')
-rw-r--r-- | deep_test/deep_test.cpp | 2 | ||||
-rw-r--r-- | deep_test/deeptest.lua | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/deep_test/deep_test.cpp b/deep_test/deep_test.cpp index 812019a..178075d 100644 --- a/deep_test/deep_test.cpp +++ b/deep_test/deep_test.cpp | |||
@@ -58,7 +58,7 @@ void MyDeepFactory::deleteDeepObjectInternal(lua_State* const L_, DeepPrelude* c | |||
58 | { | 58 | { |
59 | MyDeepUserdata* const _self{ static_cast<MyDeepUserdata*>(MyDeepFactory::Instance.toDeep(L, 1)) }; | 59 | MyDeepUserdata* const _self{ static_cast<MyDeepUserdata*>(MyDeepFactory::Instance.toDeep(L, 1)) }; |
60 | _self->inUse.fetch_add(1, std::memory_order_seq_cst); | 60 | _self->inUse.fetch_add(1, std::memory_order_seq_cst); |
61 | std::ignore = luaG_pushstring(L, "%p:deep(%d)", lua_topointer(L, 1), _self->val); | 61 | std::ignore = luaG_pushstring(L, "%p:deep(%d)", _self, _self->val); |
62 | _self->inUse.fetch_sub(1, std::memory_order_seq_cst); | 62 | _self->inUse.fetch_sub(1, std::memory_order_seq_cst); |
63 | return 1; | 63 | return 1; |
64 | } | 64 | } |
diff --git a/deep_test/deeptest.lua b/deep_test/deeptest.lua index 250eb98..bab91d9 100644 --- a/deep_test/deeptest.lua +++ b/deep_test/deeptest.lua | |||
@@ -38,9 +38,13 @@ local printDeep = function( prefix_, obj_, t_) | |||
38 | print ("uv #" .. uvi, type( uservalue), uservalue, type(uservalue) == "function" and uservalue() or "") | 38 | print ("uv #" .. uvi, type( uservalue), uservalue, type(uservalue) == "function" and uservalue() or "") |
39 | end | 39 | end |
40 | if t_ then | 40 | if t_ then |
41 | for k, v in pairs( t_) do | 41 | local count = 0 |
42 | for k, v in ipairs( t_) do | ||
42 | print( "t["..tostring(k).."]", v) | 43 | print( "t["..tostring(k).."]", v) |
44 | count = count + 1 | ||
43 | end | 45 | end |
46 | -- we should have only 2 indexed entries with the same value | ||
47 | assert(count == 2 and t_[1] == t_[2]) | ||
44 | end | 48 | end |
45 | print() | 49 | print() |
46 | end | 50 | end |
@@ -56,8 +60,11 @@ local performTest = function( obj_) | |||
56 | 60 | ||
57 | local t = | 61 | local t = |
58 | { | 62 | { |
59 | ["key"] = obj_, | 63 | -- two indices with an identical value: we should also have identical values on the other side (even if not the same as the original ones when they are clonables) |
60 | [obj_] = "val" -- this one won't transfer because we don't support full uservalue as keys | 64 | obj_, |
65 | obj_, | ||
66 | -- this one won't transfer because we don't support full uservalue as keys | ||
67 | [obj_] = "val" | ||
61 | } | 68 | } |
62 | 69 | ||
63 | -- read back the contents of the object | 70 | -- read back the contents of the object |