Skip to content

Instantly share code, notes, and snippets.

@michmzr
Last active February 3, 2023 11:35
Show Gist options
  • Save michmzr/f83e095b48dc030ed2a9d66d9d30689b to your computer and use it in GitHub Desktop.
Save michmzr/f83e095b48dc030ed2a9d66d9d30689b to your computer and use it in GitHub Desktop.
komunikacja
Scenario Outline: Convert IP address range to CIDR notation
Given a range of IP addresses "<start_ip>" to "<end_ip>"
When I convert the IP address range to CIDR notation
Then the CIDR notation should be "<cidr_notation>"
Examples:
| start_ip | end_ip | cidr_notation |
| 192.168.0.1 | 192.168.0.5 | 192.168.0.1/31 |
| 10.0.0.0 | 10.0.0.255 | 10.0.0.0/24 |
| 172.16.0.0 | 172.31.255.255 | 172.16.0.0/12 |
| 198.51.100.1 | 198.51.100.15 | 198.51.100.1/28 |
| 100.64.0.0 | 100.127.255.255 | 100.64.0.0/10 |
Scenario Outline: Error handling for invalid IP address range
Given a range of IP addresses "<start_ip>" to "<end_ip>"
When I convert the IP address range to CIDR notation
Then the result should be an error message "Invalid IP address range"
Examples:
| start_ip | end_ip |
| 192.168.0.5 | 192.168.0.1 |
| 10.0.0.255 | 10.0.0.0 |
| 198.51.100.15 | 198.51.100.1 |
Feature: Convert IP Address Ranges to CIDR Notation
As a user, I want to be able to convert IP address ranges to CIDR notation, so that I can easily understand the subnet structure of a network.
Scenario: Convert single IP address to CIDR notation
Given the IP address range "192.168.1.1"
When I convert the range to CIDR notation
Then I should see "192.168.1.1/32" as the result
Scenario: Convert multiple IP addresses to CIDR notation
Given the IP address range "192.168.1.1-192.168.1.5"
When I convert the range to CIDR notation
Then I should see "192.168.1.1/31" as the result
Scenario: Convert large IP address range to CIDR notation
Given the IP address range "192.168.1.0-192.168.100.255"
When I convert the range to CIDR notation
Then I should see "192.168.1.0/16" as the result
Scenario: Convert IP address range with non-contiguous IP addresses
Given the IP address range "192.168.1.1, 192.168.2.5, 192.168.3.9"
When I convert the range to CIDR notation
Then I should see "192.168.1.1/32, 192.168.2.5/32, 192.168.3.9/32" as the result
Scenario: Handle invalid IP address range input
Given the IP address range "192.168.256.1"
When I convert the range to CIDR notation
Then I should see an error message indicating that the input is invalid.
Input Value Expected Output
192.168.0.0/255.255.255.0 192.168.0.0/24
10.0.0.0/255.0.0.0 10.0.0.0/8
172.16.0.0/255.240.0.0 172.16.0.0/12
192.168.100.0/255.255.255.0 192.168.100.0/24
100.64.0.0/255.192.0.0 100.64.0.0/10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment