Skip to the content.

IPv4 Subnet Calculator Multilang

One IPv4/CIDR specification, three implementations, one shared contract-test suite.

View repository · View CI · Read the full README · DataTideHH portfolio


Project purpose

This project compares how a clearly bounded networking calculation can be implemented and verified in Java 21, C++20 and Python 3.12.

The deliberately narrow scope makes the comparison credible:

The project connects programming fundamentals, test design and practical IPv4 subnetting without presenting a small calculator as a production network platform.


Implementations

Implementation Structure Verification Status
Java 21 Single application class with a record result Plain Java CLI contract runner Implemented and tested
C++20 Header, calculation module and terminal entry point CTest contract executable plus CLI smoke script Implemented and tested
Python 3.12 Single module with a frozen, slotted dataclass Standard-library unittest plus subprocess checks Implemented and tested

All three versions share the same input contract, output fields, validation categories, special-case behavior and exit rules.


Example

Input:

192.168.10.42/24

Output:

Input IP:          192.168.10.42
CIDR prefix:       /24
Subnet mask:       255.255.255.0
Wildcard mask:     0.0.0.255
Network address:   192.168.10.0
Broadcast address: 192.168.10.255
Total addresses:   256
Usable hosts:      254
First usable host: 192.168.10.1
Last usable host:  192.168.10.254
Note:              Standard subnet with network and broadcast addresses excluded.

The complete normative rules are documented in the behavior specification.

The /0 output is a mathematical calculation over the complete 32-bit IPv4 address space. It is not a claim that all reported addresses are globally assignable to hosts.


Shared verification

Every language-specific runner reads the same tab-separated contract file.

The current contract contains seven valid and sixteen invalid cases covering:

Valid cases verify every result field. Invalid cases verify the exact validation reason.

Every implementation also has CLI smoke coverage for:

Read Testing and CI for commands and design details.


GitHub Actions

The repository runs three independent checks on pull requests and pushes to main:

Separate jobs make failures easy to locate and provide stable status checks for protected-branch rules. The workflow uses read-only permissions, current official action major versions and per-job timeouts.


Run examples

Java

javac -d java/out java/src/SubnetCalculator.java
java -cp java/out SubnetCalculator 192.168.10.42/24

C++

cmake -S cpp -B cpp/build
cmake --build cpp/build --config Release

Python

python python/subnet_calculator.py 192.168.10.42/24

Standards and learning references


Together, the projects show a controlled learning progression across networking fundamentals, multi-language implementation, automated verification and backend structure.


Scope limits

The project intentionally excludes IPv6, VLSM planning, subnet splitting, a GUI, a web frontend, persistence, exports and external CLI frameworks.

These limits keep the source understandable and the cross-language comparison direct.


Portfolio assessment

The strongest signal is not the calculator alone. It is the disciplined workflow around it:

That makes the repository a credible supporting project for a Data/BI and process-analysis portfolio with additional networking and software-engineering foundations.