Repository: metalink-dev/pymetalink (language: python)

Issue:
Pass verify argument to download request
`download.get` function has no `verify` argument. We would like to be able to set this to `False` to allow downloads from servers with self-signed certificates. 


Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..70b5f67
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.pytest_cache
+/dist
+__pycache__
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index dba3c94..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,4 +0,0 @@
-include *.txt
-include *.bat
-include *.in
-include *.sh
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..73dd91d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,200 @@
+Project: pyMetalink
+URL: https://github.com/metalink-dev/pymetalink
+E-mail: nabber00@gmail.com
+
+Copyright: (C) 2007-2016, Neil McNab, Hampus Wessman
+License: MIT
+
+Permission is hereby granted, free of charge, to any person obtaining a copy 
+of this software and associated documentation files (the "Software"), to deal 
+in the Software without restriction, including without limitation the rights 
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
+copies of the Software, and to permit persons to whom the Software is 
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in 
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
+THE SOFTWARE.
+
+Description:
+pyMetalink is a library for python to support advanced download features
+
+Example:
+
+import metalink.download
+
+files = metalink.download.get("file.metalink", os.getcwd())
+
+CHANGELOG:
+
+Version 6.2
+-----------
+- Tested
+- Initial Python 3.x support
+- License change to MIT approved by all authors, can still be combined with GPL software
+- Catches GPG NEWSIG response
+
+Version 6.1
+-----------
+- Packaged as pure Python package for easy_install and pip
+
+Version 6.0
+-----------
+- Support for RFC 3230 - Instance Digests in HTTP
+- Support for RFC 6249 - Metalink/HTTP: Mirrors and Hashes
+
+Version 5.1
+-----------
+- Bugfixes for segmented downloads
+- Native Jigdo download support
+- Added download time
+- Now requires Python 2.5 or newer because Metalink RFC requires SHA-256
+
+Version 5.0
+-----------
+- Added support for Metalink v4 (IETF RFC)
+
+Version 4.4
+-----------
+- Bugfix for when HTTP 302 redirect code is issued during download
+
+Version 4.3
+-----------
+- Added custom HTTP header support
+- Added option to parse an HTML file for .metalink files to check
+- Added a beta feature for media streaming
+- Various bugfixes
+
+Version 4.2
+-----------
+- PGP bugfix
+- Jigdo to Metalink convertor
+- Other bugfixes
+
+Version 4.1
+-----------
+- XML parsing speed and memory improvements
+- Checking function is now multithreaded for speed improvements
+- Displays download bitrates
+- Grabs proxy info from environment variables and Windows registry
+- Fix for faulty file locking, this causes corrupted downloads
+
+Version 4.0
+-----------
+- Uses gzip compression when available on server (non-segmented downloads only)
+- Fixed memory leak when computing a checksum
+- Bugfixes for download resuming
+
+Version 3.8
+-----------
+- Will now download any file type and auto-detect metalink files
+- Added support for metalink "Accept" HTTP header
+
+Version 3.7.4
+-------------
+- Fixed default key import directory
+
+Version 3.7.3
+-------------
+- Fixes for use with UNIX/Linux
+- bugfixes in checker code
+
+Version 3.7.2
+-------------
+- Modified to remove the pyme dependency
+
+Version 3.7.1
+-------------
+- Removed missing imports
+
+Version 3.7
+-----------
+- Added first attempt at PGP signature checking
+- Minor bugfixes
+
+Version 3.6
+-----------
+- Support for resuming segmented downloads
+- Modified for better Python 2.4 support
+
+Version 3.5
+-----------
+- Code cleanup
+- FTP close connection speed improvement
+- Added documentation for how to use as a library
+- Sort by country pref first (if set), then pref value in metalink
+
+Version 3.4
+-----------
+- segmented download FTP size support
+- support for user specified OS and language preferences
+- finished FTP proxy support
+
+Version 3.3
+-----------
+- Bugfix for when type attr not present
+- Support for FTP segmented downloads
+
+Version 3.2
+-----------
+- If type="dynamic", client checks origin location
+
+Version 3.1
+-----------
+- Now handles all SHA hash types and MD5
+- Minor bug fixes
+
+Version 3.0
+-----------
+- Speed and bandwidth improvements for checking mode
+- Added checking of chunk checksums
+- If chunk checksums are present, downloads are resumed
+- Proxy support (experimental, HTTP should work, FTP and HTTPS not likely)
+
+Version 2.0.1
+-------------
+- Bugfix when doing size check on HTTP servers, more reliable now
+
+Version 2.0
+-----------
+- Support for segmented downloads! (HTTP urls only, falls back to old method if only FTP urls)
+
+Version 1.4
+-----------
+- Added support for checking the file size on FTP servers
+
+Version 1.3.1
+-------------
+- Made error when XML parse fails a little clearer.
+
+Version 1.3
+-----------
+- Fixed bug when no "size" attribute is present
+
+Version 1.2
+-----------
+- Added totals output
+
+Version 1.1
+-----------
+- Bugfixes for FTP handling, bad URL handling
+- rsync doesn't list as a URL Error
+- reduced timeout value
+
+Version 1.0
+-----------
+This is the initial release.
+
+TODO
+- resume download support for non-segmented downloads
+- download priority based on speed
+- use maxconnections
+- dump FTP data chunks directly to file instead of holding in memory
+
diff --git a/README.txt b/README.txt
deleted file mode 100644
index e6717ec..0000000
--- a/README.txt
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/usr/bin/env python
-########################################################################
-#
-# Project: pyMetalink
-# URL: https://github.com/metalink-dev/pymetalink
-# E-mail: nabber00@gmail.com
-#
-# Copyright: (C) 2007-2016, Neil McNab, Hampus Wessman
-# License: MIT
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a copy 
-# of this software and associated documentation files (the "Software"), to deal 
-# in the Software without restriction, including without limitation the rights 
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
-# copies of the Software, and to permit persons to whom the Software is 
-# furnished to do so, subject to the following conditions:
-# 
-# The above copyright notice and this permission notice shall be included in 
-# all copies or substantial portions of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
-# THE SOFTWARE.
-#
-# Description:
-#   pyMetalink is a library for python to support advanced download features
-#
-# Example:
-#
-# import metalink.download
-#
-# files = metalink.download.get("file.metalink", os.getcwd())
-#
-# CHANGELOG:
-#
-# Version 6.2
-# -----------
-# - Tested
-# - Initial Python 3.x support
-# - License change to MIT approved by all authors, can still be combined with GPL software
-# - Catches GPG NEWSIG response
-#
-# Version 6.1
-# -----------
-# - Packaged as pure Python package for easy_install and pip
-# 
-# Version 6.0
-# -----------
-# - Support for RFC 3230 - Instance Digests in HTTP
-# - Support for RFC 6249 - Metalink/HTTP: Mirrors and Hashes
-#
-# Version 5.1
-# -----------
-# - Bugfixes for segmented downloads
-# - Native Jigdo download support
-# - Added download time
-# - Now requires Python 2.5 or newer because Metalink RFC requires SHA-256
-#
-# Version 5.0
-# -----------
-# - Added support for Metalink v4 (IETF RFC)
-#
-# Version 4.4
-# -----------
-# - Bugfix for when HTTP 302 redirect code is issued during download
-#
-# Version 4.3
-# -----------
-# - Added custom HTTP header support
-# - Added option to parse an HTML file for .metalink files to check
-# - Added a beta feature for media streaming
-# - Various bugfixes
-#
-# Version 4.2
-# -----------
-# - PGP bugfix
-# - Jigdo to Metalink convertor
-# - Other bugfixes
-#
-# Version 4.1
-# -----------
-# - XML parsing speed and memory improvements
-# - Checking function is now multithreaded for speed improvements
-# - Displays download bitrates
-# - Grabs proxy info from environment variables and Windows registry
-# - Fix for faulty file locking, this causes corrupted downloads
-#
-# Version 4.0
-# -----------
-# - Uses gzip compression when available on server (non-segmented downloads only)
-# - Fixed memory leak when computing a checksum
-# - Bugfixes for download resuming
-#
-# Version 3.8
-# -----------
-# - Will now download any file type and auto-detect metalink files
-# - Added support for metalink "Accept" HTTP header
-#
-# Version 3.7.4
-# -------------
-# - Fixed default key import directory
-#
-# Version 3.7.3
-# -------------
-# - Fixes for use with UNIX/Linux
-# - bugfixes in checker code
-#
-# Version 3.7.2
-# -------------
-# - Modified to remove the pyme dependency
-#
-# Version 3.7.1
-# -------------
-# - Removed missing imports
-#
-# Version 3.7
-# -----------
-# - Added first attempt at PGP signature checking
-# - Minor bugfixes
-#
-# Version 3.6
-# -----------
-# - Support for resuming segmented downloads
-# - Modified for better Python 2.4 support
-#
-# Version 3.5
-# -----------
-# - Code cleanup
-# - FTP close connection speed improvement
-# - Added documentation for how to use as a library
-# - Sort by country pref first (if set), then pref value in metalink
-# 
-# Version 3.4
-# -----------
-# - segmented download FTP size support
-# - support for user specified OS and language preferences
-# - finished FTP proxy support
-#
-# Version 3.3
-# -----------
-# - Bugfix for when type attr not present
-# - Support for FTP segmented downloads
-#
-# Version 3.2
-# -----------
-# - If type="dynamic", client checks origin location
-#
-# Version 3.1
-# -----------
-# - Now handles all SHA hash types and MD5
-# - Minor bug fixes
-#
-# Version 3.0
-# -----------
-# - Speed and bandwidth improvements for checking mode
-# - Added checking of chunk checksums
-# - If chunk checksums are present, downloads are resumed
-# - Proxy support (experimental, HTTP should work, FTP and HTTPS not likely)
-#
-# Version 2.0.1
-# -------------
-# - Bugfix when doing size check on HTTP servers, more reliable now
-#
-# Version 2.0
-# -----------
-# - Support for segmented downloads! (HTTP urls only, falls back to old method if only FTP urls)
-#
-# Version 1.4
-# -----------
-# - Added support for checking the file size on FTP servers
-#
-# Version 1.3.1
-# -------------
-# - Made error when XML parse fails a little clearer.
-#
-# Version 1.3
-# -----------
-# - Fixed bug when no "size" attribute is present
-#
-# Version 1.2
-# -----------
-# - Added totals output
-#
-# Version 1.1
-# -----------
-# - Bugfixes for FTP handling, bad URL handling
-# - rsync doesn't list as a URL Error
-# - reduced timeout value
-#
-# Version 1.0
-# -----------
-# This is the initial release.
-#
-# TODO
-# - resume download support for non-segmented downloads
-# - download priority based on speed
-# - use maxconnections
-# - dump FTP data chunks directly to file instead of holding in memory
-# 
-########################################################################
diff --git a/console.py b/metalink/console.py
similarity index 97%
rename from console.py
rename to metalink/console.py
index 80c7e5e..486d8a9 100644
--- a/console.py
+++ b/metalink/console.py
@@ -27,13 +27,14 @@
 import metalink.download as download
 
 
-def run():
-    for item in sys.argv[1:]:
+def run(args):
+    for item in args:
             progress = ProgressBar()
             result = download.get(item, os.getcwd(), handlers={"status": progress.download_update, "bitrate": progress.set_bitrate, "time": progress.set_time}, segmented = True)
             progress.download_end()
             if not result:
-                sys.exit(-1)
+                return -1
+    return 0
 
 class ProgressBar:
     def __init__(self, length = 79):
@@ -143,5 +144,5 @@ def download_end(self):
 
 
 if __name__ == "__main__":
-    run()
+    sys.exit(run(sys.argv[1:]))
 
diff --git a/nightly.bat b/nightly.bat
deleted file mode 100644
index 12a3312..0000000
--- a/nightly.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-call sample_setenv.bat
-call setenv.bat
-
-mkdir "%BUILDS%"
-
-call sdist.bat
-xcopy /Y "dist\metalink-checker-*.zip" "%BUILDS%\."
-move "%BUILDS%\metalink-checker-*.zip" "%BUILDS%\%DATE%_Metalink_Checker.zip"
\ No newline at end of file
diff --git a/poetry.lock b/poetry.lock
new file mode 100644
index 0000000..dc0eb71
--- /dev/null
+++ b/poetry.lock
@@ -0,0 +1,331 @@
+[[package]]
+name = "appdirs"
+version = "1.4.4"
+description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
+category = "dev"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "atomicwrites"
+version = "1.4.0"
+description = "Atomic file writes."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
+[[package]]
+name = "attrs"
+version = "20.2.0"
+description = "Classes Without Boilerplate"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
+[package.extras]
+dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "sphinx-rtd-theme", "pre-commit"]
+docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"]
+tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
+tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"]
+
+[[package]]
+name = "black"
+version = "20.8b1"
+description = "The uncompromising code formatter."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+appdirs = "*"
+click = ">=7.1.2"
+mypy-extensions = ">=0.4.3"
+pathspec = ">=0.6,<1"
+regex = ">=2020.1.8"
+toml = ">=0.10.1"
+typed-ast = ">=1.4.0"
+typing-extensions = ">=3.7.4"
+
+[package.extras]
+colorama = ["colorama (>=0.4.3)"]
+d = ["aiohttp (>=3.3.2)", "aiohttp-cors"]
+
+[[package]]
+name = "click"
+version = "7.1.2"
+description = "Composable command line interface toolkit"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
+[[package]]
+name = "colorama"
+version = "0.4.4"
+description = "Cross-platform colored terminal text."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
+[[package]]
+name = "more-itertools"
+version = "8.6.0"
+description = "More routines for operating on iterables, beyond itertools"
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[[package]]
+name = "mypy-extensions"
+version = "0.4.3"
+description = "Experimental type system extensions for programs checked with the mypy typechecker."
+category = "dev"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "packaging"
+version = "20.4"
+description = "Core utilities for Python packages"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
+[package.dependencies]
+pyparsing = ">=2.0.2"
+six = "*"
+
+[[package]]
+name = "pathspec"
+version = "0.8.0"
+description = "Utility library for gitignore style pattern matching of file paths."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
+[[package]]
+name = "pluggy"
+version = "0.13.1"
+description = "plugin and hook calling mechanisms for python"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
+[package.extras]
+dev = ["pre-commit", "tox"]
+
+[[package]]
+name = "py"
+version = "1.9.0"
+description = "library with cross-python path, ini-parsing, io, code, log facilities"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
+[[package]]
+name = "pyparsing"
+version = "2.4.7"
+description = "Python parsing module"
+category = "dev"
+optional = false
+python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
+
+[[package]]
+name = "pytest"
+version = "5.4.3"
+description = "pytest: simple powerful testing with Python"
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[package.dependencies]
+atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""}
+attrs = ">=17.4.0"
+colorama = {version = "*", markers = "sys_platform == \"win32\""}
+more-itertools = ">=4.0.0"
+packaging = "*"
+pluggy = ">=0.12,<1.0"
+py = ">=1.5.0"
+wcwidth = "*"
+
+[package.extras]
+checkqa-mypy = ["mypy (v0.761)"]
+testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"]
+
+[[package]]
+name = "regex"
+version = "2020.10.28"
+description = "Alternative regular expression module, to replace re."
+category = "dev"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "six"
+version = "1.15.0"
+description = "Python 2 and 3 compatibility utilities"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
+
+[[package]]
+name = "toml"
+version = "0.10.1"
+description = "Python Library for Tom's Obvious, Minimal Language"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "typed-ast"
+version = "1.4.1"
+description = "a fork of Python 2 and 3 ast modules with type comment support"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "typing-extensions"
+version = "3.7.4.3"
+description = "Backported and Experimental Type Hints for Python 3.5+"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "wcwidth"
+version = "0.2.5"
+description = "Measures the displayed width of unicode strings in a terminal"
+category = "dev"
+optional = false
+python-versions = "*"
+
+[metadata]
+lock-version = "1.1"
+python-versions = "^3.8"
+content-hash = "fed3088fdbcdedc4687f2fa6779bd2368ea11eb467bb1caef8f50083a837775e"
+
+[metadata.files]
+appdirs = [
+    {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"},
+    {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"},
+]
+atomicwrites = [
+    {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"},
+    {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"},
+]
+attrs = [
+    {file = "attrs-20.2.0-py2.py3-none-any.whl", hash = "sha256:fce7fc47dfc976152e82d53ff92fa0407700c21acd20886a13777a0d20e655dc"},
+    {file = "attrs-20.2.0.tar.gz", hash = "sha256:26b54ddbbb9ee1d34d5d3668dd37d6cf74990ab23c828c2888dccdceee395594"},
+]
+black = [
+    {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"},
+]
+click = [
+    {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
+    {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"},
+]
+colorama = [
+    {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
+    {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
+]
+more-itertools = [
+    {file = "more-itertools-8.6.0.tar.gz", hash = "sha256:b3a9005928e5bed54076e6e549c792b306fddfe72b2d1d22dd63d42d5d3899cf"},
+    {file = "more_itertools-8.6.0-py3-none-any.whl", hash = "sha256:8e1a2a43b2f2727425f2b5839587ae37093f19153dc26c0927d1048ff6557330"},
+]
+mypy-extensions = [
+    {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"},
+    {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"},
+]
+packaging = [
+    {file = "packaging-20.4-py2.py3-none-any.whl", hash = "sha256:998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"},
+    {file = "packaging-20.4.tar.gz", hash = "sha256:4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"},
+]
+pathspec = [
+    {file = "pathspec-0.8.0-py2.py3-none-any.whl", hash = "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0"},
+    {file = "pathspec-0.8.0.tar.gz", hash = "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061"},
+]
+pluggy = [
+    {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"},
+    {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"},
+]
+py = [
+    {file = "py-1.9.0-py2.py3-none-any.whl", hash = "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2"},
+    {file = "py-1.9.0.tar.gz", hash = "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"},
+]
+pyparsing = [
+    {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
+    {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
+]
+pytest = [
+    {file = "pytest-5.4.3-py3-none-any.whl", hash = "sha256:5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1"},
+    {file = "pytest-5.4.3.tar.gz", hash = "sha256:7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8"},
+]
+regex = [
+    {file = "regex-2020.10.28-cp27-cp27m-win32.whl", hash = "sha256:4b5a9bcb56cc146c3932c648603b24514447eafa6ce9295234767bf92f69b504"},
+    {file = "regex-2020.10.28-cp27-cp27m-win_amd64.whl", hash = "sha256:c13d311a4c4a8d671f5860317eb5f09591fbe8259676b86a85769423b544451e"},
+    {file = "regex-2020.10.28-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:c8a2b7ccff330ae4c460aff36626f911f918555660cc28163417cb84ffb25789"},
+    {file = "regex-2020.10.28-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4afa350f162551cf402bfa3cd8302165c8e03e689c897d185f16a167328cc6dd"},
+    {file = "regex-2020.10.28-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:b88fa3b8a3469f22b4f13d045d9bd3eda797aa4e406fde0a2644bc92bbdd4bdd"},
+    {file = "regex-2020.10.28-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:f43109822df2d3faac7aad79613f5f02e4eab0fc8ad7932d2e70e2a83bd49c26"},
+    {file = "regex-2020.10.28-cp36-cp36m-win32.whl", hash = "sha256:8092a5a06ad9a7a247f2a76ace121183dc4e1a84c259cf9c2ce3bbb69fac3582"},
+    {file = "regex-2020.10.28-cp36-cp36m-win_amd64.whl", hash = "sha256:49461446b783945597c4076aea3f49aee4b4ce922bd241e4fcf62a3e7c61794c"},
+    {file = "regex-2020.10.28-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:8ca9dca965bd86ea3631b975d63b0693566d3cc347e55786d5514988b6f5b84c"},
+    {file = "regex-2020.10.28-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ea37320877d56a7f0a1e6a625d892cf963aa7f570013499f5b8d5ab8402b5625"},
+    {file = "regex-2020.10.28-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:3a5f08039eee9ea195a89e180c5762bfb55258bfb9abb61a20d3abee3b37fd12"},
+    {file = "regex-2020.10.28-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:cb905f3d2e290a8b8f1579d3984f2cfa7c3a29cc7cba608540ceeed18513f520"},
+    {file = "regex-2020.10.28-cp37-cp37m-win32.whl", hash = "sha256:a62162be05edf64f819925ea88d09d18b09bebf20971b363ce0c24e8b4aa14c0"},
+    {file = "regex-2020.10.28-cp37-cp37m-win_amd64.whl", hash = "sha256:03855ee22980c3e4863dc84c42d6d2901133362db5daf4c36b710dd895d78f0a"},
+    {file = "regex-2020.10.28-cp38-cp38-manylinux1_i686.whl", hash = "sha256:625116aca6c4b57c56ea3d70369cacc4d62fead4930f8329d242e4fe7a58ce4b"},
+    {file = "regex-2020.10.28-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2dc522e25e57e88b4980d2bdd334825dbf6fa55f28a922fc3bfa60cc09e5ef53"},
+    {file = "regex-2020.10.28-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:119e0355dbdd4cf593b17f2fc5dbd4aec2b8899d0057e4957ba92f941f704bf5"},
+    {file = "regex-2020.10.28-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:cfcf28ed4ce9ced47b9b9670a4f0d3d3c0e4d4779ad4dadb1ad468b097f808aa"},
+    {file = "regex-2020.10.28-cp38-cp38-win32.whl", hash = "sha256:06b52815d4ad38d6524666e0d50fe9173533c9cc145a5779b89733284e6f688f"},
+    {file = "regex-2020.10.28-cp38-cp38-win_amd64.whl", hash = "sha256:c3466a84fce42c2016113101018a9981804097bacbab029c2d5b4fcb224b89de"},
+    {file = "regex-2020.10.28-cp39-cp39-manylinux1_i686.whl", hash = "sha256:c2c6c56ee97485a127555c9595c069201b5161de9d05495fbe2132b5ac104786"},
+    {file = "regex-2020.10.28-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:1ec66700a10e3c75f1f92cbde36cca0d3aaee4c73dfa26699495a3a30b09093c"},
+    {file = "regex-2020.10.28-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:11116d424734fe356d8777f89d625f0df783251ada95d6261b4c36ad27a394bb"},
+    {file = "regex-2020.10.28-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f1fce1e4929157b2afeb4bb7069204d4370bab9f4fc03ca1fbec8bd601f8c87d"},
+    {file = "regex-2020.10.28-cp39-cp39-win32.whl", hash = "sha256:832339223b9ce56b7b15168e691ae654d345ac1635eeb367ade9ecfe0e66bee0"},
+    {file = "regex-2020.10.28-cp39-cp39-win_amd64.whl", hash = "sha256:654c1635f2313d0843028487db2191530bca45af61ca85d0b16555c399625b0e"},
+    {file = "regex-2020.10.28.tar.gz", hash = "sha256:dd3e6547ecf842a29cf25123fbf8d2461c53c8d37aa20d87ecee130c89b7079b"},
+]
+six = [
+    {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
+    {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},
+]
+toml = [
+    {file = "toml-0.10.1-py2.py3-none-any.whl", hash = "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"},
+    {file = "toml-0.10.1.tar.gz", hash = "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f"},
+]
+typed-ast = [
+    {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"},
+    {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"},
+    {file = "typed_ast-1.4.1-cp35-cp35m-win32.whl", hash = "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919"},
+    {file = "typed_ast-1.4.1-cp35-cp35m-win_amd64.whl", hash = "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01"},
+    {file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"},
+    {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"},
+    {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"},
+    {file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"},
+    {file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"},
+    {file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"},
+    {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"},
+    {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"},
+    {file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"},
+    {file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"},
+    {file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"},
+    {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"},
+    {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"},
+    {file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"},
+    {file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"},
+    {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"},
+    {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"},
+]
+typing-extensions = [
+    {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"},
+    {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"},
+    {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
+]
+wcwidth = [
+    {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"},
+    {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"},
+]
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..c675bbc
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,22 @@
+[tool.poetry]
+name = "pymetalink"
+version = "6.3"
+description = "A metalink library for Python"
+authors = ["Neil McNab <nabber00@gmail.com>"]
+license = "MIT"
+packages = [{ include = "metalink" }]
+repository = "https://github.com/metalink-dev/pymetalink"
+
+[tool.poetry.dependencies]
+python = "^3.8"
+
+[tool.poetry.dev-dependencies]
+pytest = "^5.2"
+black = "^20.8b1"
+
+[tool.poetry.scripts]
+pymetalink = 'metalink.console:run'
+
+[build-system]
+requires = ["poetry-core>=1.0.0"]
+build-backend = "poetry.core.masonry.api"
diff --git a/sdist.bat b/sdist.bat
deleted file mode 100644
index 0690e7e..0000000
--- a/sdist.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-SETLOCAL
-
-rem *** Used to create a Python .zip
-
-call sample_setenv.bat
-call setenv.bat
-
-SET PYTHONPATH=%PYTHONDIR%\python.exe
-
-%PYTHONPATH% setup.py clean
-
-rem ***** create the .zip
-%PYTHONPATH% setup.py sdist
-:: %PYTHONPATH% setup.py bdist_wheel --universal
-
-echo "done..."
\ No newline at end of file
diff --git a/sdist.sh b/sdist.sh
deleted file mode 100644
index 8918251..0000000
--- a/sdist.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-python setup.py clean
-
-# create the src .tar.gz
-python setup.py sdist
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 3b4b1f7..0000000
--- a/setup.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from distutils.core import setup
-import sys
-import os.path
-import shutil
-#import glob
-import zipfile
-
-APP_NAME = 'pymetalink'
-VERSION = '6.2'
-LICENSE = 'GNU GPL'
-DESC = 'A metalink library for Python.'
-AUTHOR_NAME = 'Neil McNab'
-EMAIL = 'nabber00@gmail.com'
-URL = 'https://github.com/metalink-dev/pymetalink'
-
-
-def clean():
-    ignore = []
-    
-    filelist = []
-#    filelist.extend(glob.glob("*metalink*.txt"))
-    filelist.extend(rec_search(".zip"))
-    filelist.extend(rec_search(".pyc"))
-    filelist.extend(rec_search(".pyo"))
-
-    
-    try:
-        shutil.rmtree("build")
-    except: pass
-    try:
-        shutil.rmtree("dist")
-    except: pass
-    
-    for filename in filelist:
-        if filename not in ignore:
-            try:
-                os.remove(filename)
-            except: pass
-
-
-            
-def rec_search(end, abspath = True):
-    start = os.path.dirname(__file__)
-    mylist = []
-    for root, dirs, files in os.walk(start):
-        for filename in files:
-            if filename.endswith(end):
-                if abspath:
-                    mylist.append(os.path.join(root, filename))
-                else:
-                    mylist.append(os.path.join(root[len(start):], filename))
-                    
-    return mylist
-
-if sys.argv[1] == 'clean':
-    clean()
-else:
-    setup(
-	  packages = ['metalink'],
-      #data_files = data,
-      name = APP_NAME,
-      version = VERSION,
-      license = LICENSE,
-      description = DESC,
-      author = AUTHOR_NAME,
-      author_email = EMAIL,
-      url = URL
-      )
\ No newline at end of file


Test patch:
diff --git a/testcases/tester.py b/testcases/tester.py
deleted file mode 100644
index b50af1f..0000000
--- a/testcases/tester.py
+++ /dev/null
@@ -1,290 +0,0 @@
-#!/usr/bin/env python
-########################################################################
-#
-# Project: Metalink Checker
-# URL: http://www.nabber.org/projects/
-# E-mail: webmaster@nabber.org
-#
-# Copyright: (C) 2007-2016, Neil McNab
-# License: MIT
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a copy 
-# of this software and associated documentation files (the "Software"), to deal 
-# in the Software without restriction, including without limitation the rights 
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
-# copies of the Software, and to permit persons to whom the Software is 
-# furnished to do so, subject to the following conditions:
-# 
-# The above copyright notice and this permission notice shall be included in 
-# all copies or substantial portions of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
-# THE SOFTWARE.
-#
-# Filename: $URL$
-# Last Updated: $Date$
-# Version: $Rev$
-# Author(s): Neil McNab
-#
-# Description:
-#   Command line application that tests metalink clients.  Requires Python 2.5
-# or newer.
-#
-# Instructions:
-#   1. You need to have Python installed.
-#   2. Run on the command line using: python tester.py
-#   3. The program you are testing needs to return failure codes on exit.
-#
-########################################################################
-
-import os
-import hashlib
-import sys
-import optparse
-import time
-import subprocess
-import shutil
-import unittest
-import ctypes
-import signal
-
-# Metalink Checker
-CMD = "\"" + sys.executable + "\" ../console.py %s"
-# Aria2
-# CMD = "\"c:\\program files\\aria2\\aria2c.exe\" -M %s"
-
-OUTDIR = os.getcwd()
-TIMEOUT = 600
-SUBDIR = "subdir"
-
-IGNORE_TESTS = [] #["3_metalink-bad-piece1and2-without-torrent",
-                #"3_metalink-bad-piece2-without-torrent"]
-
-FILELIST = [
-    {"filename": "curl-7.46.0.tar.bz2",
-    "size": 3494481,
-    "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"}},
-    {"filename": "curl-7.46.0.tar.bz2.1",
-    "size": 3494481,
-    "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"}},
-    {"filename": "curl-7.46.0.tar.bz2.2",
-    "size": 3494481,
-    "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"}},
-]
-
-class TestMetalink(unittest.TestCase):
-    
-    def setUp(self):
-        clean()
-
-    def test_1_create_subdir(self):
-        self.run_test("1_create_subdir.meta4")
-    def test_1_empty_size(self):
-        self.run_test("1_empty_size.meta4")
-    def test_1_fail_bad_directory_and_network_errors(self):
-        self.run_test("1_fail_bad_directory_and_network_errors.meta4")
-    def test_1_http_redirect(self):
-        self.run_test("1_http_redirect.meta4")
-    def test_1_metalink_one_file(self):
-        self.run_test("1_metalink_one_file.meta4")
-    def test_1_metalink_three_files(self):
-        self.run_test("1_metalink_three_files.meta4")
-    def test_1_no_checksums(self):
-        self.run_test("1_no_checksums.meta4")
-    def test_1_only_ftp_and_http(self):
-        self.run_test("1_only_ftp_and_http.meta4")
-    def test_2_fail_metalink_one_file_bad_main_md5(self):
-        self.run_test("2_fail_metalink_one_file_bad_main_md5.meta4")
-    def test_2_only_ftp(self):
-        self.run_test("2_only_ftp.meta4")
-    def test_2_only_http(self):
-        self.run_test("2_only_http.meta4")
-    def test_3_fail_bad_only_advanced_checksums(self):
-        self.run_test("3_fail_bad_only_advanced_checksums.meta4")
-    def test_3_metalink_bad_piece1and2(self):
-        self.run_test("3_metalink_bad_piece1and2.meta4")
-    def test_3_metalink_bad_piece2(self):
-        self.run_test("3_metalink_bad_piece2.meta4")
-    def test_3_only_advanced_checksums(self):
-        self.run_test("3_only_advanced_checksums.meta4")
-    def test_4_empty_size_only_p2p(self):
-        self.run_test("4_empty_size_only_p2p.meta4")
-    def test_4_fail_metalink_bad_piece1and2_only_p2p(self):
-        self.run_test("4_fail_metalink_bad_piece1and2_only_p2p.meta4")
-    def test_4_fail_metalink_bad_piece2_only_p2p(self):
-        self.run_test("4_fail_metalink_bad_piece2_only_p2p.meta4")
-    def test_4_fail_metalink_one_file_bad_main_md5_only_p2p(self):
-        self.run_test("4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4")
-    def test_4_no_checksums_only_p2p(self):
-        self.run_test("4_no_checksums_only_p2p.meta4")
-    def test_4_only_p2p(self):
-        self.run_test("4_only_p2p.meta4")
-
-    def run_test(self, filename):
-        subdir = "."
-        if filename.find("subdir") != -1:
-            subdir = SUBDIR
-            
-        retcode = system(CMD % filename, TIMEOUT)
-
-        if filename.find("fail") == -1:
-            self.assertEqual(retcode, 0) # Expected return code of zero.
-        else:
-            self.assertNotEqual(retcode, 0) # Expected non zero return code.
-            return True
-
-        checklist = [0]
-        if filename.find("three") != -1:
-            checklist = [0,1,2]
-        elif filename.startswith("4"):
-            checklist = [3]
-            
-        for checkindex in checklist:
-            temp = FILELIST[checkindex]
-            tempname = os.path.join(OUTDIR, subdir, temp["filename"])
-            assert os.access(tempname, os.F_OK), "File does not exist %s." % tempname
-            self.assertEqual(os.stat(tempname).st_size, temp["size"]) # Wrong file size.
-            self.assertEqual(filehash(tempname, hashlib.sha1()), temp["checksums"]["sha1"]) # Bad file checksum.
-
-        return True
-
-
-def suite(level = 3):
-    suiteobj = unittest.TestSuite()
-
-    filedir = "./"
-    filenames = os.listdir(filedir)
-
-    for filename in filenames:
-        if filename.endswith(".meta4") and filename[:-6] not in IGNORE_TESTS:
-            mysplit = filename.split("_", 1)
-            myint = IsInt(mysplit[0])
-            if myint and (int(mysplit[0]) <= int(level)):
-                suiteobj.addTest(TestMetalink("test_" + filename[:-6]))
-  
-    return suiteobj
-
-
-def clean():
-    print "Running cleanup..."
-    for fileitem in FILELIST:
-        try:
-            os.remove(os.path.join(OUTDIR, fileitem["filename"]))
-        except: pass
-        try:
-            os.remove(os.path.join(OUTDIR, SUBDIR, fileitem["filename"]))
-        except: pass
-        shutil.rmtree(os.path.join(OUTDIR, SUBDIR), True)
-
-def filehash(thisfile, filesha):
-    '''
-    First parameter, filename
-    Returns SHA1 sum as a string of hex digits
-    '''
-    try:
-        filehandle = open(thisfile, "rb")
-    except:
-        return ""
-
-    data = filehandle.read()
-    while(data != ""):
-        filesha.update(data)
-        data = filehandle.read()
-
-    filehandle.close()
-    return filesha.hexdigest()
-
-def IsInt(str):
-	""" Is the given string an integer?	"""
-	ok = True
-	try:
-		num = int(str)
-	except ValueError:
-		ok = False
-	return ok
-
-def system(command, timeout=600, cwd=None):
-    '''
-    Alternative to os.system(), adds optional parameter to kill process
-    after a given amount of time.
-    First parameter, command to run on the local system
-    Second parameter, optional, timeout command after this many seconds
-    cwd string working directory or None
-    Returns command exit code
-    '''
-    endtime = time.time() + timeout
-
-    print command
-    process = subprocess.Popen(command, shell=True, env=os.environ, cwd=cwd)
-    while(True):
-        time.sleep(1)
-        #print "check:", process.poll()
-        if process.poll() != None:
-            return process.poll()
-        if endtime <= time.time():
-            # kill process here
-            kill(process.pid)
-            #print "Test timed out.  Process killed."
-            raise AssertionError, "Test timed out.  Process killed."
-            #return process.poll()
-            
-def kill(pid):
-    if os.name == 'nt':
-        return winkill(pid)
-    return os.kill(pid, signal.SIGKILL)      
-            
-def winkill(pid):
-    """kill function for Win32"""
-    kernel32 = ctypes.windll.kernel32
-    handle = kernel32.OpenProcess(1, 0, pid)
-    return (0 != kernel32.TerminateProcess(handle, 0))            
-        
-def run():
-    '''
-    Start a console version of this application.
-    '''
-    global OUTDIR, CMD, TIMEOUT
-    # Command line parser options.
-    parser = optparse.OptionParser()
-    parser.add_option("--level", "-l", dest="level", help="Set the level to test up to (default: 3)")
-    parser.add_option("--command", "-c", dest="command", help="Command to run (use quotes as needed), %%s=metalink file")
-    parser.add_option("--outdir", "-o", dest="outdir", help="Directory where the metalink client will output the downloaded files")
-    parser.add_option("--timeout", "-t", dest="timeout", help="Sets the amount of time a test can run until it times out (default: 600 s)")
-##    parser.add_option("--testcase", "-f", dest="testcase", help="Run a single test case")
-    parser.add_option("--clean", dest="clean", action="store_true", help="Clear out any temporary files from testing")
-
-    (options, args) = parser.parse_args()
-
-    if options.outdir != None:
-        OUTDIR = options.outdir
-    if options.command != None:
-        CMD = options.command
-    if options.timeout != None:
-        TIMEOUT = int(options.timeout)
-
-    if options.clean != None:
-        clean()
-        return
-    
-    if len(args) != 0:
-        suiteobj = unittest.TestSuite()
-        for arg in args:
-            suiteobj.addTest(TestMetalink(arg))
-    else:
-        if options.level != None:
-            suiteobj = suite(options.level)
-        else:
-            suiteobj = suite(3)
-    runner = unittest.TextTestRunner()
-    results = runner.run(suiteobj)
-
-    #print dir(suiteobj._tests)
-    
-
-if __name__=="__main__":
-    run()
diff --git a/testcases/tester3.py b/testcases/tester3.py
deleted file mode 100644
index d55445b..0000000
--- a/testcases/tester3.py
+++ /dev/null
@@ -1,290 +0,0 @@
-#!/usr/bin/env python3
-########################################################################
-#
-# Project: Metalink Checker
-# URL: http://www.nabber.org/projects/
-# E-mail: webmaster@nabber.org
-#
-# Copyright: (C) 2007-2016, Neil McNab
-# License: MIT
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a copy 
-# of this software and associated documentation files (the "Software"), to deal 
-# in the Software without restriction, including without limitation the rights 
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
-# copies of the Software, and to permit persons to whom the Software is 
-# furnished to do so, subject to the following conditions:
-# 
-# The above copyright notice and this permission notice shall be included in 
-# all copies or substantial portions of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
-# THE SOFTWARE.
-#
-# Filename: $URL$
-# Last Updated: $Date$
-# Version: $Rev$
-# Author(s): Neil McNab
-#
-# Description:
-#   Command line application that tests metalink clients.  Requires Python 2.5
-# or newer.
-#
-# Instructions:
-#   1. You need to have Python installed.
-#   2. Run on the command line using: python tester.py
-#   3. The program you are testing needs to return failure codes on exit.
-#
-########################################################################
-
-import os
-import hashlib
-import sys
-import optparse
-import time
-import subprocess
-import shutil
-import unittest
-import ctypes
-import signal
-
-# Metalink Checker
-CMD = "\"" + sys.executable + "\" ../console.py %s"
-# Aria2
-# CMD = "\"c:\\program files\\aria2\\aria2c.exe\" -M %s"
-
-OUTDIR = os.getcwd()
-TIMEOUT = 600
-SUBDIR = "subdir"
-
-IGNORE_TESTS = [] #["3_metalink-bad-piece1and2-without-torrent",
-                #"3_metalink-bad-piece2-without-torrent"]
-
-FILELIST = [
-    {"filename": "curl-7.46.0.tar.bz2",
-    "size": 3494481,
-    "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"}},
-    {"filename": "curl-7.46.0.tar.bz2.1",
-    "size": 3494481,
-    "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"}},
-    {"filename": "curl-7.46.0.tar.bz2.2",
-    "size": 3494481,
-    "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"}},
-]
-
-class TestMetalink(unittest.TestCase):
-    
-    def setUp(self):
-        clean()
-
-    def test_1_create_subdir(self):
-        self.run_test("1_create_subdir.meta4")
-    def test_1_empty_size(self):
-        self.run_test("1_empty_size.meta4")
-    def test_1_fail_bad_directory_and_network_errors(self):
-        self.run_test("1_fail_bad_directory_and_network_errors.meta4")
-    def test_1_http_redirect(self):
-        self.run_test("1_http_redirect.meta4")
-    def test_1_metalink_one_file(self):
-        self.run_test("1_metalink_one_file.meta4")
-    def test_1_metalink_three_files(self):
-        self.run_test("1_metalink_three_files.meta4")
-    def test_1_no_checksums(self):
-        self.run_test("1_no_checksums.meta4")
-    def test_1_only_ftp_and_http(self):
-        self.run_test("1_only_ftp_and_http.meta4")
-    def test_2_fail_metalink_one_file_bad_main_md5(self):
-        self.run_test("2_fail_metalink_one_file_bad_main_md5.meta4")
-    def test_2_only_ftp(self):
-        self.run_test("2_only_ftp.meta4")
-    def test_2_only_http(self):
-        self.run_test("2_only_http.meta4")
-    def test_3_fail_bad_only_advanced_checksums(self):
-        self.run_test("3_fail_bad_only_advanced_checksums.meta4")
-    def test_3_metalink_bad_piece1and2(self):
-        self.run_test("3_metalink_bad_piece1and2.meta4")
-    def test_3_metalink_bad_piece2(self):
-        self.run_test("3_metalink_bad_piece2.meta4")
-    def test_3_only_advanced_checksums(self):
-        self.run_test("3_only_advanced_checksums.meta4")
-    def test_4_empty_size_only_p2p(self):
-        self.run_test("4_empty_size_only_p2p.meta4")
-    def test_4_fail_metalink_bad_piece1and2_only_p2p(self):
-        self.run_test("4_fail_metalink_bad_piece1and2_only_p2p.meta4")
-    def test_4_fail_metalink_bad_piece2_only_p2p(self):
-        self.run_test("4_fail_metalink_bad_piece2_only_p2p.meta4")
-    def test_4_fail_metalink_one_file_bad_main_md5_only_p2p(self):
-        self.run_test("4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4")
-    def test_4_no_checksums_only_p2p(self):
-        self.run_test("4_no_checksums_only_p2p.meta4")
-    def test_4_only_p2p(self):
-        self.run_test("4_only_p2p.meta4")
-
-    def run_test(self, filename):
-        subdir = "."
-        if filename.find("subdir") != -1:
-            subdir = SUBDIR
-            
-        retcode = system(CMD % filename, TIMEOUT)
-
-        if filename.find("fail") == -1:
-            self.assertEqual(retcode, 0) # Expected return code of zero.
-        else:
-            self.assertNotEqual(retcode, 0) # Expected non zero return code.
-            return True
-
-        checklist = [0]
-        if filename.find("three") != -1:
-            checklist = [0,1,2]
-        elif filename.startswith("4"):
-            checklist = [3]
-            
-        for checkindex in checklist:
-            temp = FILELIST[checkindex]
-            tempname = os.path.join(OUTDIR, subdir, temp["filename"])
-            assert os.access(tempname, os.F_OK), "File does not exist %s." % tempname
-            self.assertEqual(os.stat(tempname).st_size, temp["size"]) # Wrong file size.
-            self.assertEqual(filehash(tempname, hashlib.sha1()), temp["checksums"]["sha1"]) # Bad file checksum.
-
-        return True
-
-
-def suite(level = 3):
-    suiteobj = unittest.TestSuite()
-
-    filedir = "./"
-    filenames = os.listdir(filedir)
-
-    for filename in filenames:
-        if filename.endswith(".meta4") and filename[:-6] not in IGNORE_TESTS:
-            mysplit = filename.split("_", 1)
-            myint = IsInt(mysplit[0])
-            if myint and (int(mysplit[0]) <= int(level)):
-                suiteobj.addTest(TestMetalink("test_" + filename[:-6]))
-  
-    return suiteobj
-
-
-def clean():
-    print("Running cleanup...")
-    for fileitem in FILELIST:
-        try:
-            os.remove(os.path.join(OUTDIR, fileitem["filename"]))
-        except: pass
-        try:
-            os.remove(os.path.join(OUTDIR, SUBDIR, fileitem["filename"]))
-        except: pass
-        shutil.rmtree(os.path.join(OUTDIR, SUBDIR), True)
-
-def filehash(thisfile, filesha):
-    '''
-    First parameter, filename
-    Returns SHA1 sum as a string of hex digits
-    '''
-    try:
-        filehandle = open(thisfile, "rb")
-    except:
-        return ""
-
-    data = filehandle.read()
-    while(data != b""):
-        filesha.update(data)
-        data = filehandle.read()
-
-    filehandle.close()
-    return filesha.hexdigest()
-
-def IsInt(str):
-	""" Is the given string an integer?	"""
-	ok = True
-	try:
-		num = int(str)
-	except ValueError:
-		ok = False
-	return ok
-
-def system(command, timeout=600, cwd=None):
-    '''
-    Alternative to os.system(), adds optional parameter to kill process
-    after a given amount of time.
-    First parameter, command to run on the local system
-    Second parameter, optional, timeout command after this many seconds
-    cwd string working directory or None
-    Returns command exit code
-    '''
-    endtime = time.time() + timeout
-
-    print(command)
-    process = subprocess.Popen(command, shell=True, env=os.environ, cwd=cwd)
-    while(True):
-        time.sleep(1)
-        #print "check:", process.poll()
-        if process.poll() != None:
-            return process.poll()
-        if endtime <= time.time():
-            # kill process here
-            kill(process.pid)
-            #print "Test timed out.  Process killed."
-            raise AssertionError("Test timed out.  Process killed.")
-            #return process.poll()
-            
-def kill(pid):
-    if os.name == 'nt':
-        return winkill(pid)
-    return os.kill(pid, signal.SIGKILL)      
-            
-def winkill(pid):
-    """kill function for Win32"""
-    kernel32 = ctypes.windll.kernel32
-    handle = kernel32.OpenProcess(1, 0, pid)
-    return (0 != kernel32.TerminateProcess(handle, 0))            
-        
-def run():
-    '''
-    Start a console version of this application.
-    '''
-    global OUTDIR, CMD, TIMEOUT
-    # Command line parser options.
-    parser = optparse.OptionParser()
-    parser.add_option("--level", "-l", dest="level", help="Set the level to test up to (default: 3)")
-    parser.add_option("--command", "-c", dest="command", help="Command to run (use quotes as needed), %%s=metalink file")
-    parser.add_option("--outdir", "-o", dest="outdir", help="Directory where the metalink client will output the downloaded files")
-    parser.add_option("--timeout", "-t", dest="timeout", help="Sets the amount of time a test can run until it times out (default: 600 s)")
-##    parser.add_option("--testcase", "-f", dest="testcase", help="Run a single test case")
-    parser.add_option("--clean", dest="clean", action="store_true", help="Clear out any temporary files from testing")
-
-    (options, args) = parser.parse_args()
-
-    if options.outdir != None:
-        OUTDIR = options.outdir
-    if options.command != None:
-        CMD = options.command
-    if options.timeout != None:
-        TIMEOUT = int(options.timeout)
-
-    if options.clean != None:
-        clean()
-        return
-    
-    if len(args) != 0:
-        suiteobj = unittest.TestSuite()
-        for arg in args:
-            suiteobj.addTest(TestMetalink(arg))
-    else:
-        if options.level != None:
-            suiteobj = suite(options.level)
-        else:
-            suiteobj = suite(3)
-    runner = unittest.TextTestRunner()
-    results = runner.run(suiteobj)
-
-    #print dir(suiteobj._tests)
-    
-
-if __name__=="__main__":
-    run()
diff --git a/testcases/1_create_subdir.meta4 b/tests/1_create_subdir.meta4
similarity index 98%
rename from testcases/1_create_subdir.meta4
rename to tests/1_create_subdir.meta4
index bcf2e84..af5dd84 100644
--- a/testcases/1_create_subdir.meta4
+++ b/tests/1_create_subdir.meta4
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="subdir/curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="subdir/curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/1_empty_size.meta4 b/tests/1_empty_size.meta4
similarity index 98%
rename from testcases/1_empty_size.meta4
rename to tests/1_empty_size.meta4
index f555284..56fb1ca 100644
--- a/testcases/1_empty_size.meta4
+++ b/tests/1_empty_size.meta4
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size></size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size></size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/1_fail_bad_directory_and_network_errors.meta4 b/tests/1_fail_bad_directory_and_network_errors.meta4
similarity index 97%
rename from testcases/1_fail_bad_directory_and_network_errors.meta4
rename to tests/1_fail_bad_directory_and_network_errors.meta4
index 86623f4..2a541a2 100644
--- a/testcases/1_fail_bad_directory_and_network_errors.meta4
+++ b/tests/1_fail_bad_directory_and_network_errors.meta4
@@ -1,48 +1,48 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url priority="20">http://192.168.2.35/curl-7.46.0.tar.bz2</url>
-<url priority="30">http://192.168.224.52/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url priority="30">http://example.com/fakedir/curl-7.46.0.tar.bz2</url>
-<url priority="30">http://fakedomain.example.com/curl-7.46.0.tar.bz2</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url priority="20">http://192.168.2.35/curl-7.46.0.tar.bz2</url>
+<url priority="30">http://192.168.224.52/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url priority="30">http://example.com/fakedir/curl-7.46.0.tar.bz2</url>
+<url priority="30">http://fakedomain.example.com/curl-7.46.0.tar.bz2</url>
+</file>
+</metalink>
diff --git a/testcases/1_metalink_one_file.meta4 b/tests/1_metalink_one_file.meta4
similarity index 98%
rename from testcases/1_metalink_one_file.meta4
rename to tests/1_metalink_one_file.meta4
index 505d043..947036f 100644
--- a/testcases/1_metalink_one_file.meta4
+++ b/tests/1_metalink_one_file.meta4
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/1_metalink_three_files.meta4 b/tests/1_metalink_three_files.meta4
similarity index 98%
rename from testcases/1_metalink_three_files.meta4
rename to tests/1_metalink_three_files.meta4
index 8bc0396..39a789f 100644
--- a/testcases/1_metalink_three_files.meta4
+++ b/tests/1_metalink_three_files.meta4
@@ -1,144 +1,144 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-<file name="curl-7.46.0.tar.bz2.1">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-<file name="curl-7.46.0.tar.bz2.2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+<file name="curl-7.46.0.tar.bz2.1">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+<file name="curl-7.46.0.tar.bz2.2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/1_no_checksums.meta4 b/tests/1_no_checksums.meta4
similarity index 98%
rename from testcases/1_no_checksums.meta4
rename to tests/1_no_checksums.meta4
index e35351c..bc6358a 100644
--- a/testcases/1_no_checksums.meta4
+++ b/tests/1_no_checksums.meta4
@@ -1,24 +1,24 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/1_only_ftp_and_http.meta4 b/tests/1_only_ftp_and_http.meta4
similarity index 98%
rename from testcases/1_only_ftp_and_http.meta4
rename to tests/1_only_ftp_and_http.meta4
index 17f738d..eb72a40 100644
--- a/testcases/1_only_ftp_and_http.meta4
+++ b/tests/1_only_ftp_and_http.meta4
@@ -1,51 +1,51 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+</file>
+</metalink>
diff --git a/testcases/2_fail_metalink_one_file_bad_main_md5.meta4 b/tests/2_fail_metalink_one_file_bad_main_md5.meta4
similarity index 98%
rename from testcases/2_fail_metalink_one_file_bad_main_md5.meta4
rename to tests/2_fail_metalink_one_file_bad_main_md5.meta4
index d0909a7..b428e7a 100644
--- a/testcases/2_fail_metalink_one_file_bad_main_md5.meta4
+++ b/tests/2_fail_metalink_one_file_bad_main_md5.meta4
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">ffff989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">ffffe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">ffff26cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">ffff989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">ffffe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">ffff26cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/2_only_ftp.meta4 b/tests/2_only_ftp.meta4
similarity index 97%
rename from testcases/2_only_ftp.meta4
rename to tests/2_only_ftp.meta4
index 1ebd456..e47db67 100644
--- a/testcases/2_only_ftp.meta4
+++ b/tests/2_only_ftp.meta4
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+</file>
+</metalink>
diff --git a/testcases/2_only_http.meta4 b/tests/2_only_http.meta4
similarity index 97%
rename from testcases/2_only_http.meta4
rename to tests/2_only_http.meta4
index 5388885..087dbbe 100644
--- a/testcases/2_only_http.meta4
+++ b/tests/2_only_http.meta4
@@ -1,50 +1,50 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+</file>
+</metalink>
diff --git a/testcases/3_fail_bad_only_advanced_checksums.meta4 b/tests/3_fail_bad_only_advanced_checksums.meta4
similarity index 98%
rename from testcases/3_fail_bad_only_advanced_checksums.meta4
rename to tests/3_fail_bad_only_advanced_checksums.meta4
index 0b1a247..2d12d78 100644
--- a/testcases/3_fail_bad_only_advanced_checksums.meta4
+++ b/tests/3_fail_bad_only_advanced_checksums.meta4
@@ -1,50 +1,50 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="sha-256">ffff26cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="sha-256">ffff26cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/3_metalink_bad_piece1and2.meta4 b/tests/3_metalink_bad_piece1and2.meta4
similarity index 98%
rename from testcases/3_metalink_bad_piece1and2.meta4
rename to tests/3_metalink_bad_piece1and2.meta4
index d74976f..d4a2d50 100644
--- a/testcases/3_metalink_bad_piece1and2.meta4
+++ b/tests/3_metalink_bad_piece1and2.meta4
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>ffffeabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>ffff91d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>ffffeabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>ffff91d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/3_metalink_bad_piece2.meta4 b/tests/3_metalink_bad_piece2.meta4
similarity index 98%
rename from testcases/3_metalink_bad_piece2.meta4
rename to tests/3_metalink_bad_piece2.meta4
index 358f5ad..ee47331 100644
--- a/testcases/3_metalink_bad_piece2.meta4
+++ b/tests/3_metalink_bad_piece2.meta4
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>ffff91d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>ffff91d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/3_only_advanced_checksums.meta4 b/tests/3_only_advanced_checksums.meta4
similarity index 98%
rename from testcases/3_only_advanced_checksums.meta4
rename to tests/3_only_advanced_checksums.meta4
index 0ca8b1a..202ed23 100644
--- a/testcases/3_only_advanced_checksums.meta4
+++ b/tests/3_only_advanced_checksums.meta4
@@ -1,50 +1,50 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/4_empty_size_only_p2p.meta4 b/tests/4_empty_size_only_p2p.meta4
similarity index 97%
rename from testcases/4_empty_size_only_p2p.meta4
rename to tests/4_empty_size_only_p2p.meta4
index cd2ce71..a772a12 100644
--- a/testcases/4_empty_size_only_p2p.meta4
+++ b/tests/4_empty_size_only_p2p.meta4
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size></size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size></size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/4_fail_metalink_bad_piece1and2_only_p2p.meta4 b/tests/4_fail_metalink_bad_piece1and2_only_p2p.meta4
similarity index 98%
rename from testcases/4_fail_metalink_bad_piece1and2_only_p2p.meta4
rename to tests/4_fail_metalink_bad_piece1and2_only_p2p.meta4
index 3b7c013..91c8709 100644
--- a/testcases/4_fail_metalink_bad_piece1and2_only_p2p.meta4
+++ b/tests/4_fail_metalink_bad_piece1and2_only_p2p.meta4
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>fffffabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>fffff1d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>fffffabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>fffff1d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/4_fail_metalink_bad_piece2_only_p2p.meta4 b/tests/4_fail_metalink_bad_piece2_only_p2p.meta4
similarity index 97%
rename from testcases/4_fail_metalink_bad_piece2_only_p2p.meta4
rename to tests/4_fail_metalink_bad_piece2_only_p2p.meta4
index e4a33f3..df77d18 100644
--- a/testcases/4_fail_metalink_bad_piece2_only_p2p.meta4
+++ b/tests/4_fail_metalink_bad_piece2_only_p2p.meta4
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>fffff1d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">9979f989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>fffff1d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4 b/tests/4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4
similarity index 97%
rename from testcases/4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4
rename to tests/4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4
index 1f8218e..8d396f5 100644
--- a/testcases/4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4
+++ b/tests/4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<hash type="md5">fffff989a2a9930d10f1b3deeabc2148</hash>
-<hash type="sha-1">ffffe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
-<hash type="sha-256">ffff26cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
-<signature mediatype="application/pgp-signature">
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
-I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
-=q8l3
------END PGP SIGNATURE-----
-</signature>
-      <pieces type="sha-1" length="262144">
-        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
-        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
-        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
-        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
-        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
-        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
-        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
-        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
-        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
-        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
-        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
-        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
-        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
-        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
-      </pieces>
-<!-- resource preferences are for use in United states -->
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<hash type="md5">fffff989a2a9930d10f1b3deeabc2148</hash>
+<hash type="sha-1">ffffe5abe8ecfb923e4ab0a579b3d6be43ef0e96</hash>
+<hash type="sha-256">ffff26cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad</hash>
+<signature mediatype="application/pgp-signature">
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iEYEABECAAYFAlZel9kACgkQeOEcayedXJGZAACdFMiz+Sjw9HJjoMdta8OhhzTi
+I+8AoJ0CFoYKuDIKND8o1bDbZg4ZFtsq
+=q8l3
+-----END PGP SIGNATURE-----
+</signature>
+      <pieces type="sha-1" length="262144">
+        <hash>6656eabfe860ce103c7bce675d39722f3ea7f5e7</hash>
+        <hash>308891d3724fc8277d28c2bd8092d36f8ac33462</hash>
+        <hash>d3f5a481d56be96ae9252adb57ee951f654989fd</hash>
+        <hash>67c5a2e3550bfe912ca2d7941cfff223db550895</hash>
+        <hash>ad52fdc71152b360759b1caddbd4beb347f8f5ae</hash>
+        <hash>2b8d33033e8619e72cec1506fd4fc9b54fb2ab66</hash>
+        <hash>ce36abb9de94222cff6504943c52d9c495f3cd48</hash>
+        <hash>0add1d5dcc393cfd4a7d0e0b3052263dec2b17eb</hash>
+        <hash>37e233909586bb1f3cc0febba71b94275830748d</hash>
+        <hash>46544ed2fbaa3cb016c63bc731977089634fac23</hash>
+        <hash>17d2c13004546ee95ada829b46f368a7a73cf859</hash>
+        <hash>a4c8748273db42dbacb5ef6db1f7391bff55d021</hash>
+        <hash>68de3f16b43a5dd55c4877fd620101cf6d8f404f</hash>
+        <hash>1c20ed47e99fd0021c6e5261220128733c8773d8</hash>
+      </pieces>
+<!-- resource preferences are for use in United states -->
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/4_no_checksums_only_p2p.meta4 b/tests/4_no_checksums_only_p2p.meta4
similarity index 98%
rename from testcases/4_no_checksums_only_p2p.meta4
rename to tests/4_no_checksums_only_p2p.meta4
index e35351c..bc6358a 100644
--- a/testcases/4_no_checksums_only_p2p.meta4
+++ b/tests/4_no_checksums_only_p2p.meta4
@@ -1,24 +1,24 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-<updated>2016-01-16T00:41:05Z</updated>
-<generator>curl Metalink Generator</generator>
-<published>2015-12-02T07:04:19Z</published>
-<file name="curl-7.46.0.tar.bz2">
-<publisher>
- <name>curl</name>
- <url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<version>7.46.0</version>
-<size>3494481</size>
-<!-- resource preferences are for use in United states -->
-<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
-<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
-<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
-<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
-<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
-</file>
-</metalink>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink xmlns="urn:ietf:params:xml:ns:metalink">
+<updated>2016-01-16T00:41:05Z</updated>
+<generator>curl Metalink Generator</generator>
+<published>2015-12-02T07:04:19Z</published>
+<file name="curl-7.46.0.tar.bz2">
+<publisher>
+ <name>curl</name>
+ <url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<version>7.46.0</version>
+<size>3494481</size>
+<!-- resource preferences are for use in United states -->
+<url location="ca" priority="20">http://curl.mirror.anstey.ca/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://dl.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="de" priority="30">http://ngcobalt13.uxnr.de/mirror/curl/curl-7.46.0.tar.bz2</url>
+<url location="sg" priority="30">http://www.execve.net/curl/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">http://curl.haxx.se/download/curl-7.46.0.tar.bz2</url>
+<url location="se" priority="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.46.0.tar.bz2</url>
+<url location="us" priority="10">http://curl.askapache.com/download/curl-7.46.0.tar.bz2</url>
+<url>ed2k://|file|curl-7.46.0.tar.bz2|bde7b636d9420593444314fc911bb101|bde7b636d9420593444314fc911bb101|/</url>
+</file>
+</metalink>
diff --git a/testcases/4_only_p2p.meta4 b/tests/4_only_p2p.meta4
similarity index 100%
rename from testcases/4_only_p2p.meta4
rename to tests/4_only_p2p.meta4
diff --git a/testcases/index.html b/tests/index.html
similarity index 97%
rename from testcases/index.html
rename to tests/index.html
index bc315a0..1b0a02a 100644
--- a/testcases/index.html
+++ b/tests/index.html
@@ -1,7 +1,7 @@
-<html>
-<body>
-<applet code="jyinterface/DLApplet.class" archive="../build/DLApplet.jar,../build/python-lib.jar,../build/jython.jar"  width="520" height="250">
-<param name="url" value="http://metalinker.org/samples/abiword-setup-2.4.6.exe.metalink" />
-</applet>
-</body>
+<html>
+<body>
+<applet code="jyinterface/DLApplet.class" archive="../build/DLApplet.jar,../build/python-lib.jar,../build/jython.jar"  width="520" height="250">
+<param name="url" value="http://metalinker.org/samples/abiword-setup-2.4.6.exe.metalink" />
+</applet>
+</body>
 </html>
\ No newline at end of file
diff --git a/tests/test_console.py b/tests/test_console.py
new file mode 100644
index 0000000..fb297ab
--- /dev/null
+++ b/tests/test_console.py
@@ -0,0 +1,228 @@
+#!/usr/bin/env python3
+########################################################################
+#
+# Project: Metalink Checker
+# URL: http://www.nabber.org/projects/
+# E-mail: webmaster@nabber.org
+#
+# Copyright: (C) 2007-2016, Neil McNab
+# License: MIT
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# Filename: $URL$
+# Last Updated: $Date$
+# Version: $Rev$
+# Author(s): Neil McNab
+#
+# Description:
+#   Command line application that tests metalink clients.  Requires Python 2.5
+# or newer.
+#
+# Instructions: poetry run pytest
+#
+########################################################################
+
+import os
+import hashlib
+import time
+import shutil
+import pytest
+
+from metalink import console
+
+OUTDIR = "/tmp"
+TIMEOUT = 600
+SUBDIR = "subdir"
+
+TESTS_FOLDER = os.path.dirname(__file__)
+
+
+FILELIST = [
+    {
+        "filename": "curl-7.46.0.tar.bz2",
+        "size": 3494481,
+        "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"},
+    },
+    {
+        "filename": "curl-7.46.0.tar.bz2.1",
+        "size": 3494481,
+        "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"},
+    },
+    {
+        "filename": "curl-7.46.0.tar.bz2.2",
+        "size": 3494481,
+        "checksums": {"sha1": "96fbe5abe8ecfb923e4ab0a579b3d6be43ef0e96"},
+    },
+]
+
+
+def test_1_create_subdir():
+    run_test("1_create_subdir.meta4")
+
+
+def test_1_empty_size():
+    run_test("1_empty_size.meta4")
+
+
+def test_1_fail_bad_directory_and_network_errors():
+    run_test("1_fail_bad_directory_and_network_errors.meta4")
+
+
+def test_1_http_redirect():
+    run_test("1_http_redirect.meta4")
+
+
+def test_1_metalink_one_file():
+    run_test("1_metalink_one_file.meta4")
+
+
+def test_1_metalink_three_files():
+    run_test("1_metalink_three_files.meta4")
+
+
+def test_1_no_checksums():
+    run_test("1_no_checksums.meta4")
+
+
+def test_1_only_ftp_and_http():
+    run_test("1_only_ftp_and_http.meta4")
+
+
+def test_2_fail_metalink_one_file_bad_main_md5():
+    run_test("2_fail_metalink_one_file_bad_main_md5.meta4")
+
+
+def test_2_only_ftp():
+    run_test("2_only_ftp.meta4")
+
+
+def test_2_only_http():
+    run_test("2_only_http.meta4")
+
+
+def test_3_fail_bad_only_advanced_checksums():
+    run_test("3_fail_bad_only_advanced_checksums.meta4")
+
+
+def test_3_metalink_bad_piece1and2():
+    run_test("3_metalink_bad_piece1and2.meta4")
+
+
+def test_3_metalink_bad_piece2():
+    run_test("3_metalink_bad_piece2.meta4")
+
+
+def test_3_only_advanced_checksums():
+    run_test("3_only_advanced_checksums.meta4")
+
+
+def test_4_empty_size_only_p2p():
+    run_test("4_empty_size_only_p2p.meta4")
+
+
+def test_4_fail_metalink_bad_piece1and2_only_p2p():
+    run_test("4_fail_metalink_bad_piece1and2_only_p2p.meta4")
+
+
+def test_4_fail_metalink_bad_piece2_only_p2p():
+    run_test("4_fail_metalink_bad_piece2_only_p2p.meta4")
+
+
+def test_4_fail_metalink_one_file_bad_main_md5_only_p2p():
+    run_test("4_fail_metalink_one_file_bad_main_md5_only_p2p.meta4")
+
+
+def test_4_no_checksums_only_p2p():
+    run_test("4_no_checksums_only_p2p.meta4")
+
+
+def test_4_only_p2p():
+    run_test("4_only_p2p.meta4")
+
+
+def run_test(filename):
+    subdir = "."
+    if filename.find("subdir") != -1:
+        subdir = SUBDIR
+
+    old_wd = os.getcwd()
+    retcode = -1
+    try:
+        os.chdir(OUTDIR)
+        retcode = console.run([os.path.join(TESTS_FOLDER, filename)])
+    finally:
+        os.chdir(old_wd)
+
+    if filename.find("fail") == -1:
+        assert retcode == 0, "Expected return code of zero."
+    else:
+        assert retcode != 0, "Expected non zero return code."
+        return True
+
+    checklist = [0]
+    if filename.find("three") != -1:
+        checklist = [0, 1, 2]
+    elif filename.startswith("4"):
+        checklist = [3]
+
+    for checkindex in checklist:
+        temp = FILELIST[checkindex]
+        tempname = os.path.join(OUTDIR, subdir, temp["filename"])
+        assert os.access(tempname, os.F_OK), "File does not exist %s." % tempname
+        assert os.stat(tempname).st_size == temp["size"], "Wrong file size."
+        assert (
+            filehash(tempname, hashlib.sha1()) == temp["checksums"]["sha1"]
+        ), "Bad file checksum."
+
+    return True
+
+
+@pytest.fixture(autouse=True, scope="session")
+def clean():
+    print("Running cleanup...")
+    for fileitem in FILELIST:
+        try:
+            os.remove(os.path.join(OUTDIR, fileitem["filename"]))
+        except:
+            pass
+        try:
+            os.remove(os.path.join(OUTDIR, SUBDIR, fileitem["filename"]))
+        except:
+            pass
+        shutil.rmtree(os.path.join(OUTDIR, SUBDIR), True)
+
+
+def filehash(thisfile, filesha):
+    """
+    First parameter, filename
+    Returns SHA1 sum as a string of hex digits
+    """
+    try:
+        filehandle = open(thisfile, "rb")
+    except:
+        return ""
+
+    data = filehandle.read()
+    while data != b"":
+        filesha.update(data)
+        data = filehandle.read()
+
+    filehandle.close()
+    return filesha.hexdigest()
diff --git a/testcases/unused/1_fail-bad-size.metalink b/tests/unused/1_fail-bad-size.metalink
similarity index 98%
rename from testcases/unused/1_fail-bad-size.metalink
rename to tests/unused/1_fail-bad-size.metalink
index 7f05fd3..f09b5f2 100644
--- a/testcases/unused/1_fail-bad-size.metalink
+++ b/tests/unused/1_fail-bad-size.metalink
@@ -1,65 +1,65 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink version="3.0" generator="curl Metalink Generator" xmlns="http://www.metalinker.org/"
-type="dynamic" refreshdate="Wed, 23 Apr 2008 03:25:45 GMT">
-<publisher>
-<name>curl</name>
-<url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<files><file name="curl-7.18.1.tar.bz2">
-<version>7.18.1</version>
-<size>11111</size>
-<verification>
-<hash type="md5">805834fc1136ff7600d2179bc0386c5a</hash>
-<hash type="sha1">685b9388ee9e646158a83cd435f7be664816ad78</hash>
-</verification>
-<!-- resource preferences are for use in an unknown location -->
-<resources>
-<url type="ftp" location="au" preference="30">ftp://ftp.planetmirror.com/pub/curl/curl-7.18.1.tar.bz2</url>
-<url type="http" location="at" preference="30">http://gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="at" preference="30">ftp://gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
-<url type="http" location="be" preference="30">http://curl.spegulo.be/download/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="be" preference="30">ftp://ftp.spegulo.be/pub/curl/curl-7.18.1.tar.bz2</url>
-<url type="http" location="cl" preference="30">http://curl.freeby.pctools.cl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="dk" preference="30">http://curl.cofman.dk/download/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="fr" preference="30">ftp://miroir-francais.fr/pub/curl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="fr" preference="30">http://curl.miroir-francais.fr/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.de-mirror.de/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.mirroarrr.de/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.online-mirror.de/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.linux-mirror.org/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.freemirror.de/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://dl.ambiweb.de/mirrors/curl.haxx.se/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.oslevel.de/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.mirror.at.stealer.net/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.wetzlmayr.at/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.very-clever.com/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="de" preference="30">http://curl.mirror-server.net/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="hk" preference="30">http://www.execve.net/curl/curl-7.18.1.tar.bz2</url>
-<url type="http" location="hk" preference="30">http://curl.hkmirror.org/download/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="hk" preference="30">ftp://ftp.hkmirror.org/pub/curl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="il" preference="30">http://curl.cheap.co.il/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="jp" preference="30">http://curl.s-lines.net/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="nl" preference="30">http://curl.dsmirror.nl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="nl" preference="30">http://curl.digimirror.nl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="nl" preference="30">http://curl.nedmirror.nl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="nl" preference="30">http://curl.osmirror.nl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="nl" preference="30">http://curl.xxtracker.org/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="pl" preference="30">http://curl.piotrkosoft.net/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="pt" preference="30">http://curl.gominet.net/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="se" preference="30">http://curl.haxx.se/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="se" preference="30">http://cool.haxx.se/curl/curl-7.18.1.tar.bz2</url>
-<url type="http" location="se" preference="30">http://curl2.haxx.se/download/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="se" preference="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.18.1.tar.bz2</url>
-<url type="http" location="tw" preference="30">http://curl.cs.pu.edu.tw/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="us" preference="30">http://curl.download.nextag.com/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="us" preference="30">http://curl.tolix.org/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="us" preference="30">http://curl.signal42.com/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="us" preference="30">http://curl.mirrors.redwire.net/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="us" preference="30">http://curl.hoxt.com/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="us" preference="30">http://curl.askapache.com/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="gb" preference="30">http://curl.internet.bs/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="gb" preference="30">http://curl.smudge-it.co.uk/download/curl-7.18.1.tar.bz2</url>
-</resources>
-</file></files>
+<?xml version="1.0" encoding="utf-8"?>
+<metalink version="3.0" generator="curl Metalink Generator" xmlns="http://www.metalinker.org/"
+type="dynamic" refreshdate="Wed, 23 Apr 2008 03:25:45 GMT">
+<publisher>
+<name>curl</name>
+<url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<files><file name="curl-7.18.1.tar.bz2">
+<version>7.18.1</version>
+<size>11111</size>
+<verification>
+<hash type="md5">805834fc1136ff7600d2179bc0386c5a</hash>
+<hash type="sha1">685b9388ee9e646158a83cd435f7be664816ad78</hash>
+</verification>
+<!-- resource preferences are for use in an unknown location -->
+<resources>
+<url type="ftp" location="au" preference="30">ftp://ftp.planetmirror.com/pub/curl/curl-7.18.1.tar.bz2</url>
+<url type="http" location="at" preference="30">http://gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="at" preference="30">ftp://gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
+<url type="http" location="be" preference="30">http://curl.spegulo.be/download/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="be" preference="30">ftp://ftp.spegulo.be/pub/curl/curl-7.18.1.tar.bz2</url>
+<url type="http" location="cl" preference="30">http://curl.freeby.pctools.cl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="dk" preference="30">http://curl.cofman.dk/download/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="fr" preference="30">ftp://miroir-francais.fr/pub/curl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="fr" preference="30">http://curl.miroir-francais.fr/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.de-mirror.de/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.mirroarrr.de/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.online-mirror.de/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.linux-mirror.org/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.freemirror.de/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://dl.ambiweb.de/mirrors/curl.haxx.se/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.oslevel.de/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.mirror.at.stealer.net/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.wetzlmayr.at/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.very-clever.com/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="de" preference="30">http://curl.mirror-server.net/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="hk" preference="30">http://www.execve.net/curl/curl-7.18.1.tar.bz2</url>
+<url type="http" location="hk" preference="30">http://curl.hkmirror.org/download/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="hk" preference="30">ftp://ftp.hkmirror.org/pub/curl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="il" preference="30">http://curl.cheap.co.il/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="jp" preference="30">http://curl.s-lines.net/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="nl" preference="30">http://curl.dsmirror.nl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="nl" preference="30">http://curl.digimirror.nl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="nl" preference="30">http://curl.nedmirror.nl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="nl" preference="30">http://curl.osmirror.nl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="nl" preference="30">http://curl.xxtracker.org/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="pl" preference="30">http://curl.piotrkosoft.net/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="pt" preference="30">http://curl.gominet.net/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="se" preference="30">http://curl.haxx.se/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="se" preference="30">http://cool.haxx.se/curl/curl-7.18.1.tar.bz2</url>
+<url type="http" location="se" preference="30">http://curl2.haxx.se/download/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="se" preference="30">ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.18.1.tar.bz2</url>
+<url type="http" location="tw" preference="30">http://curl.cs.pu.edu.tw/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="us" preference="30">http://curl.download.nextag.com/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="us" preference="30">http://curl.tolix.org/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="us" preference="30">http://curl.signal42.com/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="us" preference="30">http://curl.mirrors.redwire.net/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="us" preference="30">http://curl.hoxt.com/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="us" preference="30">http://curl.askapache.com/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="gb" preference="30">http://curl.internet.bs/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="gb" preference="30">http://curl.smudge-it.co.uk/download/curl-7.18.1.tar.bz2</url>
+</resources>
+</file></files>
 </metalink>
\ No newline at end of file
diff --git a/testcases/unused/ftp-login.metalink b/tests/unused/ftp-login.metalink
similarity index 97%
rename from testcases/unused/ftp-login.metalink
rename to tests/unused/ftp-login.metalink
index 52c3b63..c3386ec 100644
--- a/testcases/unused/ftp-login.metalink
+++ b/tests/unused/ftp-login.metalink
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink version="3.0" generator="curl Metalink Generator" xmlns="http://www.metalinker.org/"
-type="dynamic" refreshdate="Wed, 23 Apr 2008 03:25:45 GMT">
-<publisher>
-<name>curl</name>
-<url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<files><file name="curl-7.18.1.tar.bz2">
-<version>7.18.1</version>
-<size>1700966</size>
-<verification>
-<hash type="md5">805834fc1136ff7600d2179bc0386c5a</hash>
-<hash type="sha1">685b9388ee9e646158a83cd435f7be664816ad78</hash>
-</verification>
-<!-- resource preferences are for use in an unknown location -->
-<resources>
-<url type="ftp" location="au" preference="30">ftp://anonymous:mozilla%40example.com@ftp.planetmirror.com/pub/curl/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="at" preference="30">ftp://anonymous:mozilla%40example.com@gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="be" preference="30">ftp://anonymous:mozilla%40example.com@ftp.spegulo.be/pub/curl/curl-7.18.1.tar.bz2</url>
-<url type="ftp" location="fr" preference="30">ftp://anonymous:mozilla%40example.com@miroir-francais.fr/pub/curl/download/curl-7.18.1.tar.bz2</url>
-</resources>
-</file></files>
-</metalink>
-
-
+<?xml version="1.0" encoding="utf-8"?>
+<metalink version="3.0" generator="curl Metalink Generator" xmlns="http://www.metalinker.org/"
+type="dynamic" refreshdate="Wed, 23 Apr 2008 03:25:45 GMT">
+<publisher>
+<name>curl</name>
+<url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<files><file name="curl-7.18.1.tar.bz2">
+<version>7.18.1</version>
+<size>1700966</size>
+<verification>
+<hash type="md5">805834fc1136ff7600d2179bc0386c5a</hash>
+<hash type="sha1">685b9388ee9e646158a83cd435f7be664816ad78</hash>
+</verification>
+<!-- resource preferences are for use in an unknown location -->
+<resources>
+<url type="ftp" location="au" preference="30">ftp://anonymous:mozilla%40example.com@ftp.planetmirror.com/pub/curl/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="at" preference="30">ftp://anonymous:mozilla%40example.com@gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="be" preference="30">ftp://anonymous:mozilla%40example.com@ftp.spegulo.be/pub/curl/curl-7.18.1.tar.bz2</url>
+<url type="ftp" location="fr" preference="30">ftp://anonymous:mozilla%40example.com@miroir-francais.fr/pub/curl/download/curl-7.18.1.tar.bz2</url>
+</resources>
+</file></files>
+</metalink>
+
+
diff --git a/testcases/unused/http-login.metalink b/tests/unused/http-login.metalink
similarity index 97%
rename from testcases/unused/http-login.metalink
rename to tests/unused/http-login.metalink
index a6fd778..7d3dc1b 100644
--- a/testcases/unused/http-login.metalink
+++ b/tests/unused/http-login.metalink
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="utf-8"?>
-<metalink version="3.0" generator="curl Metalink Generator" xmlns="http://www.metalinker.org/"
-type="dynamic" refreshdate="Wed, 23 Apr 2008 03:25:45 GMT">
-<publisher>
-<name>curl</name>
-<url>http://curl.haxx.se/</url>
-</publisher>
-<description>curl Generic source tar, bzip2</description>
-<files><file name="curl-7.18.1.tar.bz2">
-<version>7.18.1</version>
-<size>1700966</size>
-<verification>
-<hash type="md5">805834fc1136ff7600d2179bc0386c5a</hash>
-<hash type="sha1">685b9388ee9e646158a83cd435f7be664816ad78</hash>
-</verification>
-<!-- resource preferences are for use in an unknown location -->
-<resources>
-<url type="http" location="at" preference="30">http://anonymous:mozilla%40example.com@gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
-<url type="http" location="be" preference="30">http://anonymous:mozilla%40example.com@curl.spegulo.be/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="cl" preference="30">http://anonymous:mozilla%40example.com@curl.freeby.pctools.cl/download/curl-7.18.1.tar.bz2</url>
-<url type="http" location="dk" preference="30">http://anonymous:mozilla%40example.com@curl.cofman.dk/download/curl-7.18.1.tar.bz2</url>
-</resources>
-</file></files>
-</metalink>
-
-
+<?xml version="1.0" encoding="utf-8"?>
+<metalink version="3.0" generator="curl Metalink Generator" xmlns="http://www.metalinker.org/"
+type="dynamic" refreshdate="Wed, 23 Apr 2008 03:25:45 GMT">
+<publisher>
+<name>curl</name>
+<url>http://curl.haxx.se/</url>
+</publisher>
+<description>curl Generic source tar, bzip2</description>
+<files><file name="curl-7.18.1.tar.bz2">
+<version>7.18.1</version>
+<size>1700966</size>
+<verification>
+<hash type="md5">805834fc1136ff7600d2179bc0386c5a</hash>
+<hash type="sha1">685b9388ee9e646158a83cd435f7be664816ad78</hash>
+</verification>
+<!-- resource preferences are for use in an unknown location -->
+<resources>
+<url type="http" location="at" preference="30">http://anonymous:mozilla%40example.com@gd.tuwien.ac.at/utils/archivers/curl/curl-7.18.1.tar.bz2</url>
+<url type="http" location="be" preference="30">http://anonymous:mozilla%40example.com@curl.spegulo.be/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="cl" preference="30">http://anonymous:mozilla%40example.com@curl.freeby.pctools.cl/download/curl-7.18.1.tar.bz2</url>
+<url type="http" location="dk" preference="30">http://anonymous:mozilla%40example.com@curl.cofman.dk/download/curl-7.18.1.tar.bz2</url>
+</resources>
+</file></files>
+</metalink>
+
+