MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_decimal_aggregates

Function test_decimal_aggregates

tests/decimal_integration_test.rs:136–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135#[tokio::test]
136async fn test_decimal_aggregates() {
137 let ctx = setup_test_db().await;
138
139 // Insert test data
140 ctx.execute(
141 "INSERT INTO transactions (account_id, amount, fee, type) VALUES
142 (1, '100.00', '2.50', 'deposit'),
143 (1, '50.25', '1.25', 'deposit'),
144 (1, '75.50', '1.50', 'withdrawal'),
145 (2, '200.00', '5.00', 'deposit')"
146 ).await.unwrap();
147
148 // Test SUM
149 let result = ctx.query("SELECT SUM(amount) FROM transactions WHERE account_id = 1").await.unwrap();
150 assert_eq!(result.rows.len(), 1);
151
152 // Test AVG
153 let result = ctx.query("SELECT AVG(fee) FROM transactions").await.unwrap();
154 assert_eq!(result.rows.len(), 1);
155
156 // Test MIN/MAX
157 let result = ctx.query("SELECT MIN(amount), MAX(amount) FROM transactions").await.unwrap();
158 assert_eq!(result.rows.len(), 1);
159}
160
161#[tokio::test]
162async fn test_complex_decimal_queries() {

Callers

nothing calls this directly

Calls 3

setup_test_dbFunction · 0.70
executeMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected