function Objectives = updateNoTestCaseStatus(Objectives, analysisStatus)
% When sldv analysis (e.g. test generation) concludes, the 'satisfied'
% status of an objective gets changed to 'Satisfied - No Test Case'
% provided the test case covering that objective is not available.
% The case where this happens are:
% a. closed models
% b. objective covered due to pre-existing test case
% c. model is 'partially closed, i.e. some objectives get cover from
% non-inputs e.g. constant blocks.

%   Copyright 2023 The MathWorks, Inc.

if strcmpi(analysisStatus, 'In progress')
    % no changes in objective status as no test case are available when
    % analysis status is 'in progress'.
    return;
end
% analysis has concluded.
for i = 1: length(Objectives)
    if strcmpi(Objectives(i).status, 'satisfied') ||...
            strcmpi(Objectives(i).status, 'satisfied - needs simulation')
        if isfield(Objectives(i), 'testCaseIdx')
            if isempty(Objectives(i).testCaseIdx)
                Objectives(i).status =  'Satisfied - No Test Case';
            end
        else
            Objectives(i).status = 'Satisfied - No Test Case';
        end
    end
    if strcmpi(Objectives(i).status, 'falsified') ||...
            strcmpi(Objectives(i).status, 'falsified - needs simulation')
        if isfield(Objectives(i), 'testCaseIdx')
            if isempty(Objectives(i).testCaseIdx)
                Objectives(i).status =  'Falsified - No Counterexample';
            end
        else
            Objectives(i).status = 'Falsified - No Counterexample';
        end
    end
end

end
