Skip to content
Stefano Zaghi edited this page Nov 6, 2015 · 1 revision

For the purposes of regression test and code coverage analysis the following testing programs are shipped within VecFor.

kinds program

This program is located into src/tests/kinds.f90. Its main aim is to stress all VecFor procedures for the coverage analysis. In particular, it tests all the operators with all supported number formats for testing the correctness of them.

simple program

This program is located into src/tests/simple.f90. Its main aim is to show a simple usage of VecFor objects.

building testing programs

All the programs depend on only the VecFor main module that is located into src/lib/vecfor.f90. As a consequence, the testing programs can be easily built once the VecFor library is built itself. Anyhow, they can also build by means of FoBiS.py and the provided fobos file. From the root of the project type:

FoBiS.py build -f src/tests/fobos -mode gnu

This command will build both kinds and simple programs that are placed into build/tests/ sub-directory of the root of the VecFor project.

run kinds program

Running kinds program you should obtain:

→ ./build/tests/kinds
 Assign vector1 = [1, 2, 3]
 Assign vector2 = [1, 1, 1] testing assignments by scalar
 Verify * operator, multiply by 1 defined in any supported number formats
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify * operator between vectors, vector1 * vector2
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify / operator, diveded by 1 defined in any supported number formats
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify / operator between vectors, vector1 / vector2
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify + operator, add 1 (14 times) defined in any supported number formats
 Component x +0.150000000000000E+002
 Component y +0.160000000000000E+002
 Component z +0.170000000000000E+002
 Verify + operator between vectors, vector1 + vector2
 Component x +0.160000000000000E+002
 Component y +0.170000000000000E+002
 Component z +0.180000000000000E+002
 Verify - operator, subtract 1 (14 times) defined in any supported number formats
 Component x +0.200000000000000E+001
 Component y +0.300000000000000E+001
 Component z +0.400000000000000E+001
 Verify - operator between vectors, vector1 - vector2
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify save/load methods
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify save/load methods with stream-accessed file
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify < operator, compare with 1 (and vector2) defined in any supported number formats
vector1<1._R16P => F
vector1<1._R8P  => F
vector1<1._R4P  => F
vector1<1_I8P   => F
vector1<1_I4P   => F
vector1<1_I2P   => F
vector1<1_I1P   => F
1._R16P<vector1 => T
1._R8P <vector1 => T
1._R4P <vector1 => T
1_I8P  <vector1 => T
1_I4P  <vector1 => T
1_I2P  <vector1 => T
1_I1P  <vector1 => T
vector1<vector2 => F
 Verify <= operator, compare with 1 (and vector2) defined in any supported number formats
vector1<=1._R16P => F
vector1<=1._R8P  => F
vector1<=1._R4P  => F
vector1<=1_I8P   => F
vector1<=1_I4P   => F
vector1<=1_I2P   => F
vector1<=1_I1P   => F
1._R16P<=vector1 => T
1._R8P <=vector1 => T
1._R4P <=vector1 => T
1_I8P  <=vector1 => T
1_I4P  <=vector1 => T
1_I2P  <=vector1 => T
1_I1P  <=vector1 => T
vector1<=vector2 => F
 Verify == operator, compare with 1 (and vector2) defined in any supported number formats
vector1==1._R16P => F
vector1==1._R8P  => F
vector1==1._R4P  => F
vector1==1_I8P   => F
vector1==1_I4P   => F
vector1==1_I2P   => F
vector1==1_I1P   => F
1._R16P==vector1 => F
1._R8P ==vector1 => F
1._R4P ==vector1 => F
1_I8P  ==vector1 => F
1_I4P  ==vector1 => F
1_I2P  ==vector1 => F
1_I1P  ==vector1 => F
vector1==vector2 => F
vector1==-vector1 => F
 Verify /= operator, compare with 1 (and vector2) defined in any supported number formats
vector1/=1._R16P => T
vector1/=1._R8P  => T
vector1/=1._R4P  => T
vector1/=1_I8P   => T
vector1/=1_I4P   => T
vector1/=1_I2P   => T
vector1/=1_I1P   => T
1._R16P/=vector1 => T
1._R8P /=vector1 => T
1._R4P /=vector1 => T
1_I8P  /=vector1 => T
1_I4P  /=vector1 => T
1_I2P  /=vector1 => T
1_I1P  /=vector1 => T
vector1/=vector2 => T
vector1/=-vector1 => T
 Verify >= operator, compare with 1 (and vector2) defined in any supported number formats
