src/t_tst_cse.c
int
t_tst_cse_create( lua_State *L )
{
	const char *name;

	luaL_argcheck( L, lua_type( L, -2 ) == LUA_TSTRING,   -2,
		"testcase description must be a string." );
	luaL_argcheck( L, lua_type( L, -1 ) == LUA_TFUNCTION, -1,
		"testcase value must be a function." );
	name = luaL_checkstring( L, -2 );
	if (0==strncasecmp( name, "test_cb_", 8 ))
		lua_pushstring( L, "callback" );
	else if (0==strncasecmp( name, "test_cr_", 8 ))
		lua_pushstring( L, "coroutine" );
	else
		lua_pushstring( L, "standard" );

	lua_newtable( L );                    //S: nme fnc typ tbl
	lua_insert( L, -4 );                  //S: tbl nme fnc typ
	lua_setfield( L, -4, "testtype" );    //S: tbl nme fnc fnc
	lua_setfield( L, -3, "function" );    //S: tbl nme
	lua_setfield( L, -2, "description" ); //S: tbl

	luaL_getmetatable( L, T_TST_CSE_TYPE );
	lua_setmetatable( L, -2 );
	return 1;
}
/**--------------------------------------------------------------------------
 * Create the Test.Case table and leave it on the stack.
 * \param   L      Lua state.
 * \lparam  string name of the unit test case function.
 * \lparam  func   test case function.
 * \lreturn table  T.Test.Case Lua table instance.
 * \return  int    # of values pushed onto the stack.
 * --------------------------------------------------------------------------*/
Create the Test.Case table and leave it on the stack.
\param   L      Lua state.
\lparam  string name of the unit test case function.
\lparam  func   test case function.
\lreturn table  T.Test.Case Lua table instance.
\return  int    # of values pushed onto the stack.
Create the Test . Case table and leave it on the stack . \ param L Lua state . \ lparam string name of the unit test case function . \ lparam func test case function . \ lreturn table T . Test . Case Lua table instance . \ return int # of values pushed onto the stack .
int
t_tst_cse_create( lua_State *L )
{
	const char *name;
	luaL_argcheck( L, lua_type( L, -2 ) == LUA_TSTRING,   -2,
		"testcase description must be a string." );
	luaL_argcheck( L, lua_type( L, -1 ) == LUA_TFUNCTION, -1,
		"testcase value must be a function." );
	name = luaL_checkstring( L, -2 );
	if (0==strncasecmp( name, "test_cb_", 8 ))
		lua_pushstring( L, "callback" );
	else if (0==strncasecmp( name, "test_cr_", 8 ))
		lua_pushstring( L, "coroutine" );
	else
		lua_pushstring( L, "standard" );
	lua_newtable( L );                    
	lua_insert( L, -4 );                  
	lua_setfield( L, -4, "testtype" );    
	lua_setfield( L, -3, "function" );    
	lua_setfield( L, -2, "description" ); 
	luaL_getmetatable( L, T_TST_CSE_TYPE );
	lua_setmetatable( L, -2 );
	return 1;
}
int t_tst_cse_create ( lua_State * L ) { const char * name ; luaL_argcheck ( L , lua_type ( L , -2 ) == LUA_TSTRING , -2 , " " ) ; luaL_argcheck ( L , lua_type ( L , -1 ) == LUA_TFUNCTION , -1 , " " ) ; name = luaL_checkstring ( L , -2 ) ; if ( 0 == strncasecmp ( name , " " , 8 ) ) lua_pushstring ( L , " " ) ; else if ( 0 == strncasecmp ( name , " " , 8 ) ) lua_pushstring ( L , " " ) ; else lua_pushstring ( L , " " ) ; lua_newtable ( L ) ; lua_insert ( L , -4 ) ; lua_setfield ( L , -4 , " " ) ; lua_setfield ( L , -3 , " " ) ; lua_setfield ( L , -2 , " " ) ; luaL_getmetatable ( L , T_TST_CSE_TYPE ) ; lua_setmetatable ( L , -2 ) ; return 1 ; }
Create the Test.Case table and leave it on the stack.
Create the Test . Case table and leave it on the stack .
//S: nme fnc typ tbl //S: tbl nme fnc typ //S: tbl nme fnc fnc //S: tbl nme //S: tbl