Function(s) to test:
    - bestroute()

Input function type and test scope:
    A - valid data with known output (check correctness)
    B - structured, but not valid data (check strength)
    C - structured, with random data (check strength)

Scope: Increase the detection of errors that could
       determine conditions of software vulnerabilities.
       
Output: input and (possible) comments,
        (possible) function errors/success,
        (possible) explanations and/or solutions.
        
        
        
----------------------------------------------------------------------------------------------------------
TEST n°1:


Data input (A):
       /*
            Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            S....
            .....
            .....
            .....
            ....D
            
            Best route length = 9
        */
        
No errors.

----------------------------------------------------------------------------------------------------------
TEST n°2:

Data input (A):
       /*
            Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            SXXXXX
            XXXXXX
            XXXXXX
            XXXXXX
            XXXXXD
            
            NO routes!
            Will returns (row * column + 1) = 31
        */

Return of (row * column + 1) means "more then maximum route length".
        
No errors.

----------------------------------------------------------------------------------------------------------
TEST n°3:

Data input (A):
        /*
            Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            S....D
            ......
            ......
            ......
            D....D
            
            Best route length = 5
        */
        
No errors.

----------------------------------------------------------------------------------------------------------
TEST n°4:

Data input (A):
       /*
            Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            S..X.D
            ...XXX
            ......
            ......
            .....D
            
            Best route length = 10 
        */
        
No errors.

----------------------------------------------------------------------------------------------------------
TEST n°5:

Data input (A):
       /*
            Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            S.X..D
            ..X...
            ..X...
            ......
            .....D
            
            Best route length = 10
        */
        
No errors.

----------------------------------------------------------------------------------------------------------
TEST n°6:

Data input (B):
        /*
            <Wrong> Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            S.....
            ......
            ......
            ......
            ......
            
            DOOR in 5,5 (row out of range)!
            
            Best route length = 31 (Not possible)
        */

Return of (row * column + 1) means "more then maximum route length".

No errors.
        
----------------------------------------------------------------------------------------------------------
TEST n°7:

Data input (B):
        /*
            <Wrong> Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            D....
            .....
            .....
            .....
            
            START in 4,4 (row out of range)!
            
            Best route length = 21 (Not possible)
        */

OLD ERRORS:
	    Error: segmentation fault

	    Explanation: THE FUNCTION DOESN'T CONTROL IF THE START POINT IS INTO THE SCHEMA.

	    Solutions: 
		- check value before passing
		- check value into the function

FROM VERSION 9.9.1:
	    No errors.

----------------------------------------------------------------------------------------------------------
TEST n°8:

Data input (C):
        /*
            Schema with:
                Row and Column numbers from 2 to 100
                
                N.          Type   Location  Status
                1 or more   START     ?        ok
                ?           DOOR      ?        ?
                ?             ?       ?        ?                    
        */
        
*** Example (where ? is an ASCII character different from default OBJECTs):

?D??D??D?D???????DD??D????DD?DD??D????D???D
??D??D?DD???DDD??????DD?DD?DDDDD??D????D??D
?S??D?D?D????????DD??DD???D???D???D????D???
?D?D?????DD????DD??DDD???D?DD??D??DD??DD?D?
??D?DDDD??DD?DD.D??DD???D?D??D????D??D?????
D??D?D??D?D?D???????DD????D?D?????DD?D?????
DD?DDD?D?D???????D?D?D?D???DD??????????D???
D?D????????D?DD?DD???D??D?DD????DD?D???????

Bestroute: 1 , doorId: 35 (3,1)

Test n.8 done without errors :)

***    

No errors.

----------------------------------------------------------------------------------------------------------
TEST n°9:

Data input (B):
        /*
            <Wrong> Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            S.... 	    D....
            .....  and	..... 
            ..... 	    .....
            ..... 	    .....
	        .....	    .....
            
            START in (0,0) and DOOR in (0,0)
            
	        NO routes!
            Will returns (row * column + 1)= 26
        */

OLD ERRORS:
	    Error: Best route length = 0 (Not possible)

	    Explanation: THE FUNCTION DOESN'T CONTROL IF THE START POINT HAS THE
			         SAME COORDINATES OF THE DOORS INTO THE SCHEMA.

	    Solutions: 
		- check value before passing
		- check value into the function

FROM VERSION 9.9.2:
	    No errors.


----------------------------------------------------------------------------------------------------------
TEST n°10:

Data input (B):
	/*
	    <Wrong> Map where 
            START = S, DOOR = D,
            FREE = . , CLOSE = X
            
            S....
	        .....
	        .....
	        .....
	        .....

            NO DOORS in SCHEMA
            
	        NO routes!
            Will returns (row * column + 1)= 26
	*/

Return of (row * column + 1) means "more then maximum route length".

No errors.

----------------------------------------------------------------------------------------------------------
TEST n°11:

Data input (C):

	/*
        Schema with:
                Row and Column numbers from 2 to 100
                
                N.          Type       Location	    Status
                1	        START       (0,0)         ok
                1           DOOR     (0,(numCol-1))   ok
                ?             ?         ?              ?   

		START POINT fixed in (0,0)
		DOOR fixed in (0,(numCol-1))
	    
	    Will returns (row * column + 1) if occours an error
	    Will returns (numCol) if all the checks are ok
   */

*** Example (where ? is an ASCII character different from default OBJECTs):

S............D
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????
??????????????

Bestroute: 14 , doorId: 0 (0,13)

Test n.11 done without errors :)

***   

Will returns (numCol) if all the checks are ok, else (row * column + 1)
No errors.
----------------------------------------------------------------------------------------------------------
TEST n°12:

Data input (C):

        /*
            Schema with:
                Row and Column numbers from 2 to 100
                
                N.          Type       Location	    Status
                1	        START       (0,0)         ok
                1           DOOR     (0,(numCol-1))   ok
                ?           FREE         ?            ?        
		        ?	        CLOSE	     ?  	      ?

    		START POINT fixed in (0,0)
    		DOOR fixed in (0,(numCol-1))
    	    
    	    Will returns (row * column + 1) if occours an error
    	    Will returns (numCol) if all the checks are ok
        */

*** Example
S...........D
X...XXXXXX...
XXXX....XXXXX
.X...X..X..XX
X...XXX..X.XX
X.X.XXXXXXX..

Bestroute: 13 , doorId: 0 (0,12)

Test n.12 done without errors :)

***

Will returns (numCol) if all the checks are ok, else (row * column + 1)
No errors.
----------------------------------------------------------------------------------------------------------
