Skip to content

Commit 026add7

Browse files
authored
added test cases to check for invalid octets and leading zeroes
1 parent 4cee781 commit 026add7

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

numb3rs/__init__.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ def test_incorrect_out_of_range2():
5555
output = "False"
5656
check50.run("python3 testing.py").stdin(input, prompt=True).stdout(output).exit(0)
5757

58-
58+
5959
@check50.check(exists)
6060
def test_incorrect_number_bytes():
6161
"""numb3rs.py prints False for 8.8.8"""
6262
input = "8.8.8"
6363
output = "False"
6464
check50.run("python3 testing.py").stdin(input, prompt=True).stdout(output).exit(0)
65-
65+
6666

6767
@check50.check(exists)
6868
def test_incorrect_number_bytes2():
@@ -88,6 +88,22 @@ def test_non_ip():
8888
check50.run("python3 testing.py").stdin(input, prompt=True).stdout(output).exit(0)
8989

9090

91+
@check50.check(exists)
92+
def test_invalid_octet():
93+
"""numb3rs.py prints False for 1.1.1.11111"""
94+
input = "1.1.1.11111"
95+
output = "False"
96+
check50.run("python3 testing.py").stdin(input, prompt=True).stdout(output).exit(0)
97+
98+
99+
@check50.check(exists)
100+
def test_leading_zero():
101+
"""numb3rs.py prints False for 000.001.010.100"""
102+
input = "000.000.001.010"
103+
output = "False"
104+
check50.run("python3 testing.py").stdin(input, prompt=True).stdout(output).exit(0)
105+
106+
91107
"""
92108
test_numb3rs.py checks
93109
"""

0 commit comments

Comments
 (0)