%!TEX options = --shell-escape
% This is a magic comment that tells LatexTools to enable shell-escape
% If you're not using LatexTools to compile, you will need to enable shell escape on your editor

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% <Name of your project here>
% 	by Charles Baynham
% 	30 May, 2018
%
% Based on template by Charles Baynham,
% modified from template by Ajeet Sandu
% https://www.overleaf.com/latex/templates/requirements-specification-layout/vbrqbjpzcmfy
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{article}

\usepackage{softwareRequirements}
\usepackage{standalone}
\usepackage{sphinx}
\usepackage{pgffor}
\usepackage{verbdef}

\newcounter{pdfpages}
\newcommand*{\getpdfpages}[1]{%
  \begingroup
    \sbox0{% 
      \includegraphics{#1}%
      \setcounter{pdfpages}{\pdflastximagepages}%
    }%
  \endgroup
}

\input{base/CookiecutterMacros}
\begin{document}

\pagenumbering{roman}
\DeclareGraphicsExtensions{.pdf,.jpg,.png}

%% Table of contents
\tableofcontents

%% Version table insertion
\input{base/history}

\clearpage
\pagestyle{long}

\pagenumbering{arabic}

% The content:
\graphicspath{{uml/}{latex/}}

\section{Introduction}\label{introduction}

This the quality documentation for the \packagename\ software package.
\packagedescription\ The \packagename\ package is hosted on \packageurl.

The Quality documentation consists of the following elements:
\begin{itemize}
\item Software quality plan: Included as `\packagename\_QF-59.docx' (a separate document in this folder).

\item User requirements: Included as Section 2 in `\packagename\_requirements.docx' (a separate document in this folder).

\item Functional requirements: Included as Section 3 in `\packagename\_requirements.docx' (a separate document in this folder).

\item SIL assesment: The Software Integrity Level (SIL) is determined from assessments of the criticality of usage and the complexity of the software in Section \ref{SIL-assessment} of this document.

\item Software design: Described using UML diagrams in Section \ref{design}.

\item Test report: An automated test report is given in Section \ref{testreport}. This includes:
\begin{itemize}
\item A table detailing the environment that was used during testing.
\item A summary of the results, indicating how many tests passed and how long it took.
\item A table showing each of the tests that was run, how long they took, and what output was captured during testing.
\item A test coverage report, showing how many lines of the software were covered by the combined tests.
\end{itemize}
\item User Manual: The \packagename documentation is included as Appendix \ref{UserManual}. This includes:
\begin{itemize}
\item Installation guidelines.
\item Overview of methods.
\item Examples of use.
\item Algorithm theoretical Basis.
\item Sphinx automated API documentation from docstrings in python code.
\end{itemize}
\end{itemize}

\clearpage
\input{base/\sil}

\clearpage
\section{Software design}\label{design}
The software design is specified using the following UML diagrams\footnote{These UML diagrams were made using http://www.umlet.com/umletino/umletino.html}.

\vspace*{1cm}
\input{uml/uml}

\clearpage
\section{Test report}\label{testreport}
\getpdfpages{test_report.pdf}
\foreach \x in {1,...,\value{pdfpages}} {
    \includegraphics[page=\x,trim= 10mm 10mm  10mm 10mm,width=\textwidth]{test_report.pdf}%
    \clearpage

}
\getpdfpages{cov_report.pdf}
\foreach \x in {1,...,\value{pdfpages}} {
    \includegraphics[page=\x,trim= 10mm 10mm  10mm 10mm,width=\textwidth]{cov_report.pdf}%
    \clearpage
}

\part*{User Manual}
\phantomsection
\addcontentsline{toc}{part}{User Manual}
\appendix
\label{UserManual}
\def\maketitle{}
\def\tableofcontents{}
\input{./latex/user_manual.tex}

\end{document}