vector1>=1._R16P => T
vector1>=1._R8P  => T
vector1>=1._R4P  => T
vector1>=1_I8P   => T
vector1>=1_I4P   => T
vector1>=1_I2P   => T
vector1>=1_I1P   => T
1._R16P>=vector1 => F
1._R8P >=vector1 => F
1._R4P >=vector1 => F
1_I8P  >=vector1 => F
1_I4P  >=vector1 => F
1_I2P  >=vector1 => F
1_I1P  >=vector1 => F
vector1>=vector2 => T
 Verify > operator, compare with 1 (and vector2) defined in any supported number formats
vector1>1._R16P => T
vector1>1._R8P  => T
vector1>1._R4P  => T
vector1>1_I8P   => T
vector1>1_I4P   => T
vector1>1_I2P   => T
vector1>1_I1P   => T
1._R16P>vector1 => F
1._R8P >vector1 => F
1._R4P >vector1 => F
1_I8P  >vector1 => F
1_I4P  >vector1 => F
1_I2P  >vector1 => F
1_I1P  >vector1 => F
vector1>vector2 => T

run simple program

Running simple program you should obtain:

→ ./build/tests/simple
 Assign vector1 = [1, 2, 3]
 Assign vector2 = [-1, -2, -3]
 Verify auxiliary methods
 vector1%sq_norm() =  14.0
 sq_norm(vector1) =  14.0
 vector1%normL2() =   3.7
 normL2(vector1) =   3.7
 normalized(vector1):
 Component x +0.267261241912424E+000
 Component y +0.534522483824849E+000
 Component z +0.801783725737273E+000
call vector1%normalize():
 Component x +0.267261241912424E+000
 Component y +0.534522483824849E+000
 Component z +0.801783725737273E+000
 Verify normalization fall-back for null vector
call 0%normalize():
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z  0.000000000000000E+000
vector1 = 0%normalized():
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z  0.000000000000000E+000
 Verify dot product
 vector1.dot.ex =   1.0
 vector1.dot.ey =   2.0
 vector1.dot.ez =   3.0
 vector1.dot.vector2 = -14.0
 Verify cross product
 vector1.cross.vector2:
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z  0.000000000000000E+000
 Verify special operators
 vector1.ortho.vector2:
 Component x -0.222044604925031E-015
 Component y -0.444089209850063E-015
 Component z  0.000000000000000E+000
 vector1.paral.vector2:
 Component x +0.100000000000000E+001
 Component y +0.200000000000000E+001
 Component z +0.300000000000000E+001
 Verify * / + - operators
 vector1 * vector2:
 Component x -0.100000000000000E+001
 Component y -0.400000000000000E+001
 Component z -0.900000000000000E+001
 vector1 / vector2:
 Component x -0.100000000000000E+001
 Component y -0.100000000000000E+001
 Component z -0.100000000000000E+001
 vector1 + vector2:
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z  0.000000000000000E+000
 vector1 - vector2:
 Component x +0.200000000000000E+001
 Component y +0.400000000000000E+001
 Component z +0.600000000000000E+001
 Assign vector1 = [-1, 1, 0]
 Assign vector2 = [0, 1, 0]
 Assign vector3 = [0, -1, 0]
 Assign vector4 = [-1, -1, 0]
 Face 1-2-3 normal (stand alone procedure):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.100000000000000E+001
 Face 1-2-3 normal (stand alone procedure, normalized):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.100000000000000E+001
 Face 1-2-3 normal (type bound method):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.100000000000000E+001
 Face 1-2-3 normal (type bound method, normalized):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.100000000000000E+001
 Face 1-2-3-4 normal (stand alone procedure):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.200000000000000E+001
 Face 1-2-3-4 normal (stand alone procedure, normalized):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.100000000000000E+001
 Face 1-2-3-4 normal (type bound method):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.200000000000000E+001
 Face 1-2-3-4 normal (type bound method, normalized):
 Component x  0.000000000000000E+000
 Component y  0.000000000000000E+000
 Component z -0.100000000000000E+001
 IO length of vector1 =  24