header

Program Information

Name: Sum of an array
Domain: Numerical program
Functionality: Calculates the sum of integers in an array $a$.             
Input: An array $a=[x_1,x_2,\ldots ,x_k,\ldots ,x_n]$ where $k=1,2,\ldots ,n$. $m$ is a constant. 
Output: The sum of integers in array $a$, $Sum(a)$

Reference

 Using Machine Learning Techniques to Detect Metamorphic Relations for Programs without Test Oracles
https://doi.org/10.1109/ISSRE.2013.6698899 

MR Information

MR1------Additive:Add or subtract a constant

Description:
Property: $m\times length(a)+Sum(a)=Sum(a')$
Source input: $a=[x_1,x_2,\ldots ,x_k,\ldots ,x_n]$
Source output: $Sum(a)$
Follow-up input: $a'=[x_1+m,x_2+m,\ldots ,x_k+m,\ldots ,x_n+m]$
Follow-up output: $Sum(a')$
Input relation:
Output relation: $m\times length(a)+Sum(a)=Sum(a')$
Pattern:

MR2------Multiplicative:Multiply by a constant

Description:
Property: $m\times Sum(a)=Sum(a')$
Source input: $a=[x_1,x_2,\ldots ,x_k,\ldots ,x_n]$
Source output: $Sum(a)$
Follow-up input: $a'=[x_1\times m,x_2\times m,\ldots ,x_k\times m,\ldots ,x_n\times m]$
Follow-up output: $Sum(a')$
Input relation:
Output relation: $m\times Sum(a)=Sum(a')$
Pattern:

MR3------Permutative:Randomly permute the elements 

Description:
Property: $Sum(a)=Sum(a')$ 
Source input:  $a=[x_1,x_2,\ldots ,x_{k_1},\ldots ,x_{k_2},\ldots ,x_n]$
Source output:  $Sum(a)$
Follow-up input: $a'=[x_1,x_2,\ldots ,x_{k_2},\ldots ,x_{k_1},\ldots ,x_n]$ 
Follow-up output:  $Sum(a')$
Input relation:
Output relation: $Sum(a)=Sum(a')$ 
Pattern:

MR4------Invertive:Take the inverse of each element 

Description:
Property: $-Sum(a)=Sum(a')$ 
Source input: $a=[x_1,x_2,\ldots ,x_k,\ldots ,x_n]$ 
Source output: $Sum(a)$ 
Follow-up input: $a'=[-x_1,-x_2,\ldots ,-x_k,\ldots ,-x_n]$ 
Follow-up output: $Sum(a')$ 
Input relation:
Output relation: $-Sum(a)=Sum(a')$ 
Pattern:

MR5------Inclusive:Add a new element

Description:
Property: $x_{new}+Sum(a)=Sum(a')$ 
Source input:  $a=[x_1,x_2,\ldots ,x_k,\ldots ,x_n]$
Source output:  $Sum(a)$
Follow-up input: $a'=[x_1,x_2,\ldots ,x_k,\ldots ,x_n,x_{new}]$ 
Follow-up output: $Sum(a')$ 
Input relation:
Output relation: $x_{new}+Sum(a)=Sum(a')$ 
Pattern:

MR6------Exclusive:Remove an element 

Description:
Property: $Sum(a)-x_k=Sum(a')$ 
Source input: $a=[x_1,x_2,\ldots ,x_k,\ldots ,x_n]$ 
Source output: $Sum(a)$ 
Follow-up input: $a'=[x_1,x_2,\ldots,\ldots ,x_n]$ 
Follow-up output: $Sum(a')$ 
Input relation:
Output relation: $Sum(a)-x_k=Sum(a')$ 
Pattern:

MR7------Compositional:Combining two or more inputs 

Description:
Property: $Sum(a_1)+Sum(a_2)=Sum(a')$ 
Source input:  $a_1=[x_1,x_2,\ldots ,x_k,\ldots ,x_n]$ $a_2=[x_{n+1},x_{n+2},\ldots ,x_{n+k},\ldots ,x_{2n}]$
Source output: $Sum(a_1),Sum(a_2)$ 
Follow-up input:  $a'=a_1+a_2$
Follow-up output: $Sum(a')$ 
Input relation:
Output relation: $Sum(a_1)+Sum(a_2)=Sum(a')$ 
Pattern:
Insert title here