Skip to content

Commit aae2e27

Browse files
Add command line test via *.bat files.
Test the working of -Ux command line parameter. Does the 5 possible selections work as expected.
1 parent 280ed4d commit aae2e27

File tree

7 files changed

+248
-0
lines changed

7 files changed

+248
-0
lines changed

source/test/bat/U0.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
echo off
2+
rem Test trackereditor.exe via command line.
3+
4+
rem Console parameter: -U0
5+
rem Insert new trackers list BEFORE, the original trackers list inside the torrent file.
6+
rem And remove possible duplicated trackers from the ORIGINAL trackers list.
7+
8+
SETLOCAL
9+
10+
rem clean all torrent trackers
11+
call dht_torrent.bat
12+
13+
rem default variables
14+
call variables.bat
15+
16+
rem add some ORIGINAL trackers
17+
echo %t_d%> %add_trackers_txt%
18+
echo %t_a%>> %add_trackers_txt%
19+
echo %t_c%>> %add_trackers_txt%
20+
echo %t_b%>> %add_trackers_txt%
21+
22+
rem remove_trackers_txt file.
23+
del %remove_trackers_txt%
24+
25+
rem modify the torrent folder
26+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U0
27+
28+
rem add some NEW trackers
29+
echo %t_o%> %add_trackers_txt%
30+
echo %t_b%>> %add_trackers_txt%
31+
echo %t_p%>> %add_trackers_txt%
32+
echo %t_m%>> %add_trackers_txt%
33+
34+
rem modify the torrent folder
35+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U0
36+
37+
rem torrent must filled with trackers in this order: new(o,b,p,m) + original(d,a,c,b)
38+
rem -> remove duplicated from original -> o,b,p,m,d,a,c,
39+
40+
ENDLOCAL
41+
exit /b

source/test/bat/U1.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
echo off
2+
rem Test trackereditor.exe via command line.
3+
4+
rem Console parameter: -U1
5+
rem Insert new trackers list BEFORE, the original trackers list inside the torrent file.
6+
rem And remove possible duplicated trackers from the NEW trackers list.
7+
8+
SETLOCAL
9+
10+
rem clean all torrent trackers
11+
call dht_torrent.bat
12+
13+
rem default variables
14+
call variables.bat
15+
16+
rem add some ORIGINAL trackers
17+
echo %t_d%> %add_trackers_txt%
18+
echo %t_p%>> %add_trackers_txt%
19+
echo %t_c%>> %add_trackers_txt%
20+
echo %t_b%>> %add_trackers_txt%
21+
22+
rem remove_trackers_txt file.
23+
del %remove_trackers_txt%
24+
25+
rem modify the torrent folder
26+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U1
27+
28+
rem add some NEW trackers
29+
echo %t_o%> %add_trackers_txt%
30+
echo %t_n%>> %add_trackers_txt%
31+
echo %t_p%>> %add_trackers_txt%
32+
echo %t_m%>> %add_trackers_txt%
33+
34+
rem modify the torrent folder
35+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U1
36+
37+
rem torrent must filled with trackers in this order: new(o,n,p,m) + original(d,p,c,b)
38+
rem -> remove duplicated from new -> o,n,m,d,p,c,b
39+
40+
ENDLOCAL
41+
exit /b

source/test/bat/U2.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
echo off
2+
rem Test trackereditor.exe via command line.
3+
4+
rem Console parameter: -U2
5+
rem Append new trackers list AFTER, the original trackers list inside the torrent file.
6+
rem And remove possible duplicated trackers from the ORIGINAL trackers list.
7+
8+
SETLOCAL
9+
10+
rem clean all torrent trackers
11+
call dht_torrent.bat
12+
13+
rem default variables
14+
call variables.bat
15+
16+
rem add some ORIGINAL trackers
17+
echo %t_d%> %add_trackers_txt%
18+
echo %t_a%>> %add_trackers_txt%
19+
echo %t_c%>> %add_trackers_txt%
20+
echo %t_b%>> %add_trackers_txt%
21+
22+
rem remove_trackers_txt file.
23+
del %remove_trackers_txt%
24+
25+
rem modify the torrent folder
26+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U2
27+
28+
rem add some NEW trackers
29+
echo %t_o%> %add_trackers_txt%
30+
echo %t_n%>> %add_trackers_txt%
31+
echo %t_a%>> %add_trackers_txt%
32+
echo %t_m%>> %add_trackers_txt%
33+
34+
rem modify the torrent folder
35+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U2
36+
37+
rem torrent must filled with trackers in this order: original(d,a,c,b) + new(o,n,a,m)
38+
rem -> remove duplicated from original -> d,c,b,o,n,a,m
39+
40+
ENDLOCAL
41+
exit /b

