-- $LastChangedDate: 2008-10-20 09:36:48 -0500 (Mon, 20 Oct 2008) $

print( "Running class_Test.lua" )

-- Test that C++ code created a table to emulate a namespace/module.
-- This tests REGISTER_CLASS_TABLE() in lua_bind/macros.cc.
-- The module name should be "sim".
assert( sim, "ERROR: module sim not exported" )
assert( sim.Test, "ERROR: sim.Test not exported" )
assert( sim.Test2, "ERROR: sim.Test2 not exported" )

-- Basic test.
test = sim.Test.new()        -- wrapper of a C++ ref-cnt object
test_GetABC = test:GetABC()  -- test calling method of metatable
assert( test:GetABC() == "ABC", "test::GetABC() failed" )

-- Test the second class.
test2 = sim.Test2.new()
assert( test2:GetDEF() == "DEF", "test2::GetDEF() failed" )

-- Test Lua's garbage-collector and C++ destructor.
test = nil
collectgarbage()
