@@ -103,7 +103,33 @@ def checkGolden (resp, resp_golden_path):
103
103
info (f"Golden file { red } not found{ endred } " )
104
104
exit (1 )
105
105
106
-
106
+ def checkGoldenGetModel (resp , resp_golden_path ):
107
+ if os .path .exists (resp_golden_path ):
108
+ debug ("Checking against golden file..." )
109
+ with open (resp_golden_path , 'rb' ) as resp_golden_raw :
110
+ golden_json = json .loads (resp_golden_raw .read ())
111
+ resp_json = json .loads (resp )
112
+ if golden_json ["result" ]["satisfiable" ] != resp_json ["result" ]["satisfiable" ]:
113
+ print (f"Test '{ name } ' { red } failed.{ endred } " )
114
+ info (diff_strings (str (golden_json ), str (resp )))
115
+ if RECREATE_BROKEN_GOLDEN :
116
+ with open (resp_golden_path , 'wb' ) as resp_golden_writer :
117
+ resp_golden_writer .write (resp )
118
+ else :
119
+ info ("Expected" )
120
+ info (golden_json )
121
+ info ("but got" )
122
+ info (resp )
123
+ exit (1 )
124
+ else :
125
+ info (f"Test '{ name } ' { green } passed{ endgreen } " )
126
+ elif CREATE_MISSING_GOLDEN or RECREATE_BROKEN_GOLDEN :
127
+ with open (resp_golden_path , 'wb' ) as resp_golden_writer :
128
+ resp_golden_writer .write (resp )
129
+ else :
130
+ debug (resp )
131
+ info (f"Golden file { red } not found{ endred } " )
132
+ exit (1 )
107
133
108
134
def runTest (def_path , req , resp_golden_path , smt_tactic = None ):
109
135
smt_options = ["--smt-tactic" , str (smt_tactic )] if smt_tactic else []
@@ -122,7 +148,11 @@ def runTest(def_path, req, resp_golden_path, smt_tactic = None):
122
148
debug (resp )
123
149
process .kill ()
124
150
125
- checkGolden (resp , resp_golden_path )
151
+ req_method = json .loads (req )["method" ]
152
+ if req_method == "get-model" :
153
+ checkGoldenGetModel (resp , resp_golden_path )
154
+ else :
155
+ checkGolden (resp , resp_golden_path )
126
156
127
157
print ("Running execute tests:" )
128
158
0 commit comments