Details (do not affect regular code)
* Avoids multiple definitions of 'lua_assert' in test file. * Smaller C-stack limit in test mode. * Note in the manual about the use of false * Extra test for constant reuse.
This commit is contained in:
10
lauxlib.h
10
lauxlib.h
@@ -160,11 +160,15 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
|
|||||||
/*
|
/*
|
||||||
** Internal assertions for in-house debugging
|
** Internal assertions for in-house debugging
|
||||||
*/
|
*/
|
||||||
|
#if !defined(lua_assert)
|
||||||
|
|
||||||
#if defined LUAI_ASSERT
|
#if defined LUAI_ASSERT
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#define lua_assert(c) assert(c)
|
#define lua_assert(c) assert(c)
|
||||||
#else
|
#else
|
||||||
#define lua_assert(x) ((void)0)
|
#define lua_assert(c) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
5
ltests.h
5
ltests.h
@@ -130,6 +130,11 @@ LUA_API void *debug_realloc (void *ud, void *block,
|
|||||||
#define LUAI_MAXSTACK 50000
|
#define LUAI_MAXSTACK 50000
|
||||||
|
|
||||||
|
|
||||||
|
/* test mode uses more stack space */
|
||||||
|
#undef LUAI_MAXCCALLS
|
||||||
|
#define LUAI_MAXCCALLS 180
|
||||||
|
|
||||||
|
|
||||||
/* force Lua to use its own implementations */
|
/* force Lua to use its own implementations */
|
||||||
#undef lua_strx2number
|
#undef lua_strx2number
|
||||||
#undef lua_number2strx
|
#undef lua_number2strx
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ The type @emph{boolean} has two values, @false and @true.
|
|||||||
Both @nil and @false make a condition false;
|
Both @nil and @false make a condition false;
|
||||||
they are collectively called @def{false values}.
|
they are collectively called @def{false values}.
|
||||||
Any other value makes a condition true.
|
Any other value makes a condition true.
|
||||||
|
Despite its name,
|
||||||
|
@false is frequently used as an alternative to @nil,
|
||||||
|
with the key difference that @false behaves
|
||||||
|
like a regular value in a table,
|
||||||
|
while a @nil in a table represents an absent key.
|
||||||
|
|
||||||
The type @emph{number} represents both
|
The type @emph{number} represents both
|
||||||
integer numbers and real (floating-point) numbers,
|
integer numbers and real (floating-point) numbers,
|
||||||
|
|||||||
@@ -55,6 +55,20 @@ end
|
|||||||
checkKlist(foo, {3.78/4, -3.78/4, -3.79/4})
|
checkKlist(foo, {3.78/4, -3.78/4, -3.79/4})
|
||||||
|
|
||||||
|
|
||||||
|
foo = function (f, a)
|
||||||
|
f(100 * 1000)
|
||||||
|
f(100.0 * 1000)
|
||||||
|
f(-100 * 1000)
|
||||||
|
f(-100 * 1000.0)
|
||||||
|
f(100000)
|
||||||
|
f(100000.0)
|
||||||
|
f(-100000)
|
||||||
|
f(-100000.0)
|
||||||
|
end
|
||||||
|
|
||||||
|
checkKlist(foo, {100000, 100000.0, -100000, -100000.0})
|
||||||
|
|
||||||
|
|
||||||
-- testing opcodes
|
-- testing opcodes
|
||||||
|
|
||||||
-- check that 'f' opcodes match '...'
|
-- check that 'f' opcodes match '...'
|
||||||
|
|||||||
Reference in New Issue
Block a user