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

Function test_complex_decimal_queries

tests/decimal_integration_test.rs:162–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160
161#[tokio::test]
162async fn test_complex_decimal_queries() {
163 let ctx = setup_test_db().await;
164
165 // Insert test data
166 ctx.execute(
167 "INSERT INTO accounts (id, name, balance, credit_limit) VALUES
168 (1, 'Account1', '1000.00', '5000.00'),
169 (2, 'Account2', '2000.00', '10000.00')"
170 ).await.unwrap();
171
172 ctx.execute(
173 "INSERT INTO transactions (account_id, amount, fee) VALUES
174 (1, '100.00', '2.50'),
175 (1, '200.00', '5.00'),
176 (2, '150.00', '3.75')"
177 ).await.unwrap();
178
179 // Complex join with calculations
180 let result = ctx.query(
181 "SELECT a.name, a.balance + SUM(t.amount) - SUM(t.fee) as new_balance
182 FROM accounts a
183 JOIN transactions t ON a.id = t.account_id
184 GROUP BY a.id, a.name, a.balance"
185 ).await.unwrap();
186
187 // The query should execute without errors
188 assert!(!result.rows.is_empty());
189}
190
191#[tokio::test]
192async fn test_update_with_decimal_operations() {

Callers

nothing calls this directly

Calls 3

setup_test_dbFunction · 0.70
executeMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected