File tree Expand file tree Collapse file tree 1 file changed +18
-52
lines changed
cedar-policy-generators/src Expand file tree Collapse file tree 1 file changed +18
-52
lines changed Original file line number Diff line number Diff line change @@ -365,58 +365,24 @@ impl ExprGenerator<'_> {
365365 u,
366366 ) ?,
367367 ) ) ,
368- // < expression
369- 1 => Ok ( ast:: Expr :: less(
370- self . generate_expr_for_type(
371- & Type :: long( ) ,
372- max_depth - 1 ,
373- u,
374- ) ?,
375- self . generate_expr_for_type(
376- & Type :: long( ) ,
377- max_depth - 1 ,
378- u,
379- ) ?,
380- ) ) ,
381- // <= expression
382- 1 => Ok ( ast:: Expr :: lesseq(
383- self . generate_expr_for_type(
384- & Type :: long( ) ,
385- max_depth - 1 ,
386- u,
387- ) ?,
388- self . generate_expr_for_type(
389- & Type :: long( ) ,
390- max_depth - 1 ,
391- u,
392- ) ?,
393- ) ) ,
394- // > expression
395- 1 => Ok ( ast:: Expr :: greater(
396- self . generate_expr_for_type(
397- & Type :: long( ) ,
398- max_depth - 1 ,
399- u,
400- ) ?,
401- self . generate_expr_for_type(
402- & Type :: long( ) ,
403- max_depth - 1 ,
404- u,
405- ) ?,
406- ) ) ,
407- // >= expression
408- 1 => Ok ( ast:: Expr :: greatereq(
409- self . generate_expr_for_type(
410- & Type :: long( ) ,
411- max_depth - 1 ,
412- u,
413- ) ?,
414- self . generate_expr_for_type(
415- & Type :: long( ) ,
416- max_depth - 1 ,
417- u,
418- ) ?,
419- ) ) ,
368+ // Binary comparisons expressions (>, >=, <, and <=)
369+ 4 => {
370+ let cmp_ty = uniform!( u,
371+ Type :: long( ) ,
372+ Type :: datetime( ) ,
373+ Type :: duration( )
374+ ) ;
375+ let cmp_op = uniform!( u,
376+ ast:: Expr :: greater,
377+ ast:: Expr :: greatereq,
378+ ast:: Expr :: less,
379+ ast:: Expr :: lesseq
380+ ) ;
381+ Ok ( cmp_op(
382+ self . generate_expr_for_type( & cmp_ty, max_depth - 1 , u) ?,
383+ self . generate_expr_for_type( & cmp_ty, max_depth - 1 , u) ?,
384+ ) )
385+ } ,
420386 // in expression, non-set form
421387 11 => {
422388 let ety1 = self . schema. arbitrary_entity_type( u) ?;
You can’t perform that action at this time.
0 commit comments