Skip to content

About

Formal verification of Natural number data structures in Java using Design by Contract (DbC) — preconditions, postconditions and class invariants with Google Cofoja, tested with JUnit.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Formal Verification in Java — Design by Contract

Individual coursework for CST3110 Testing and Verification at Middlesex University (2024).

What it does

Formally verifies two Java classes using Design by Contract (DbC) principles with Google Cofoja:

  • Natural — a non-negative integer with overflow and underflow protection
  • NaturalList — a collection of Natural numbers with null safety and sorting

Contracts implemented

  • Class invariants — guarantee data is always in a valid state
  • Preconditions — block illegal inputs (null, overflow, underflow, out-of-bounds)
  • Postconditions — guarantee correct behaviour after every operation

Tests covered

  • Constructor validation (negative inputs blocked)
  • Overflow protection on increment, add, multiply
  • Underflow protection on decrement, subtract
  • Null checks on multiply, divide, push, search
  • Division by zero prevention
  • Sort and binary search correctness

Tech Stack

  • Java
  • Google Cofoja (Design by Contract)
  • JUnit
  • Eclipse

About

Formal verification of Natural number data structures in Java using Design by Contract (DbC) — preconditions, postconditions and class invariants with Google Cofoja, tested with JUnit.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages