classdef test_expcodes < matlab.unittest.TestCase
  
  properties
    expcode_obj;
    SCDexps;
  end
  
  properties(MethodSetupParameter)
    expcode_number = {1,1005,1006,1010}; % list of expcodes to test
  end
  
  methods(TestClassSetup)
    function setup_environment(testCase)
      testCase.addTeardown(@cd,pwd);
      testCase.addTeardown(@path,path);
      
      basePath = fullfile(fileparts(mfilename('fullpath')),'..');
      run(fullfile(basePath,'rtccode_paths'));
      
      % get SCD experimental code object container
      testCase.SCDexps = SCDconf_createexpcodes;
    end
  end
    
  methods(TestMethodSetup)
    function setup_expcode(testCase,expcode_number)
      % get this expcode object from expcode object container
      testCase.expcode_obj = getbymaincode(testCase.SCDexps,expcode_number);
    end 
  end
  
  methods(Test)
    function test_callinits(testCase)
      testCase.expcode_obj.callinits;
    end
    
    function test_setup(testCase)
      testCase.expcode_obj.setup; % run setup this exp code
    end
    
    function test_expcode(testCase)
      % attempt compiling tcv.slx for this expcode
      testCase.expcode_obj.compile; % compile tcv.slx with this expcode
    end
    
  end
end
