MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / test_count

Function test_count

crates/core/src/sql/execute.rs:403–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

401
402 #[test]
403 fn test_count() -> ResultTest<()> {
404 let (db, _) = create_data(5)?;
405
406 let sql = "SELECT count(*) as n FROM inventory";
407 let result = run_for_testing(&db, sql)?;
408 assert_eq!(result, vec![product![5u64]], "Inventory");
409
410 let sql = "SELECT count(*) as n FROM inventory limit 2";
411 let result = run_for_testing(&db, sql)?;
412 assert_eq!(result, vec![product![5u64]], "Inventory");
413
414 let sql = "SELECT count(*) as n FROM inventory WHERE inventory_id = 4 or inventory_id = 5";
415 let result = run_for_testing(&db, sql)?;
416 assert_eq!(result, vec![product![2u64]], "Inventory");
417 Ok(())
418 }
419
420 /// Test the evaluation of SELECT, UPDATE, and DELETE parameterized with `:sender`
421 #[test]

Callers

nothing calls this directly

Calls 3

create_dataFunction · 0.85
run_for_testingFunction · 0.85
OkFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…