#!/bin/sh
#
# Copyright (C) 1997 - 2001 Loic Dachary
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

. test_functions

samples=$srcdir/htdocs/htmlhref

#
# Basic tests on all tags recognized by the parser
#
Hframe() {
./t_htmlhref -h -f $samples/frame.html
}

Harea() {
./t_htmlhref -h -f $samples/area.html
}

Hmeta() {
./t_htmlhref -h -f $samples/meta.html
}

Hbase() {
./t_htmlhref -h -f $samples/base.html
}

Ha() {
./t_htmlhref -h -f $samples/a.html
}

Himg() {
./t_htmlhref -h -f $samples/img.html
}

Hscript() {
./t_htmlhref -h -f $samples/script.html
}

Hescape() {
#
# Url contains &#...; sequences that must be normalized
#
./t_htmlhref -h -f $samples/escape.html
}

#
# Test options
#
Hstrip_relative() {
./t_htmlhref -h -a -f $samples/strip_relative.html
}

Hignore() {
./t_htmlhref -i HTML_URI_BASE,HTML_URI_IMG -h -f $samples/ignore.html
}

#
# Test badly formated files
#
Hcomment() {
#
# Catch up on unfinished comment
#
./t_htmlhref -h -f $samples/comment.html

#
# Comments strangely formated. <base ...> within
# comment.
#
./t_htmlhref -h -f $samples/comment1.html
}

Hmany() {
#
# A lot of href, to make sure there is no 
# obvious memory leak problem.
#
./t_htmlhref -h -f $samples/many.html
}

Hnewline() {
#
# Newline within URL, must be ignored
#
./t_htmlhref -h -f $samples/newline.html
}

Hhairy() {
#
# The href has a lot of atributes, quite long.
#
./t_htmlhref -h -f $samples/hairy.html
}

Hbench() {
./t_htmlhref -Q -B 10000 -h -f $samples/many.html
}

testing ${*:-"Hframe Harea Hmeta Hbase Ha Himg Hscript Hescape Hstrip_relative Hignore Hcomment Hmany Hnewline Hhairy"}
