classdef testDecompositionImproper < TestCase
    methods
        %% Setup functions
        function self = testDecompositionCore(name)
            self = self@TestCase(name);
        end
        
        %% improper, ordinary
        % decomposition
        %   * does it work?
        %   * validation OK?
        %
        % validity mapping
        %   * does (confinement mapping) work?
        %   * is the result confined?
        %   * is the gradual modification properly applied?
        %   * does the (validity mapping) work
        %   * is the result valid?
        %   * is the gradual modification properly applied?
        %
        % measure calculation
        %   * are projected measures validated OK?
        %   * can I add measures?
        %   * are added measures validated OK?
                
        %% improper, odd representation
        function testImproperOdd(self)
            % facet normals
            A = [1 0; -1  0;  0 1; 0 -1; ...
                 1 1; -1 -1; -1 1; 1 -1];
            % initial group mapping
            M = [1 1 1 1 3 3  3  3; ...
                 0 0 0 0 1 1 -1 -1]';
            % proper decomposition
            decProper = obtainDec(A, 'mapping', M, ...
                'allowImproper', -1, ...
                'verbose', 0);
            decProper = validateDec(decProper, 'verbose', 0);
            
            % test for proper extension
            assertEqual(decProper.isProper, 1, ['Proper embedding is not ' ...
                ' proper']);
            assertTrue(isfield(decProper, 'improperData'), ['Improper data ' ...
                'is missing for proper embedding data']);
            assertEqual(decProper.nC, 3, 'Wrong dimension of proper embedding.');
            
            % project this case
            dec = projectDec(decProper, ...
                decProper.improperData.mappingImproperToProper);
            
                
        end
        
    end
end