source/test/bat/U3.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
echo off
2+
rem Test trackereditor.exe via command line.
3+
4+
rem Console parameter: -U3
5+
rem Append new trackers list AFTER, the original trackers list inside the torrent file.
6+
rem And remove possible duplicated trackers from the NEW trackers list.
7+
8+
SETLOCAL
9+
10+
rem clean all torrent trackers
11+
call dht_torrent.bat
12+
13+
rem default variables
14+
call variables.bat
15+
16+
rem add some ORIGINAL trackers
17+
echo %t_d%> %add_trackers_txt%
18+
echo %t_a%>> %add_trackers_txt%
19+
echo %t_c%>> %add_trackers_txt%
20+
echo %t_b%>> %add_trackers_txt%
21+
22+
rem remove_trackers_txt file.
23+
del %remove_trackers_txt%
24+
25+
rem modify the torrent folder
26+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U3
27+
28+
rem add some NEW trackers
29+
echo %t_d%> %add_trackers_txt%
30+
echo %t_n%>> %add_trackers_txt%
31+
echo %t_a%>> %add_trackers_txt%
32+
echo %t_m%>> %add_trackers_txt%
33+
34+
rem modify the torrent folder
35+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U3
36+
37+
rem torrent must filled with trackers in this order: original(d,a,c,b) + new(d,n,a,m)
38+
rem -> remove duplicated from new -> d,a,c,b,n,m
39+
40+
ENDLOCAL
41+
exit /b

source/test/bat/U4.bat

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
echo off
2+
rem Test trackereditor.exe via command line.
3+
4+
rem Console parameter: -U4
5+
rem Sort the trackers list by name.
6+
7+
SETLOCAL
8+
9+
rem clean all torrent trackers
10+
call dht_torrent.bat
11+
12+
rem default variables
13+
call variables.bat
14+
15+
rem add some ORIGINAL trackers
16+
echo %t_d%> %add_trackers_txt%
17+
echo %t_a%>> %add_trackers_txt%
18+
echo %t_c%>> %add_trackers_txt%
19+
echo %t_b%>> %add_trackers_txt%
20+
21+
rem remove_trackers_txt file.
22+
del %remove_trackers_txt%
23+
24+
rem modify the torrent folder
25+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U4
26+
27+
rem add some NEW trackers
28+
echo %t_b%> %add_trackers_txt%
29+
echo %t_n%>> %add_trackers_txt%
30+
echo %t_p%>> %add_trackers_txt%
31+
echo %t_m%>> %add_trackers_txt%
32+
33+
rem modify the torrent folder
34+
%path_to_enduser%trackereditor.exe %path_to_torrent% -U4
35+
36+
rem torrent must filled with trackers in this order: original(d,a,c,b) + new(b,n,p,m)
37+
rem -> sort my name -> a,b,c,d,m,n,p
38+
39+
ENDLOCAL
40+
exit /b

source/test/bat/dht_torrent.bat

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
echo off
2+
rem Test trackereditor.exe via command line.
3+
4+
rem remove all the trackers inside the torrent files
5+
6+
SETLOCAL
7+
8+
rem default variables
9+
call variables.bat
10+
11+
rem empty remove_trackers_txt
12+
echo.> %remove_trackers_txt%
13+
14+
rem empty remove_trackers_txt
15+
echo.> %add_trackers_txt%
16+
17+
rem modify the torrent folder
18+
%path_to_enduser%trackereditor.exe %path_to_torrent%
19+
20+
ENDLOCAL
21+
exit /b

source/test/bat/variables.bat

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
echo off
2+
rem Test trackereditor.exe via command line.
3+
4+
rem create default variable for the test.
5+
6+
set "path_to_enduser=..\..\..\enduser\"
7+
set "path_to_torrent=%cd%\..\torrent"
8+
set "add_trackers_txt=%path_to_enduser%add_trackers.txt"
9+
set "remove_trackers_txt=%path_to_enduser%remove_trackers.txt"
10+
11+
rem trackers
12+
set "t_a=http://a.com/announce"
13+
set "t_b=https://b.com/announce"
14+
set "t_c=udp://c.com:80/announce"
15+
set "t_d=udp://d.com:80/announce"
16+
17+
18+
set "t_m=udp://m.com:80/announce"
19+
set "t_n=udp://n.com:80/announce"
20+
set "t_o=udp://o.com:80/announce"
21+
set "t_p=udp://p.com:80/announce"
22+
23+
exit /b

0 commit comments

Comments
 (0)