@@ -579,7 +579,10 @@ pgroup.test_eq_condition_with_index = function(g)
579579 },{
580580 id = 7 , name = " Jack" , last_name = " Sparrow" ,
581581 age = 33 , city = " Chicago" ,
582- },
582+ }, {
583+ id = 8 , name = " Nick" , last_name = " Smith" ,
584+ age = 20 , city = " London" ,
585+ }
583586 })
584587
585588 table.sort (customers , function (obj1 , obj2 ) return obj1 .id < obj2 .id end )
@@ -602,6 +605,51 @@ pgroup.test_eq_condition_with_index = function(g)
602605 t .assert_equals (err , nil )
603606 local objects = crud .unflatten_rows (result .rows , result .metadata )
604607 t .assert_equals (objects , helpers .get_objects_by_idxs (customers , {5 , 7 })) -- in id order
608+
609+ -- after obj 5 with negative first
610+ local after = crud_utils .flatten (customers [5 ], g .space_format )
611+ local result , err = g .cluster .main_server .net_box :call (
612+ ' crud.select' , {' customers' , conditions , {after = after , first =- 10 }})
613+
614+ t .assert_equals (err , nil )
615+ local objects = crud .unflatten_rows (result .rows , result .metadata )
616+ t .assert_equals (objects , helpers .get_objects_by_idxs (customers , {1 , 3 })) -- in id order
617+
618+ -- after obj 8
619+ local after = crud_utils .flatten (customers [8 ], g .space_format )
620+ local result , err = g .cluster .main_server .net_box :call (
621+ ' crud.select' , {' customers' , conditions , {after = after , first = 10 }})
622+
623+ t .assert_equals (err , nil )
624+ local objects = crud .unflatten_rows (result .rows , result .metadata )
625+ t .assert_equals (objects , helpers .get_objects_by_idxs (customers , {1 , 3 , 5 , 7 })) -- in id order
626+
627+ -- after obj 8 with negative first
628+ local after = crud_utils .flatten (customers [8 ], g .space_format )
629+ local result , err = g .cluster .main_server .net_box :call (
630+ ' crud.select' , {' customers' , conditions , {after = after , first =- 10 }})
631+
632+ t .assert_equals (err , nil )
633+ local objects = crud .unflatten_rows (result .rows , result .metadata )
634+ t .assert_equals (objects , helpers .get_objects_by_idxs (customers , {}))
635+
636+ -- after obj 2
637+ local after = crud_utils .flatten (customers [2 ], g .space_format )
638+ local result , err = g .cluster .main_server .net_box :call (
639+ ' crud.select' , {' customers' , conditions , {after = after , first = 10 }})
640+
641+ t .assert_equals (err , nil )
642+ local objects = crud .unflatten_rows (result .rows , result .metadata )
643+ t .assert_equals (objects , helpers .get_objects_by_idxs (customers , {}))
644+
645+ -- after obj 2 with negative first
646+ local after = crud_utils .flatten (customers [2 ], g .space_format )
647+ local result , err = g .cluster .main_server .net_box :call (
648+ ' crud.select' , {' customers' , conditions , {after = after , first =- 10 }})
649+
650+ t .assert_equals (err , nil )
651+ local objects = crud .unflatten_rows (result .rows , result .metadata )
652+ t .assert_equals (objects , helpers .get_objects_by_idxs (customers , {1 , 3 , 5 , 7 })) -- in id order
605653end
606654
607655pgroup .test_ge_condition_with_index = function (g )
0 commit comments