diff --git a/project_task_sheets/phase_02/project_phase02_tasks/.gitignore b/project_task_sheets/phase_02/project_phase02_tasks/.gitignore index 44482bd..afdad5a 100644 --- a/project_task_sheets/phase_02/project_phase02_tasks/.gitignore +++ b/project_task_sheets/phase_02/project_phase02_tasks/.gitignore @@ -1,5 +1,7 @@ Solution_Phase*_*.pdf Solution_Phase*_*.zip +*.result.txt +output.txt ## Core latex/pdflatex auxiliary files: *.aux diff --git a/project_task_sheets/phase_02/project_phase02_tasks/Makefile b/project_task_sheets/phase_02/project_phase02_tasks/Makefile index 1020180..dedf8dc 100644 --- a/project_task_sheets/phase_02/project_phase02_tasks/Makefile +++ b/project_task_sheets/phase_02/project_phase02_tasks/Makefile @@ -4,8 +4,9 @@ name = MichaelChen solutionname = Solution_Phase$(phase)_$(name) target = $(solutionname)_V$(version).zip -package = $(solutionname).pdf +package = $(solutionname).pdf Phase02_Task2_ACTS_System.txt Phase02_Task2_ACTS_System.result.txt latexmkflags = +actspath = "C:\\Program Files (x86)\\ACTS\\acts_3.2.jar" .PHONY : all dev @@ -19,3 +20,6 @@ $(target) : $(package) %.pdf : %.tex latexmk -jobname="$*" $(latexmkflags) -pdf $< + +%_System.result.txt : %_System.txt + java -Xmx8192M -jar $(actspath) $< $@ diff --git a/project_task_sheets/phase_02/project_phase02_tasks/Phase02_Task2_ACTS_System.txt b/project_task_sheets/phase_02/project_phase02_tasks/Phase02_Task2_ACTS_System.txt new file mode 100644 index 0000000..1aa2f3f --- /dev/null +++ b/project_task_sheets/phase_02/project_phase02_tasks/Phase02_Task2_ACTS_System.txt @@ -0,0 +1,27 @@ +[System] +Name: IsDivisible + +[Parameter] +A_VAL (enum) : [NORMAL], MINIMUM, MAXIMUM +B_VAL (enum) : [NORMAL], MINIMUM, MAXIMUM +A_SIGNED (enum) : POSITIVE, NEGATIVE, ZERO +B_SIGNED (enum) : POSITIVE, NEGATIVE, ZERO +DIVISABLE (bool) : TRUE, FALSE +a (int) : 0, 1, -1, 4, 5, 20, 21, 21474836, -21474836 +b (int) : 1, -1, 4, 5, 20, 21, 21474836, -21474836 ; 0 + +[Constraint] +A_VAL = "MINIMUM" => a = -21474836 +A_VAL = "MAXIMUM" => a = 21474836 +B_VAL = "MINIMUM" => b = -21474836 +B_VAL = "MAXIMUM" => b = 21474836 + +A_SIGNED = "POSITIVE" => a > 0 +A_SIGNED = "NEGATIVE" => a < 0 +A_SIGNED = "ZERO" => a = 0 +B_SIGNED = "POSITIVE" => b > 0 +B_SIGNED = "NEGATIVE" => b < 0 +B_SIGNED = "ZERO" => b = 0 + +(DIVISABLE = true) => a % b = 0 +(DIVISABLE = false) => a % b != 0 diff --git a/project_task_sheets/phase_02/project_phase02_tasks/Solution_Phase02_MichaelChen.tex b/project_task_sheets/phase_02/project_phase02_tasks/Solution_Phase02_MichaelChen.tex index 83a9fc0..41bb71e 100644 --- a/project_task_sheets/phase_02/project_phase02_tasks/Solution_Phase02_MichaelChen.tex +++ b/project_task_sheets/phase_02/project_phase02_tasks/Solution_Phase02_MichaelChen.tex @@ -5,6 +5,9 @@ \usepackage{listings} \usepackage{enumitem} \usepackage{subcaption} +\usepackage{amsmath} +\usepackage{float} +\usepackage{hyperref} \usepackage{pgf} \usepackage{tikz} @@ -135,32 +138,62 @@ \item The distinction between valid and invalid divisions / modulo operations is a possible functionality-based partition for the input parameters \textit{a} and \textit{b}. Come up with another functionality-based characteristic and the corresponding partition. \end{enumerate} \begin{answer} - [TODO: Add answer here] + See table~\ref{tab:characteristics}. + \begin{table} + \centering + \begin{tabular}{llll} + \hline + Characteristic & Eq-Class 1 & Eq-Class 2 & Eq-Class 3 \\ + \hline + $q_1 = \text{"\texttt{int} values"}$ & $\{a,b=\texttt{int.Max}\}$ & $\{a,b=\texttt{int.Min}\}$ & remaining \\ + $q_2 = \text{"signedness"}$ & $\{a,b>0\}$ & $\{a,b<0\}$ & $\{a,b=0\}$ \\ + $q_3 = \text{"valid \texttt{mod}"}$ & $\{b\neq{}0\}$ & $\{b=0\}$ \\ + $q_4 = \text{"divisor"}$ & $\{(a \mod b) = 0\}$ & $\{(a \mod b) \neq 0\}$ \\ + \hline + \end{tabular} + \caption{Equivalence classes for different characteristics} + \label{tab:characteristics} + \end{table} \end{answer} \item Can you identify any non-valid combinations of blocks from your characteristics? Develop the required constraints that prevent these combinations. \begin{answer} - [TODO: Add answer here] + A simple invalid block combination is the valid modulo operation in combination with the signedness of $b$. We can mitigate that by disallowing $b$ to be zero. Also, when $a$ or $b$ is fixed at the maximum or minimum integer value we cannot combine this with all $q_4$ blocks. \end{answer} \item Derive one representative value for each of the blocks of the exemplary and your own characteristics. Which approach did you choose to select the values? \begin{answer} - [TODO: Add answer here] + See table~\ref{tab:testvalues}. + \begin{table} + \centering + \begin{tabular}{llll} + \hline + Characteristic & Val-Class 1 & Val-Class 2 & Val-Class 3 \\ + \hline + $q_1 = \text{"\texttt{int} values"}$ & $(\texttt{int.Max},b)$ & $(\texttt{int.Min},b)$ & $(1,b)$ \\ + $q_2 = \text{"signedness"}$ & $(1,b)$ & $(-1,b)$ & $(0,b)$ \\ + $q_3 = \text{"valid \texttt{mod}"}$ & $(5,1)$ & $(5,0)$ \\ + $q_4 = \text{"divisor"}$ & $(20,5)$ & $(21,5)$ \\ + \hline + \end{tabular} + \caption{Examplary test values for different characteristics} + \label{tab:testvalues} + \end{table} \end{answer} \item Read the \texttt{acts\_user\_guide} to get a basic understanding of how to create a system for ACTS and how to generate test vector sets of this system. \begin{answer} - [TODO: Add answer here] + See \texttt{Phase02\_Task2\_ACTS\_System.txt} file. \end{answer} \item Create a system named \textit{Phase02\_Task2\_ACTS\_System.txt} based on your characteristics and their representative block values. You can use the \texttt{Enum} type with meaningful names for any characteristics not representable as \texttt{Boolean}, \texttt{Number} or \texttt{Range}. Use ACTS in command line mode to generate the set of test vectors without constraints. \begin{answer} - [TODO: Add answer here] + ACTS generated $81$ tests covering $411$ tuples in $0.6$ seconds. \end{answer} \item In the \texttt{Constraint} section of your system file, add the constraints you identified for valid combinations of blocks, and generate a new set of test vectors. Compare the number of test vectors of the unconstrained and constrained system. Check if the new set of test vectors still contains non-valid combinations, and adapt your constraints if necessary. \begin{answer} - [TODO: Add answer here] + Now ACTS generated $83$ tests covering $312$ tuples in $12.9$ seconds and due to the constraints more than $50$ tuples were forbidden. \end{answer} \end{enumerate}