Commit ec930f3b authored by Colin Eles's avatar Colin Eles
Browse files

fixed validation report so that it will properly interpret counter examples...

fixed validation report so that it will properly interpret counter examples for enumerated pvs types, previously it would give error, now properly displays in window and highlights cells in main table

git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/trunk/TableTool@6311 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent bd33e051
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ set(object.edit_tcc,'string',char(object.PVS_results(object.page).TCC));
set(object.edit_seq,'string',char(object.PVS_results(object.page).seq));
set(object.label_page,'string',[num2str(object.page) '  of  ' num2str(size(object.PVS_results,2))]);
counter = [];
counter_display = [];
enum_array = [];
if size(object.PVS_results(object.page).ce,2) == 0
    counter = ['no counter example generated'];
    
@@ -24,13 +26,35 @@ else
        % need to do some translation back to matlab syntax
        new_value = regexprep(char(object.PVS_results(object.page).ce(i+1)),'FALSE',' 0 ');
        new_value = regexprep(new_value,'TRUE',' 1 ');
        % try to evaluate what gets returned might be a fraction, if it is
        % an enumerated type need to do some more work.
            
        % check if new_value contains any characters [a-zA-z]
        isstring = regexp(char(new_value),'\w','match');
        if ~isempty(isstring)
            % value is an alpha string
            
            % search in list if alpha already assigned
            [found, index] = ismember(char(new_value),enum_array);
            if found
                 value = index;
            else
                enum_array = [enum_array {char(new_value)}];
                value = size(enum_array,2);
            end
        else
            % value is numeric
            eval(['value = ' char(new_value) ';']);
            new_value = value;
        end
        
        % need different string for output vs evaulation
        counter_display = [counter_display char(object.PVS_results(object.page).ce(i)) ' = ' char(new_value) ';' sprintf('\n')];
        counter = [counter char(object.PVS_results(object.page).ce(i)) ' = ' num2str(value) ';' sprintf('\n')];
    end
    
    
    object.gui.evaluate_counter(counter);
end
set(object.edit_ce,'string',counter);
set(object.edit_ce,'string',counter_display);
end
 No newline at end of file