MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / array_length_function

Function array_length_function

nodedb/tests/executor_tests/test_array_ops.rs:238–248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

236
237#[test]
238fn array_length_function() {
239 // Test via expression evaluator directly.
240 let expr = nodedb_query::expr_parse::parse_generated_expr("array_length(tags)")
241 .unwrap()
242 .0;
243 let doc = nodedb_types::Value::from(serde_json::json!({"tags": ["a", "b", "c"]}));
244 assert_eq!(expr.eval(&doc), nodedb_types::Value::Integer(3));
245
246 let doc2 = nodedb_types::Value::from(serde_json::json!({"tags": []}));
247 assert_eq!(expr.eval(&doc2), nodedb_types::Value::Integer(0));
248}
249
250#[test]
251fn array_append_function() {

Callers

nothing calls this directly

Calls 1

parse_generated_exprFunction · 0.85

Tested by

no test coverage detected