Add script to generate compressed urls test file.

Omit the timestamp and the file name from the file header to make the
file deterministic.
Refresh the urls test file.
This commit is contained in:
Zach Borboa
2018-04-28 02:09:14 -07:00
parent 3839881735
commit fc054f6f41
3 changed files with 71 additions and 0 deletions
Binary file not shown.
+61
View File
@@ -54,9 +54,70 @@ first_queries = ['', '?a=1', '?a=647&b=s564']
second_queries = ['', '?a=sdf', '?a=cvb&b=987']
fragments = ['', '#foo', '#bar']
additional_tests = [
{
'args': [
'http://www.example.com/',
'',
],
'expected': 'http://www.example.com/',
},
{
'args': [
'http://www.example.com/',
'foo',
],
'expected': 'http://www.example.com/foo',
},
{
'args': [
'http://www.example.com/',
'/foo',
],
'expected': 'http://www.example.com/foo',
},
{
'args': [
'http://www.example.com/',
'/foo/',
],
'expected': 'http://www.example.com/foo/',
},
{
'args': [
'http://www.example.com/',
'/dir/page.html',
],
'expected': 'http://www.example.com/dir/page.html',
},
{
'args': [
'http://www.example.com/dir1/page2.html',
'/dir/page.html',
],
'expected': 'http://www.example.com/dir/page.html',
},
{
'args': [
'http://www.example.com/dir1/page2.html',
'dir/page.html',
],
'expected': 'http://www.example.com/dir1/dir/page.html',
},
{
'args': [
'http://www.example.com/dir1/dir3/page.html',
'../dir/page.html',
],
'expected': 'http://www.example.com/dir1/dir/page.html',
},
]
with open('urls.csv', 'wt') as f:
csvwriter = csv.writer(f, quotechar='"', quoting=csv.QUOTE_ALL)
csvwriter.writerow(['first_url', 'second_url', 'expected'])
for test in additional_tests:
csvwriter.writerow([test['args'][0], test['args'][1], test['expected']])
for first_domain, second_domain in product(first_authorities, second_authorities):
for first_path, second_path in product(first_paths, second_paths):
for first_query, second_query in product(first_queries, second_queries):
+10
View File
@@ -0,0 +1,10 @@
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}"
set -x
python "generate_urls.py" &&
([[ -f "urls.csv.gz" ]] && rm --verbose "urls.csv.gz" || exit 0) &&
gzip --verbose --best --no-name "urls.csv" &&
gzip --verbose --test "urls.csv.gz" &&
mv --verbose "urls.csv.gz" "PHPCurlClass/urls.csv.gz"