tests/native_test.oxl
use super.native { hypot, absolute, sortInts }
test "hypot uses libm" {
assert_eq(hypot(3.0, 4.0), 5.0)
}
test "abs uses libc" {
assert_eq(absolute(-17), 17)
assert_eq(absolute(5), 5)
}
test "qsort sorts through the exported comparator" {
var xs: List<i32> = [5, 3, 9, -1, 7, 0]
sortInts(&var xs)
assert_eq(xs, [-1, 0, 3, 5, 7, 9])
}Исходник: examples/ffi-demo/tests/native_test.oxl