core tutorial
This page shows how to call the root package and where to go instead for real
work: the root package Luna-Flow/diff_bench contains only the template
function hello.
| I want to | Use |
|---|---|
| check that the module builds and tests | @diff_bench.hello() |
| compare decimal libraries | the dzmingli_vs_floating tutorial instead |
Quick start
Inside the module, import the root package in moon.pkg:
import {
"Luna-Flow/diff_bench",
}
Then call it:
test "root package" {
let greeting = @diff_bench.hello()
inspect(greeting.length(), content="20")
inspect(greeting, content="hello from Luna-Flow")
}
Everyday tasks
There are none in this package. To compare decimal libraries, start with the
dzmingli_vs_floating tutorial or the
floating_vs_decmial_x tutorial.
Going further
The root package exists so that moon check, moon test and moon info have
a package at the source root, as in every Luna-Flow repository built from the
template. New shared helpers do not belong here: each benchmark keeps its own
copy of the neutral decimal model, as the core design
explains.
Common pitfalls
- In a blackbox test the function must be qualified:
@diff_bench.hello(). MoonBit 0.10 warns about the unqualified form.
Next steps
- core API and core design.
- The manual overview lists every package.