@@ -311,7 +311,7 @@ g.test_unicode_collation = function()
311311 types = {' string' , ' string' , ' string' , ' number' },
312312 early_exit_is_possible = false ,
313313 values_opts = {
314- {collation = ' unicode_ci ' },
314+ {collation = ' unicode ' },
315315 {collation = ' unicode_ci' },
316316 {collation = ' unicode_ci' },
317317 }
@@ -332,7 +332,7 @@ return true, false]]
332332 local expected_library_code = [[ local M = {}
333333
334334function M.eq_1(field_1, field_2, field_3, field_4)
335- return (eq_unicode_ci (field_1, "A") and eq_unicode_ci(field_2, "Á") and eq_unicode_ci(field_3, "Ä") and eq(field_4, 6))
335+ return (eq_unicode (field_1, "A") and eq_unicode_ci(field_2, "Á") and eq_unicode_ci(field_3, "Ä") and eq(field_4, 6))
336336end
337337
338338return M]]
@@ -343,8 +343,54 @@ return M]]
343343
344344 local func = select_filters .compile (filter )
345345 t .assert_equals (func ({' A' , ' Á' , ' Ä' , 6 }), true )
346- t .assert_equals (func ({' a' , ' á' , ' ä' , 6 }), true )
347- t .assert_equals (func ({' a' , ' V' , ' ä' , 6 }), false )
346+ t .assert_equals (func ({' A' , ' á' , ' ä' , 6 }), true )
347+ t .assert_equals (func ({' a' , ' Á' , ' Ä' , 6 }), false )
348+ t .assert_equals (func ({' A' , ' V' , ' ä' , 6 }), false )
349+ end
350+
351+ g .test_binary_and_none_collation = function ()
352+ local filter_conditions = {
353+ {
354+ fieldnos = {1 , 2 , 3 },
355+ operator = select_conditions .operators .EQ ,
356+ values = {' A' , ' B' , ' C' },
357+ types = {' string' , ' string' , ' string' },
358+ early_exit_is_possible = false ,
359+ values_opts = {
360+ {collation = ' none' },
361+ {collation = ' binary' },
362+ {collation = nil },
363+ }
364+ },
365+ }
366+
367+ local expected_code = [[ local tuple = ...
368+
369+ local field_1 = tuple[1]
370+ local field_2 = tuple[2]
371+ local field_3 = tuple[3]
372+
373+ if not eq_1(field_1, field_2, field_3) then return false, false end
374+
375+ return true, false]]
376+
377+ local expected_library_code = [[ local M = {}
378+
379+ function M.eq_1(field_1, field_2, field_3)
380+ return (eq(field_1, "A") and eq(field_2, "B") and eq(field_3, "C"))
381+ end
382+
383+ return M]]
384+
385+ local filter = select_filters .gen_code (filter_conditions )
386+ t .assert_equals (filter .code , expected_code )
387+ t .assert_equals (filter .library_code , expected_library_code )
388+
389+ local func = select_filters .compile (filter )
390+ t .assert_equals (func ({' A' , ' B' , ' C' }), true )
391+ t .assert_equals (func ({' a' , ' B' , ' C' }), false )
392+ t .assert_equals (func ({' A' , ' b' , ' C' }), false )
393+ t .assert_equals (func ({' A' , ' B' , ' c' }), false )
348394end
349395
350396g .test_null_as_last_value_eq = function ()
0 commit comments