Skip to content

Commit 6e9ff4a

Browse files
committed
docs(tests): standardize assertion count comment style
Replace terse "9 assertions" comments with descriptive format: "9 assertions: reflexive, transitive, and antisymmetric comparison properties" This makes it clear what the assertion group is testing, improving code readability and maintainability. Addresses FINAL_CODE_REVIEW.md recommendation #7 (P4).
1 parent 5cfa159 commit 6e9ff4a

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

tests/sqlx/tests/operator_compare_tests.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ use sqlx::PgPool;
99
// Helper macro to reduce repetition for compare tests
1010
macro_rules! assert_compare {
1111
($pool:expr, $sql_a:expr, $sql_b:expr, $expected:expr, $msg:expr) => {
12-
let result: i32 = sqlx::query_scalar(&format!(
13-
"SELECT eql_v2.compare({}, {})",
14-
$sql_a, $sql_b
15-
))
16-
.fetch_one($pool)
17-
.await?;
12+
let result: i32 =
13+
sqlx::query_scalar(&format!("SELECT eql_v2.compare({}, {})", $sql_a, $sql_b))
14+
.fetch_one($pool)
15+
.await?;
1816
assert_eq!(result, $expected, $msg);
1917
};
2018
}
@@ -30,7 +28,7 @@ async fn compare_ore_cllw_var_8_hello_path(pool: PgPool) -> Result<()> {
3028
let b = "eql_v2.jsonb_path_query(create_encrypted_ste_vec_json(2), 'd90b97b5207d30fe867ca816ed0fe4a7')";
3129
let c = "eql_v2.jsonb_path_query(create_encrypted_ste_vec_json(3), 'd90b97b5207d30fe867ca816ed0fe4a7')";
3230

33-
// 9 assertions
31+
// 9 assertions: reflexive, transitive, and antisymmetric comparison properties
3432
assert_compare!(&pool, a, a, 0, "compare(a, a) should equal 0");
3533
assert_compare!(&pool, a, b, -1, "compare(a, b) should equal -1");
3634
assert_compare!(&pool, a, c, -1, "compare(a, c) should equal -1");
@@ -55,7 +53,7 @@ async fn compare_ore_cllw_var_8_number_path(pool: PgPool) -> Result<()> {
5553
let b = "eql_v2.jsonb_path_query(create_encrypted_ste_vec_json(5), '3dba004f4d7823446e7cb71f6681b344')";
5654
let c = "eql_v2.jsonb_path_query(create_encrypted_ste_vec_json(10), '3dba004f4d7823446e7cb71f6681b344')";
5755

58-
// 9 assertions
56+
// 9 assertions: reflexive, transitive, and antisymmetric comparison properties
5957
assert_compare!(&pool, a, a, 0, "compare(a, a) should equal 0");
6058
assert_compare!(&pool, a, b, -1, "compare(a, b) should equal -1");
6159
assert_compare!(&pool, a, c, -1, "compare(a, c) should equal -1");
@@ -78,7 +76,7 @@ async fn compare_ore_block_u64_8_256(pool: PgPool) -> Result<()> {
7876
let b = "create_encrypted_ore_json(21)";
7977
let c = "create_encrypted_ore_json(42)";
8078

81-
// 9 assertions
79+
// 9 assertions: reflexive, transitive, and antisymmetric comparison properties
8280
assert_compare!(&pool, a, a, 0, "compare(a, a) should equal 0");
8381
assert_compare!(&pool, a, b, -1, "compare(a, b) should equal -1");
8482
assert_compare!(&pool, a, c, -1, "compare(a, c) should equal -1");
@@ -101,7 +99,7 @@ async fn compare_blake3_index(pool: PgPool) -> Result<()> {
10199
let b = "create_encrypted_json(2, 'b3')";
102100
let c = "create_encrypted_json(3, 'b3')";
103101

104-
// 9 assertions
102+
// 9 assertions: reflexive, transitive, and antisymmetric comparison properties
105103
assert_compare!(&pool, a, a, 0, "compare(a, a) should equal 0");
106104
assert_compare!(&pool, a, b, -1, "compare(a, b) should equal -1");
107105
assert_compare!(&pool, a, c, -1, "compare(a, c) should equal -1");
@@ -124,7 +122,7 @@ async fn compare_hmac_256_index(pool: PgPool) -> Result<()> {
124122
let b = "create_encrypted_json(2, 'hm')";
125123
let c = "create_encrypted_json(3, 'hm')";
126124

127-
// 9 assertions
125+
// 9 assertions: reflexive, transitive, and antisymmetric comparison properties
128126
assert_compare!(&pool, a, a, 0, "compare(a, a) should equal 0");
129127
assert_compare!(&pool, a, b, -1, "compare(a, b) should equal -1");
130128
assert_compare!(&pool, a, c, -1, "compare(a, c) should equal -1");
@@ -147,7 +145,7 @@ async fn compare_no_index_terms(pool: PgPool) -> Result<()> {
147145
let b = "'{\"b\": 2}'::jsonb::eql_v2_encrypted";
148146
let c = "'{\"c\": 3}'::jsonb::eql_v2_encrypted";
149147

150-
// 9 assertions
148+
// 9 assertions: reflexive, transitive, and antisymmetric comparison properties
151149
assert_compare!(&pool, a, a, 0, "compare(a, a) should equal 0");
152150
assert_compare!(&pool, a, b, -1, "compare(a, b) should equal -1");
153151
assert_compare!(&pool, a, c, -1, "compare(a, c) should equal -1");
@@ -175,7 +173,7 @@ async fn compare_hmac_with_null_ore_index(pool: PgPool) -> Result<()> {
175173
let b = "('{\"ob\": null}'::jsonb || create_encrypted_json(2, 'hm')::jsonb)::eql_v2_encrypted";
176174
let c = "('{\"ob\": null}'::jsonb || create_encrypted_json(3, 'hm')::jsonb)::eql_v2_encrypted";
177175

178-
// 9 assertions
176+
// 9 assertions: reflexive, transitive, and antisymmetric comparison properties
179177
assert_compare!(&pool, a, a, 0, "compare(a, a) should equal 0");
180178
assert_compare!(&pool, a, b, -1, "compare(a, b) should equal -1");
181179
assert_compare!(&pool, a, c, -1, "compare(a, c) should equal -1");

0 commit comments

Comments
 (0)