You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							32 lines
						
					
					
						
							543 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							32 lines
						
					
					
						
							543 B
						
					
					
				
								#include "test_I.h"
							 | 
						|
								
							 | 
						|
								int test_I_integer_length (int iterations)
							 | 
						|
								{
							 | 
						|
									int error = 0;
							 | 
						|
									int i;
							 | 
						|
									// Check against ash.
							 | 
						|
									for (i = iterations; i > 0; i--) {
							 | 
						|
										cl_I a = testrandom_I();
							 | 
						|
										uintL l = integer_length(a);
							 | 
						|
										if (a >= 0) {
							 | 
						|
											int b = 0;
							 | 
						|
											if (a < ash(1,l)) {
							 | 
						|
												if (a == 0)
							 | 
						|
													b = (l == 0);
							 | 
						|
												else
							 | 
						|
													b = (l > 0 && a >= ash(1,l-1));
							 | 
						|
											}
							 | 
						|
											ASSERT1(b, a);
							 | 
						|
										} else {
							 | 
						|
											int b = 0;
							 | 
						|
											if (a >= ash(-1,l)) {
							 | 
						|
												if (a == -1)
							 | 
						|
													b = (l == 0);
							 | 
						|
												else
							 | 
						|
													b = (l > 0 && a < ash(-1,l-1));
							 | 
						|
											}
							 | 
						|
											ASSERT1(b, a);
							 | 
						|
										}
							 | 
						|
									}
							 | 
						|
									return error;
							 | 
						|
								}
							 |