Skip to main content

add

Function add 

Source
pub const fn add(left: u64, right: u64) -> u64
Expand description

Adds two numbers together.

This is a simple example function demonstrating the testing framework.

§Examples

use certeza::add;

assert_eq!(add(2, 2), 4);
assert_eq!(add(0, 0), 0);
assert_eq!(add(1, 1), 2);

§Properties

This function satisfies several mathematical properties:

  • Commutativity: add(a, b) == add(b, a)
  • Associativity: add(add(a, b), c) == add(a, add(b, c))
  • Identity: add(a, 0) == a