Skip to content

src/arithmetic.aug ​

Create a package · Source and specification

Files in this project

Code ​

aug
// aug-spec: "arithmetic.aug.md" explains this file. Read it before changes; refresh with aug spec.
/** Add two integers. @param left First value. @param right Second value. @return Their sum. */
add(int left, int right):
    return left + right
test add:
    when "addition":
        it "adds_two_integers":
            assert(add(left=2, right=3) == 5)
aug
// aug-spec: "arithmetic.aug.md" explains this file. Read it before changes; refresh with aug spec.
/** Add two integers. @param left First value. @param right Second value. @return Their sum. */
add(int left, int right) {
    return left + right
}
test add {
    when "addition" {
        it "adds_two_integers" {
            assert(add(left=2, right=3) == 5)
        }
    }
}

Compiled specification ​

Interactions and sequences

add · source ​

Add two integers. It takes left and right as integers. It returns int — Their sum. It returns left plus right. source

Checked interface
text
add(int left, int right) returns int

It takes left as an integer (First value) and right as an integer (Second value). It returns int — Their sum.

test add · source ​

Tests add. Each case gets fresh setup and dependencies.

addition ​

adds_two_integers · source ​

The test requires add with left 2 and right 3 equals 5. source

Built-in operations follow the language reference.

Last updated:

The world runs on language