/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/lua/equality_runme.lua
41 строка
879 B
Erez Geva
Remove Lua 5.0 and Lua 5.1 and Lua options
30 май 2026, 19:24
30 май 2026, 19:24
74ff929
Код
Авторство
О чём код?
eq=require("equality") catch_undef_globs() -- catch "undefined" global variables -- === No equality operator === -- logically same data without equality operator are not equal p1 = eq.MakePoint(10,9) p2 = eq.MakePoint(10,9) assert( p1 ~= p2 ) -- different wrappers for same Point* are equal p3 = eq.GetZeroPointPtr() p4 = eq.GetZeroPointPtr() assert( p3 == p4 ) -- === Logically correct equality operator === ed1 = eq.EqualOpDefined(10) ed2 = eq.EqualOpDefined(10) ed3 = eq.EqualOpDefined(15) assert( ed1 == ed2 ) assert( ed1 ~= ed3 ) -- === Logically incorrect equality operator === ew1 = eq.EqualOpWrong() ew2 = eq.EqualOpWrong() assert( ew1 ~= ew2 ) ew3 = eq.EqualOpWrong.GetStaticObject() ew4 = eq.EqualOpWrong.GetStaticObject() -- Even though these are pointers to same object, operator== overload should -- state that they are not equal assert( ew3 ~= ew4 )