#NEWLINE# def check_native_axiom_consistency( self , axiom ) : #NEWLINE# #INDENT# num_rand_vals = self . numRandVals #NEWLINE# num_relaxations_to_try = self . numRelaxations #NEWLINE# max_attempts_for_random_value = self . maxForRand #NEWLINE# max_attempts_for_random_relax = self . maxForRelax #NEWLINE# jovt = axiom . signature ( ) #NEWLINE# logging . info ( 'checking native axiom with signature %s' , jovt ) #NEWLINE# least_specialized_axiom = axiom #NEWLINE# random_values_tried = 0 #NEWLINE# for i in range ( num_rand_vals ) : #NEWLINE# #INDENT# rand_val = self . attemptToFindRandomValue ( jovt , max_attempts_for_random_value ) #NEWLINE# if ( rand_val == None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# value_by_least_specialized_axiom = self . evaluateNativeAxiom ( least_specialized_axiom , rand_val . getTuple ( ) ) #NEWLINE# random_values_tried += 1 #NEWLINE# most_specialized_axiom = self . axioms . getAxiomByJOVT ( self . typed_fora_compiler , FORANative . JOVFromLiveValue ( rand_val ) . getTuple ( ) ) #NEWLINE# value_by_most_specialized_axiom = self . evaluateNativeAxiom ( most_specialized_axiom , rand_val . getTuple ( ) ) #NEWLINE# self . assertEqual ( value_by_least_specialized_axiom , value_by_most_specialized_axiom , ( 'calling the native axioms %s and %s on %s produce different values!                                     (%s vs %s)' % ( least_specialized_axiom . signature ( ) , most_specialized_axiom . signature ( ) , rand_val , value_by_least_specialized_axiom , value_by_most_specialized_axiom ) ) ) #NEWLINE# rand_val_as_jov = FORANative . implValToJOV ( rand_val ) #NEWLINE# actually_tested = 0 #NEWLINE# for j in range ( num_relaxations_to_try ) : #NEWLINE# #INDENT# if rand_val_as_jov . getTuple ( ) : #NEWLINE# #INDENT# random_relaxation = self . random_relaxation ( rand_val_as_jov . getTuple ( ) , max_attempts_for_random_relax ) #NEWLINE# if ( random_relaxation and least_specialized_axiom . signature ( ) . covers ( random_relaxation ) ) : #NEWLINE# #INDENT# actually_tested = ( actually_tested + 1 ) #NEWLINE# local_best_axiom = self . axioms . getAxiomByJOVT ( self . typed_fora_compiler , random_relaxation ) #NEWLINE# local_value = self . evaluateNativeAxiom ( local_best_axiom , rand_val . getTuple ( ) ) #NEWLINE# self . assertEqual ( value_by_least_specialized_axiom , local_value , ( 'calling the native axioms %s and %s on %s                                             produce different values! (%s vs %s)' % ( least_specialized_axiom . signature ( ) , local_best_axiom . signature ( ) , rand_val , value_by_least_specialized_axiom , i ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( random_values_tried == 0 ) : #NEWLINE# #INDENT# logging . warn ( 'unable to find a random value for the native axiom %s' , jovt )