-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTEST.py
160 lines (65 loc) · 3.52 KB
/
TEST.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
from ERASER import *
import unittest
class tester(unittest.TestCase) :
def testing(self) :
TEST1 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/TEST.txt"
SOLUTION1 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/SOLUTION.txt"
TEST2 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/2/TEST.txt"
SOLUTION2 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/2/SOLUTION.txt"
TEST3 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/3/TEST.txt"
SOLUTION3 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/3/SOLUTION.txt"
TEST4 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/4/TEST.txt"
SOLUTION4 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/4/SOLUTION.txt"
# test ip killer
Result = "result"
Result_txt = Result + ".txt"
Result1 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1"
Result2 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/2"
Result3 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/3"
Result4 = "C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/4"
Filepath1 = Result1 + "/" + Result_txt
Filepath2 = Result2 + "/" + Result_txt
Filepath3 = Result3 + "/" + Result_txt
Filepath4 = Result4 + "/" + Result_txt
# Test is_texte_filepath
self.assertEqual(ERASER.is_texte_filepath("dogbogberi.txt") , False, "Unexisting file detected")
self.assertEqual(ERASER.is_texte_filepath("C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/TEST.txt") , True, "Unexisting file detected")
self.assertEqual(ERASER.is_texte_filepath("C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/TEST.") , False, "Unexisting file detected")
self.assertEqual(ERASER.is_texte_filepath("C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/TEST.tx") , False, "Unexisting file detected")
self.assertEqual(ERASER.is_texte_filepath("C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/TEST.TXT") , False, "Unexisting file detected")
self.assertEqual(ERASER.is_texte_filepath("C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/TES.txt") , False, "Unexisting file detected")
# test txt_to_string
self.assertEqual(ERASER.txt_to_string(TEST3),"""wognberw
defbvfde
ds
asgv
asgv
sfasdfsadf
asdfsadfsadf
sascs
asdfsadfsadffas
f
sascsdf
""", "Unreadable content" )
self.assertEqual(ERASER.txt_to_string(TEST2), """192.198.30.1
233.198.30.2
192.198.30.1sgswfe
192.198.30.1192.198.30.1
svwbfowe
svs
aadfasd
zczcx192.198.30.1wf
192.198.30.1""", "Unreadeble content")
self.assertEqual(ERASER.txt_to_string("C:/Users/nicol/OneDrive/Bureau/IP_KILLER/TEST/1/TEST.txt"), """192.00.00.000
Je veux manger des patates1905435.55.43.2
""", "Unreadable content")
ERASER.ip_killer(TEST1, Result1, Result)
ERASER.ip_killer(TEST2, Result2, Result)
ERASER.ip_killer(TEST3, Result3, Result)
ERASER.ip_killer(TEST4, Result4, Result)
self.assertEqual(ERASER.txt_to_string(Filepath1), ERASER.txt_to_string(SOLUTION1), "The solution 1 is not equal")
self.assertEqual(ERASER.txt_to_string(Filepath2), ERASER.txt_to_string(SOLUTION2), "The solution 2 is not equal")
self.assertEqual(ERASER.txt_to_string(Filepath3), ERASER.txt_to_string(SOLUTION3), "The solution 3 is not equal")
self.assertEqual(ERASER.txt_to_string(Filepath4), ERASER.txt_to_string(SOLUTION4), "The solution 4 is not equal")
if __name__ == '__main__' :
unittest.main()