USE RevoTestDB;

-------------------------------------------------------------------------------
---- To run a specific test in SSMS, set Query -> SQLCMD Mode and uncomment the following SQLCMD commands

---- SQLCMD commands
--:setvar funname "rxFastLinear_regression"
--:setvar connstr "Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True;"
----!!echo %cd%

---- T-SQL statements
SELECT @@SERVERNAME AS 'Server Name', @@VERSION AS 'Server Version', @@SERVICENAME AS 'Service Name'

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxFastForest_binary' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxFastForest';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = age30 ~ car.age + type + cost + number, type = "binary", transforms = quote(list(age30 = (age == "30-34" | age == "35-39"))), rowSelection = quote(number > 10)';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';	--@myfunname;
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "age", "age30"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [age] VARCHAR(MAX), [age30] BIT, [PredictedLabel] INT, [Score] FLOAT, [Probability] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxFastForest_regression' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxFastForest';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = cost10 ~ car.age + type + age + number, type = "regression", transforms = quote(list(cost10 = 10 * cost)), rowSelection = quote(number > 10)';	-- bug: need stricter response type checking
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';	--@myfunname;
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "cost", "cost10"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [cost] FLOAT, [cost10] FLOAT, [Score] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxFastTrees_binary' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxFastTrees';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = age30 ~ car.age + type + cost + number, type = "binary", transforms = quote(list(age30 = (age == "30-34" | age == "35-39"))), rowSelection = quote(number > 10)';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "age", "age30"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [age] VARCHAR(MAX), [age30] BIT, [PredictedLabel] INT, [Score] FLOAT, [Probability] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxFastTrees_regression' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxFastTrees';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = cost10 ~ car.age + type + age + number, type = "regression", transforms = quote(list(cost10 = 10 * cost)), rowSelection = quote(number > 10)';	-- bug: need stricter response type checking
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "cost", "cost10"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [cost] FLOAT, [cost10] FLOAT, [Score] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxFastLinear_regression' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxFastLinear';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = cost10 ~ car.age + type + age + number, type = "regression", trainThreads = 1, transforms = quote(list(cost10 = 10 * cost)), rowSelection = quote(number > 10)';	-- bug: need stricter response type checking
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "cost", "cost10"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [cost] FLOAT, [cost10] FLOAT, [Score] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxFastLinear_binary' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxFastLinear';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = age30 ~ car.age + type + cost + number, type = "binary",trainThreads=1, transforms = quote(list(age30 = (age == "30-34" | age == "35-39"))), rowSelection = quote(number > 10)';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "age", "age30"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [age] VARCHAR(MAX), [age30] BIT, [PredictedLabel] INT, [Score] FLOAT, [Probability] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxLogisticRegression_binary' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxLogisticRegression';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = age30 ~ car.age + type + cost + number, type = "binary", transforms = quote(list(age30 = (age == "30-34" | age == "35-39"))), rowSelection = quote(number > 10)';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "age", "age30"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [age] VARCHAR(MAX), [age30] BIT, [PredictedLabel] INT, [Score] FLOAT, [Probability] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxLogisticRegression_multiClass' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxLogisticRegression';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = type ~ age + car.age + cost10 + number, type = "multiClass", transforms = quote(list(cost10 = 10 * cost)), rowSelection = quote(number > 10)';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';	--@myfunname;
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "type", "cost10"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [type] VARCHAR(MAX), [cost10] FLOAT, [PredictedLabel] VARCHAR(MAX), [Score.A] FLOAT, [Score.B] FLOAT, [Score.C] FLOAT, [Score.D] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxNeuralNet_binary' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxNeuralNet';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = age30 ~ car.age + type + cost + number, type = "binary", transforms = quote(list(age30 = (age == "30-34" | age == "35-39"))), rowSelection = quote(number > 10)';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';	--@myfunname;
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "age", "age30"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [age] VARCHAR(MAX), [age30] BIT, [PredictedLabel] INT, [Score] FLOAT, [Probability] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxNeuralNet_multiClass' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxNeuralNet';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = type ~ age + car.age + cost10 + number, type = "multiClass", transforms = quote(list(cost10 = 10 * cost)), rowSelection = quote(number > 10)';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';	--@myfunname;
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "type", "cost10"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [type] VARCHAR(MAX), [cost10] FLOAT, [PredictedLabel] VARCHAR(MAX), [Score.A] FLOAT, [Score.B] FLOAT, [Score.C] FLOAT, [Score.D] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxNeuralNet_regression' OR '$(funname)' LIKE '$%'
BEGIN
	--Error: *** Exception: 'Found NaNs or infinity in network parameters. Try using maxnorm option to limit parameter values.'
	DECLARE @myfunname VARCHAR(MAX) = 'rxNeuralNet';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = cost10 ~ car.age + type + age + number, type = "regression", transforms = quote(list(cost10 = 10 * cost)), rowSelection = quote(number > 10)';	-- bug: need stricter response type checking
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';
	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "cost", "cost10"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [cost] FLOAT, [cost10] FLOAT, [Score] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
IF '$(funname)' = 'rxOneClassSvm' OR '$(funname)' LIKE '$%'
BEGIN
	DECLARE @myfunname VARCHAR(MAX) = 'rxOneClassSvm';
	DECLARE @myfunargs VARCHAR(MAX) = 'formula = agen ~ car.age + type + cost + number, transforms = quote(list(agen = !(age == "60+"))), rowSelection = quote(!(age == "60+"))';
	DECLARE @myfundata VARCHAR(MAX) = 'claims.xdf';

	DECLARE @myconnstr VARCHAR(MAX) = 'Driver=SQL Server;Server=.;Database=RevoTestDB;Uid=RevoTester;Trusted_Connection=True';

	IF '$(connstr)' NOT LIKE '$%' SET @myconnstr = '$(connstr)';

	DECLARE @modeltable VARCHAR(MAX) = '#' + '$(funname)';
	--TODO (lgong) 2016-03-30: why outModelBin do not match?
	DECLARE @testvalues VARCHAR(MAX) = 'Formula, mamlCode, Description, summaryType';	--'dataSource, params, call, outModel, outModelBin'

	EXEC dbo.sp_exec_rre_test
		@funname = @myfunname
		, @funargs = @myfunargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;

	DECLARE @myprdargs VARCHAR(MAX) = 'extraVarsToWrite = c("RowNum", "age", "agen"), overwrite = TRUE';
	SET @modeltable = @modeltable + '_rxPredict';
	SET @testvalues = '[RowNum] INT, [age] VARCHAR(MAX), [agen] BIT, [Score] FLOAT';
	EXEC dbo.sp_exec_rre_test_pred
		@funname = @myfunname
		, @funargs = @myfunargs
		, @prdargs = @myprdargs
		, @fundata = @myfundata
		, @connstr = @myconnstr
		, @modeltable = @modeltable
		, @testvalues = @testvalues
		;
END
GO

-------------------------------------------------------------------------------
--TODO: add more tests here

-------------------------------------------------------------------------------
SELECT * FROM SqlServerIOQ_Tests;

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