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

Function test_decimal_arithmetic_execution

tests/decimal_integration_test.rs:82–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80
81#[tokio::test]
82async fn test_decimal_arithmetic_execution() {
83 let ctx = setup_test_db().await;
84
85 // Insert test data
86 ctx.execute(
87 "INSERT INTO accounts (name, balance, credit_limit) VALUES
88 ('Alice', '1000.50', '5000.00'),
89 ('Bob', '2500.75', '10000.00')"
90 ).await.unwrap();
91
92 // Test addition - should use decimal_add
93 let result = ctx.query("SELECT balance + 100 FROM accounts").await.unwrap();
94 assert_eq!(result.rows.len(), 2);
95 // The result should be decimal calculations
96
97 // Test subtraction
98 let result = ctx.query("SELECT credit_limit - balance FROM accounts").await.unwrap();
99 assert_eq!(result.rows.len(), 2);
100
101 // Test multiplication
102 let result = ctx.query("SELECT balance * 1.05 FROM accounts").await.unwrap();
103 assert_eq!(result.rows.len(), 2);
104
105 // Test division
106 let result = ctx.query("SELECT balance / 2 FROM accounts").await.unwrap();
107 assert_eq!(result.rows.len(), 2);
108}
109
110#[tokio::test]
111async fn test_decimal_comparisons() {

Callers

nothing calls this directly

Calls 3

setup_test_dbFunction · 0.70
executeMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected