Testing

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

x = 6 | y = 6

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

x = 6 | y = -6

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

Branch Coverage

  • x = 6 | y = 6 -> Branches 1 & 4
  • x = 6 | y = -6 -> Branches 2 & 3

x = 12 | y = 0

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

x = 4 | y = 4

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

Path Coverage

  • x = 6 | y = 6 -> Branches 1 & 4
  • x = 6 | y = -6 -> Branches 2 & 3
  • x = 12 | y = 0 -> Branches 1 & 3
  • x = 4 | y = 4 -> Branches 2 & 4

Edge Cases

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

x = 10 | y = 0

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

x = 11 | y = 0

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

x = 9 | y = 0

x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
if x + y > 10:
  print("Branch 1")
else:
  print("Branch 2")
if x - y > 10:
  print("Branch 3")
else:
  print("Branch 4")

Path Coverage

  • x = 6 | y = 6 -> Branches 1 & 4
  • x = 6 | y = -6 -> Branches 2 & 3
  • x = 12 | y = 0 -> Branches 1 & 3
  • x = 4 | y = 4 -> Branches 2 & 4

Edge Cases

  • x = 9 | y = 0 -> False
  • x = 10 | y = 0 -> False
  • x = 11 | y = 0 -> True

Testing

a = int(input("Enter a number: "))
b = int(input("Enter a number: "))
if a // b >= 5:
		# Branch 1
		print(f"{b} goes into {a} at least 5 times")
else:
		# Branch 2
		print(f"{a} is less than 5 times {b}")
if a % b == 0:
		# Branch 3
		print(f"{b} evenly divides {a}")
else:
		# Branch 4
		print(f"{a} / {b} has a remainder")

a = 25 | b = 5

a = int(input("Enter a number: "))
b = int(input("Enter a number: "))
if a // b >= 5:
		# Branch 1
		print(f"{b} goes into {a} at least 5 times")
else:
		# Branch 2
		print(f"{a} is less than 5 times {b}")
if a % b == 0:
		# Branch 3
		print(f"{b} evenly divides {a}")
else:
		# Branch 4
		print(f"{a} / {b} has a remainder")

a = 21 | b = 5

a = int(input("Enter a number: "))
b = int(input("Enter a number: "))
if a // b >= 5:
		# Branch 1
		print(f"{b} goes into {a} at least 5 times")
else:
		# Branch 2
		print(f"{a} is less than 5 times {b}")
if a % b == 0:
		# Branch 3
		print(f"{b} evenly divides {a}")
else:
		# Branch 4
		print(f"{a} / {b} has a remainder")

Branch Coverage

  • a = 25 | b = 5 -> Branches 1 & 3
  • a = 21 | b = 5 -> Branches 2 & 4

a = 31 | b = 5

a = int(input("Enter a number: "))
b = int(input("Enter a number: "))
if a // b >= 5:
		# Branch 1
		print(f"{b} goes into {a} at least 5 times")
else:
		# Branch 2
		print(f"{a} is less than 5 times {b}")
if a % b == 0:
		# Branch 3
		print(f"{b} evenly divides {a}")
else:
		# Branch 4
		print(f"{a} / {b} has a remainder")

a = 20 | b = 5

a = int(input("Enter a number: "))
b = int(input("Enter a number: "))
if a // b >= 5:
		# Branch 1
		print(f"{b} goes into {a} at least 5 times")
else:
		# Branch 2
		print(f"{a} is less than 5 times {b}")
if a % b == 0:
		# Branch 3
		print(f"{b} evenly divides {a}")
else:
		# Branch 4
		print(f"{a} / {b} has a remainder")

Path Coverage

  • a = 25 | b = 5 -> Branches 1 & 3
  • a = 21 | b = 5 -> Branches 2 & 4
  • a = 31 | b = 5 -> Branches 1 & 4
  • a = 20 | b = 5 -> Branches 2 & 3

Edge Cases

a = int(input("Enter a number: "))
b = int(input("Enter a number: "))
if a // b >= 5:
		# Branch 1
		print(f"{b} goes into {a} at least 5 times")
else:
		# Branch 2
		print(f"{a} is less than 5 times {b}")
if a % b == 0:
		# Branch 3
		print(f"{b} evenly divides {a}")
else:
		# Branch 4
		print(f"{a} / {b} has a remainder")

Path Coverage & Edge Cases

  • a = 25 | b = 5 -> Branches 1 & 3
  • a = 21 | b = 5 -> Branches 2 & 4
  • a = 31 | b = 5 -> Branches 1 & 4
  • a = 20 | b = 5 -> Branches 2 & 3