--[[----------------------------------------------------------------------------

WFLuaNativeTestCase.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2020 Adobe
All Rights Reserved.

NOTICE: All information contained herein is, and remains
the property of Adobe and its suppliers, if any. The intellectual
and technical concepts contained herein are proprietary to Adobe
and its suppliers and are protected by all applicable intellectual
property laws, including trade secret and copyright laws.
Dissemination of this information or reproduction of this material
is strictly forbidden unless prior written permission is obtained
from Adobe.

------------------------------------------------------------------------------]]

local Rx = require 'Rx'

	-- WF.core.utils
local WFArguments = require 'WFArguments'
local WFCloseSupport = require 'WFCloseSupport'

local WFLuaNativeTestImp = require 'WFLuaNativeTestImp'


--------------------------------------------------------------------------------

local check = assert( WFArguments.check )


--============================================================================--
--[[!
	\class WFLuaNativeTestCase

	\brief A WFLuaNativeTest provides a way to load and run native tests.

]]--

-- @mark WFLuaNativeTestCase class

local WFLuaNativeTestCase = {

	_test = false,
		-- (native test object)
		
	_testName = false,
		-- (string) testName


	WFCloseSupport.addCloseSupportMethods,

}

--------------------------------------------------------------------------------
--[[!
	\brief Construct a WFLuaNativeTestCase object.

	\param testName (string) The name of the lua test function
	\param nativeTestKey (string) A key which can be used to 
			set up the native test object
]]--

function WFLuaNativeTestCase:__init( testName, nativeTestKey )

	check( 'WFLuaNativeTestCase', 'string', 'string' )

	self._testName = testName
	
	self._test = WFLuaNativeTestImp.make( testName, nativeTestKey )
	assert( WFLuaNativeTestImp.setupTest( self._test, nativeTestKey ))

end

--------------------------------------------------------------------------------
--[[!
	\brief Runs a specific fn of the native test

	\param fnKey (string) Function identifier/name
]]--

function WFLuaNativeTestCase:runTest( fnKey )

	check( 'WFLuaNativeTestCase', 'string' )

	return WFLuaNativeTestImp.runTest( self._test, fnKey )

end

--------------------------------------------------------------------------------

return Rx.Class 'WFLuaNativeTestCase'( WFLuaNativeTestCase )
