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
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 intIt 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
Built-in operations follow the language reference.