classdef SCDalgo_test < SCDtest
  
  properties (Abstract=true)
    algoobj % SCD algo obj name - abstract allows modification by sub-class
  end
  
  methods (TestClassSetup)
    function clear_base(testCase)
      % clear base workspace
      testCase.assertWarningFree(@() evalin('base','clear'));
    end
    
    function setup_conf(testCase)
      testCase.assertWarningFree(@() SCDconf_setConf('SIM'));
    end
    
    function setup_algo(testCase)
      testCase.assertInstanceOf(testCase.algoobj,'SCDclass_algo');
      testCase.algoobj.init; % init data dictionary & fixed params
    end 
  end
  
  methods (TestClassTeardown)
    function close_dd(testCase) %#ok<MANU>
      Simulink.data.dictionary.closeAll('-discard');
    end
    
    function close_bd(testCase) %#ok<MANU>
      bdclose all;
    end
  end
  
  methods (Test)

    function test_printinfo(testCase)
      testCase.algoobj.printinfo;
    end
    
    function test_setup(testCase)
      testCase.algoobj.setup; % setup tunable parameters
    end
    
    function test_compile(testCase)
      testCase.algoobj.compile; % update model (Ctrl-D) Simulink
    end
    
    function test_test_harness(testCase)
      testCase.algoobj.test_harness;
    end
  end
  
end