File status written with counts of areas: unvisited, bad, visited.
[tclrobot.git] / tests.tcl
1 # $Id: tests.tcl,v 1.1 2001/11/08 14:22:21 adam Exp $
2 proc testhref {} {
3     global URL
4
5     foreach testref {
6         {../../k.htm /k.htm}
7         {../k.htm /k.htm}
8         {.././k.htm /k.htm}
9         {./../k.htm /k.htm}
10         {k.htm /k.htm} 
11         {./k.htm /k.htm} 
12         {/../k.htm /k.htm}
13         {/./../.././k.htm /k.htm}
14         {../../peter/k.htm /peter/k.htm}
15         {../../ /}
16         {/// /}
17         {../.. /}} {
18         set URL(t,hostport) http://bilbasen.tv2.dk
19         set URL(t,path) /
20         set href [lindex $testref 0]
21         puts -nonewline "testing href=$href "
22         RobotHref t href host path
23         if {[string compare $path [lindex $testref 1]]} {
24             puts "failed"
25             puts "  href=$href"
26             puts "  host=$host"
27             puts "  path=$path"
28         } else {
29             puts "OK"
30         }
31     }
32     foreach testref {
33         {../../k.htm /k.htm}
34         {../k.htm /k.htm}
35         {.././k.htm /k.htm}
36         {./../k.htm /k.htm}
37         {k.htm /k.htm} 
38         {./k.htm /k.htm} 
39         {/../k.htm /k.htm}
40         {/./../.././k.htm /k.htm}
41         {../../peter/k.htm /peter/k.htm}
42         {../../ /}
43         {../.. /}} {
44         set URL(t,hostport) http://bilbasen.tv2.dk
45         set URL(t,path) /not_good.asp
46         set href [lindex $testref 0]
47         puts -nonewline "testing href=$href "
48         RobotHref t href host path
49         if {[string compare $path [lindex $testref 1]]} {
50             puts "failed"
51             puts "  href=$href"
52             puts "  host=$host"
53             puts "  path=$path"
54         } else {
55             puts "OK"
56         }
57     }
58     foreach testref {
59         {../../k.htm /k.htm}
60         {../k.htm /k.htm}
61         {k.htm /pages/k.htm} 
62         {../../peter/k.htm /peter/k.htm}
63         {../../ /}
64         {/../k.htm /k.htm}
65         {/./../.././k.htm /k.htm}
66         {../.. /}} {
67         set URL(t,hostport) http://bilbasen.tv2.dk
68         set URL(t,path) /pages/not_good.asp
69         set href [lindex $testref 0]
70         puts -nonewline "testing href=$href "
71         RobotHref t href host path
72         if {[string compare $path [lindex $testref 1]]} {
73             puts "failed"
74             puts "  href=$href"
75             puts "  host=$host"
76             puts "  path=$path"
77         } else {
78             puts "OK"
79         }
80     }
81     foreach testref {
82         {../../k.htm /k.htm}
83         {../k.htm /k.htm}
84         {k.htm /pages/k.htm} 
85         {../../peter/k.htm /peter/k.htm}
86         {../../ /}
87         {../.. /}} {
88         set URL(t,hostport) http://bilbasen.tv2.dk
89         set URL(t,path) /pages/
90         set href [lindex $testref 0]
91         puts -nonewline "testing href=$href "
92         RobotHref t href host path
93         if {[string compare $path [lindex $testref 1]]} {
94             puts "failed"
95             puts "  href=$href"
96             puts "  host=$host"
97             puts "  path=$path"
98         } else {
99             puts "OK"
100         }
101     }
102 }
103  
104 testhref
105    
106 exit 0
107
108