last error remaining
This commit is contained in:
@@ -91,7 +91,7 @@ async fn create_initial_record(
|
||||
// Set different initial values based on the test case to satisfy validation scripts
|
||||
match (profile_name, table_name) {
|
||||
("test_put_complex", "order") => {
|
||||
// For complex formula: (+ (* @price @quantity) (* (* @price @quantity) 0.08))
|
||||
// For complex formula: (+ (* $price $quantity) (* (* $price $quantity) 0.08))
|
||||
// With price=10.00, quantity=1: (10*1) + (10*1*0.08) = 10 + 0.8 = 10.8
|
||||
data.insert("price".to_string(), ProtoValue { kind: Some(Kind::StringValue("10.00".to_string())) });
|
||||
data.insert("quantity".to_string(), ProtoValue { kind: Some(Kind::NumberValue(1.0)) });
|
||||
@@ -99,7 +99,7 @@ async fn create_initial_record(
|
||||
data.insert("percentage".to_string(), ProtoValue { kind: Some(Kind::StringValue("100.00".to_string())) });
|
||||
},
|
||||
("test_put_division", "calculation") => {
|
||||
// For division: (/ @total @price)
|
||||
// For division: (/ $total $price)
|
||||
// With total=10.00, price=10.00: 10/10 = 1
|
||||
data.insert("price".to_string(), ProtoValue { kind: Some(Kind::StringValue("10.00".to_string())) });
|
||||
data.insert("quantity".to_string(), ProtoValue { kind: Some(Kind::NumberValue(1.0)) });
|
||||
@@ -142,7 +142,7 @@ async fn test_put_basic_arithmetic_validation_success(pool: PgPool) {
|
||||
let script_request = PostTableScriptRequest {
|
||||
table_definition_id: table_def_id,
|
||||
target_column: "total".to_string(),
|
||||
script: "(* @price @quantity)".to_string(),
|
||||
script: "(* $price $quantity)".to_string(),
|
||||
description: "Total = Price × Quantity".to_string(),
|
||||
};
|
||||
post_table_script(&pool, script_request).await.unwrap();
|
||||
@@ -180,7 +180,7 @@ async fn test_put_basic_arithmetic_validation_failure(pool: PgPool) {
|
||||
let script_request = PostTableScriptRequest {
|
||||
table_definition_id: table_def_id,
|
||||
target_column: "total".to_string(),
|
||||
script: "(* @price @quantity)".to_string(),
|
||||
script: "(* $price $quantity)".to_string(),
|
||||
description: "Total = Price × Quantity".to_string(),
|
||||
};
|
||||
post_table_script(&pool, script_request).await.unwrap();
|
||||
@@ -224,7 +224,7 @@ async fn test_put_complex_formula_validation(pool: PgPool) {
|
||||
let script_request = PostTableScriptRequest {
|
||||
table_definition_id: table_def_id,
|
||||
target_column: "total".to_string(),
|
||||
script: "(+ (* @price @quantity) (* (* @price @quantity) 0.08))".to_string(),
|
||||
script: "(+ (* $price $quantity) (* (* $price $quantity) 0.08))".to_string(),
|
||||
description: "Total with 8% tax".to_string(),
|
||||
};
|
||||
post_table_script(&pool, script_request).await.unwrap();
|
||||
@@ -261,7 +261,7 @@ async fn test_put_division_with_precision(pool: PgPool) {
|
||||
let script_request = PostTableScriptRequest {
|
||||
table_definition_id: table_def_id,
|
||||
target_column: "percentage".to_string(),
|
||||
script: "(/ @total @price)".to_string(),
|
||||
script: "(/ $total $price)".to_string(),
|
||||
description: "Percentage = Total / Price".to_string(),
|
||||
};
|
||||
post_table_script(&pool, script_request).await.unwrap();
|
||||
@@ -326,7 +326,7 @@ async fn test_put_advanced_math_functions(pool: PgPool) {
|
||||
let sqrt_script = PostTableScriptRequest {
|
||||
table_definition_id: table_row.id,
|
||||
target_column: "square_root".to_string(),
|
||||
script: "(sqrt @input)".to_string(),
|
||||
script: "(sqrt $input)".to_string(),
|
||||
description: "Square root validation".to_string(),
|
||||
};
|
||||
post_table_script(&pool, sqrt_script).await.unwrap();
|
||||
@@ -334,7 +334,7 @@ async fn test_put_advanced_math_functions(pool: PgPool) {
|
||||
let power_script = PostTableScriptRequest {
|
||||
table_definition_id: table_row.id,
|
||||
target_column: "power_result".to_string(),
|
||||
script: "(^ @input 2.0)".to_string(),
|
||||
script: "(^ $input 2.0)".to_string(),
|
||||
description: "Power function validation".to_string(),
|
||||
};
|
||||
post_table_script(&pool, power_script).await.unwrap();
|
||||
@@ -389,7 +389,7 @@ async fn test_put_financial_calculations(pool: PgPool) {
|
||||
let compound_script = PostTableScriptRequest {
|
||||
table_definition_id: table_row.id,
|
||||
target_column: "compound_result".to_string(),
|
||||
script: "(* @principal (^ (+ 1.0 @rate) @time))".to_string(),
|
||||
script: "(* $principal (^ (+ 1.0 $rate) $time))".to_string(),
|
||||
description: "Compound interest calculation".to_string(),
|
||||
};
|
||||
post_table_script(&pool, compound_script).await.unwrap();
|
||||
@@ -397,7 +397,7 @@ async fn test_put_financial_calculations(pool: PgPool) {
|
||||
let percentage_script = PostTableScriptRequest {
|
||||
table_definition_id: table_row.id,
|
||||
target_column: "percentage_result".to_string(),
|
||||
script: "(* @principal @rate)".to_string(),
|
||||
script: "(* $principal $rate)".to_string(),
|
||||
description: "Percentage calculation".to_string(),
|
||||
};
|
||||
post_table_script(&pool, percentage_script).await.unwrap();
|
||||
@@ -441,7 +441,7 @@ async fn test_put_partial_update_with_validation(pool: PgPool) {
|
||||
let script_request = PostTableScriptRequest {
|
||||
table_definition_id: table_def_id,
|
||||
target_column: "total".to_string(),
|
||||
script: "(* @price @quantity)".to_string(),
|
||||
script: "(* $price $quantity)".to_string(),
|
||||
description: "Total = Price × Quantity".to_string(),
|
||||
};
|
||||
post_table_script(&pool, script_request).await.unwrap();
|
||||
@@ -553,7 +553,7 @@ async fn test_put_steel_script_error_handling(pool: PgPool) {
|
||||
let script_request = PostTableScriptRequest {
|
||||
table_definition_id: table_def_id,
|
||||
target_column: "total".to_string(),
|
||||
script: "(/ @price 0.0)".to_string(),
|
||||
script: "(/ $price 0.0)".to_string(),
|
||||
description: "Error test".to_string(),
|
||||
};
|
||||
post_table_script(&pool, script_request).await.unwrap();
|
||||
@@ -623,7 +623,7 @@ async fn test_decimal_precision_behavior(pool: PgPool) {
|
||||
let script_request = PostTableScriptRequest {
|
||||
table_definition_id: table_row.id,
|
||||
target_column: "result".to_string(),
|
||||
script: "(/ @dividend @divisor)".to_string(),
|
||||
script: "(/ $dividend $divisor)".to_string(),
|
||||
description: "Division test for precision".to_string(),
|
||||
};
|
||||
post_table_script(&pool, script_request).await.unwrap();
|
||||
@@ -816,7 +816,7 @@ async fn test_put_complex_formula_validation_via_handlers(pool: PgPool) {
|
||||
"test_put_complex_handlers",
|
||||
"order",
|
||||
"total",
|
||||
"(+ (* @price @quantity) (* (* @price @quantity) 0.08))", // Total with 8% tax
|
||||
"(+ (* $price $quantity) (* (* $price $quantity) 0.08))", // Total with 8% tax
|
||||
)
|
||||
.await
|
||||
.expect("Failed to add validation script");
|
||||
@@ -891,7 +891,7 @@ async fn test_put_basic_arithmetic_validation_via_handlers(pool: PgPool) {
|
||||
"test_put_arithmetic_handlers",
|
||||
"invoice",
|
||||
"total",
|
||||
"(* @price @quantity)", // Simple: Total = Price × Quantity
|
||||
"(* $price $quantity)", // Simple: Total = Price × Quantity
|
||||
)
|
||||
.await
|
||||
.expect("Failed to add validation script");
|
||||
@@ -955,7 +955,7 @@ async fn test_put_arithmetic_validation_failure_via_handlers(pool: PgPool) {
|
||||
"test_put_arithmetic_fail_handlers",
|
||||
"invoice",
|
||||
"total",
|
||||
"(* @price @quantity)",
|
||||
"(* $price $quantity)",
|
||||
)
|
||||
.await
|
||||
.expect("Failed to add validation script");
|
||||
|
||||
Reference in New Issue
Block a user