test(tvix/eval): builtins.sort must preserve order of equal elements
Change-Id: I59a0756940d1e5360a2ab4e886cf0bc9af7b8901 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7133 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
		
							parent
							
								
									3412ae4956
								
							
						
					
					
						commit
						313a24e4de
					
				
					 2 changed files with 8 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								tvix/eval/src/tests/tvix_tests/eval-okay-stable-sort.exp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tvix/eval/src/tests/tvix_tests/eval-okay-stable-sort.exp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
[ { index = 7; key = 0; } { index = 0; key = 1; } { index = 13; key = 1; } { index = 1; key = 2; } { index = 3; key = 2; } { index = 4; key = 2; } { index = 5; key = 2; } { index = 12; key = 2; } { index = 14; key = 2; } { index = 2; key = 3; } { index = 11; key = 3; } { index = 15; key = 3; } { index = 10; key = 4; } { index = 6; key = 5; } { index = 8; key = 5; } { index = 9; key = 5; } { index = 16; key = 22; } ]
 | 
			
		||||
							
								
								
									
										7
									
								
								tvix/eval/src/tests/tvix_tests/eval-okay-stable-sort.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								tvix/eval/src/tests/tvix_tests/eval-okay-stable-sort.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
let
 | 
			
		||||
  keys = [ 1 2 3 2 2 2 5 0 5 5 4 3 2 1 2 3 22 ];
 | 
			
		||||
in
 | 
			
		||||
 | 
			
		||||
builtins.sort
 | 
			
		||||
  (a: b: a.key < b.key)
 | 
			
		||||
  (builtins.genList (index: { inherit index; key = builtins.elemAt keys index; }) (builtins.length keys))
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue