MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / test_native

Function test_native

compiler/tests/common.rs:268–286  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

266type NativeFn = fn(&mut HeapPool, &[Val], Option<Val>) -> Result<Val, VmErr>;
267
268pub fn test_native(name: &str) -> Option<NativeBinding> {
269 let (func, pure): (NativeFn, bool) = match name {
270 "add" => (add, true),
271 "square" => (square, true),
272 "make_str" => (make_str, true),
273 "counter" => (counter, false),
274 "const_42" => (const_42, true),
275 "boom" => (boom, true),
276 "double_f" => (double_f, true),
277 "negate" => (negate, true),
278 "pick" => (pick, true),
279 "host_defer" => (host_defer, false),
280 "__const_pi" => (const_pi, true),
281 // Registered under a builtin name to assert imported natives shadow builtins.
282 "abs" => (const_42, true),
283 _ => return None,
284 };
285 Some(NativeBinding::from_fn(name, func, pure))
286}

Callers 1

build_resolverFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected