File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1111 bigdecimal (3.1.8 )
1212 minitest (5.25.4 )
1313 mysql2 (0.5.6 )
14- rake (13.0 .1 )
14+ rake (13.3 .1 )
1515 rake-compiler (1.0.7 )
1616 rake
1717
Original file line number Diff line number Diff line change @@ -128,7 +128,12 @@ def test_trilogy_query_values_vs_query_allocations
128128 query_allocations = allocations { client . query_with_flags ( sql , client . query_flags ) }
129129 flatten_rows_allocations = allocations { client . query_with_flags ( sql , client . query_flags | Trilogy ::QUERY_FLAGS_FLATTEN_ROWS ) }
130130
131- assert_equal query_allocations - row_count , flatten_rows_allocations
131+ # Verify O(1) allocations for flatten_rows (constant overhead)
132+ assert_operator flatten_rows_allocations , :<= , 20
133+
134+ # Verify O(N) allocations for standard query (linear scaling with row count)
135+ # The overhead should be roughly similar to flatten_rows, so they should differ by row_count.
136+ assert_in_delta query_allocations , row_count + flatten_rows_allocations , 20
132137 end
133138
134139 def test_trilogy_more_results_exist?
@@ -1150,12 +1155,15 @@ def test_error_classes_exclusively_match_subclasses
11501155 end
11511156
11521157 if defined? ( ::Ractor )
1158+ # Remove this when support for Ruby 3.x is dropped
1159+ class ::Ractor ; alias value take unless method_defined? ( :value ) ; end
1160+
11531161 def test_is_ractor_compatible
11541162 ractor = Ractor . new do
11551163 client = TrilogyTest . new ( nil ) . new_tcp_client
11561164 client . query ( "SELECT 1" )
11571165 end
1158- assert_equal [ [ 1 ] ] , ractor . take . to_a
1166+ assert_equal [ [ 1 ] ] , ractor . value . to_a
11591167 end
11601168 end
11611169
You can’t perform that action at this time.
0 commit comments