-- $LastChangedDate: 2011-03-15 14:18:37 -0400 (Tue, 15 Mar 2011) $
-- LEGAL: COPYRIGHT (C) 2010 JIM E. BROOKS WWW.PALOMINO3D.ORG

print( "Running class_Test.lua" )

-- Test that C++ code created a table to emulate a namespace/module.
-- This tests REGISTER_BINDING() in lua_bind/macros_generic.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++ refCount 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()
