+ let new_bestscore = Common.regression_testing_vs score expected_score in
+
+
+ let xs = Common.hash_to_list score in
+ let sexp = Sexp_common.sexp_of_score_list xs in
+ let s_score = Sexp.to_string_hum sexp in
+ Common.write_file ~file:(actual_score_file) s_score;
+
+ let xs2 = Common.hash_to_list new_bestscore in
+ let sexp2 = Sexp_common.sexp_of_score_list xs2 in
+ let s_score2 = Sexp.to_string_hum sexp2 in
+ Common.write_file ~file:(best_of_both_file) s_score2;
+
+ Common.print_total_score score;
+
+ let (good, total) = Common.total_scores score in
+ let (expected_good, expected_total) = Common.total_scores expected_score in
+
+ if good = expected_good
+ then begin
+ pr2 "Current score is equal to expected score; everything is fine";
+ raise (UnixExit 0);
+ end
+ else
+ if good < expected_good
+ then begin
+ pr2 "Current score is lower than expected :(";
+ pr2 (spf "(was expecting %d but got %d)" expected_good good);
+ pr2 "";
+ pr2 "If you think it's normal, then maybe you need to update the";
+ pr2 (spf "score file %s, copying info from %s."
+ expected_score_file actual_score_file);
+ raise (UnixExit 1);
+ end
+ else begin
+ pr2 "Current score is greater than expected :)";
+ pr2 (spf "(was expecting %d but got %d)" expected_good good);
+ pr2 "Generating new expected score file and saving old one";
+ Common.command2_y_or_no_exit_if_no
+ (spf "mv %s %s" expected_score_file (expected_score_file ^ ".save"));
+ Common.command2_y_or_no_exit_if_no
+ (spf "mv %s %s" best_of_both_file expected_score_file);
+ raise (UnixExit 0);
+ end
+