From: Rudolf Polzer Date: Tue, 7 Jan 2014 10:54:17 +0000 (+0100) Subject: Fuzz. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=feeda183f99f92d8a21d4fe16e5f3e60b3f23c0a;p=xonotic%2Fgmqcc.git Fuzz. --- diff --git a/fuzzer.sh b/fuzzer.sh index bbf34ee..a527dce 100755 --- a/fuzzer.sh +++ b/fuzzer.sh @@ -198,7 +198,7 @@ while :; do ;; esac newvars - build_random_expression 2 "$type" + build_random_expression 1 "$type" cat <foo.qc void print(...) = #1; string ftos(float) = #2; @@ -212,19 +212,18 @@ var vector v = '-134217728 17 0.03125'; $vars; void check_float(string var_name, string expr_short, string expr_long, float a, float b) { print(var_name, " = ", expr_short, " // ", ftos(a), "\n"); - if (a == b) { - print("GOOD\n"); - } else { + if (a != b) print(var_name, " != ", expr_long, " // ", ftos(b), "\nFAIL\n"); - } } void check_vector(string var_name, string expr_short, string expr_long, vector a, vector b) { print(var_name, " = ", expr_short, " // ", vtos(a), "\n"); - if (a == b) { - print("GOOD\n"); - } else { + if (a != b) print(var_name, " != ", expr_long, " // ", vtos(b), "\nFAIL\n"); - } +} +void check_string(string var_name, string expr_short, string expr_long, string a, string b) { + print(var_name, " = ", expr_short, " // ", a, "\n"); + if (a != b) + print(var_name, " != ", expr_long, " // ", b, "\nFAIL\n"); } #define CHECK(type,var,expr_short,expr_long) \\ var = (expr_short); \\