packages/@example/aug-math/0.1.0/arithmetic.aug
Use a package · Dependency source and specification
This is the exact dependency version used by this example.
Code
aug
// Generated by aug spec. This is a copy of the installed dependency source.
// 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
// Generated by aug spec. This is a copy of the installed dependency source.
// 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.