From 494e6e656be6c59000cb48f52f252dd0875697e2 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 19 Jan 2015 21:32:39 -0600
Subject: [PATCH] Try to catch people shooting themselves in the foot with
 auto_test and fix_paramaeters

---
 loopy/auto_test.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/loopy/auto_test.py b/loopy/auto_test.py
index 387c55294..cc36f3c52 100644
--- a/loopy/auto_test.py
+++ b/loopy/auto_test.py
@@ -359,6 +359,19 @@ def auto_test_vs_ref(
         message) indicating correctness/acceptability of the result
     """
 
+    if len(ref_knl.args) != len(test_knl.args):
+        raise LoopyError("ref_knl and test_knl do not have the same number "
+                "of arguments")
+
+    for i, (ref_arg, test_arg) in enumerate(zip(ref_knl.args, test_knl.args)):
+        if ref_arg.name != test_arg.name:
+            raise LoopyError("ref_knl and test_knl argument lists disagee at index "
+                    "%d (1-based)" % (i+1))
+
+        if ref_arg.dtype != test_arg.dtype:
+            raise LoopyError("ref_knl and test_knl argument lists disagee at index "
+                    "%d (1-based)" % (i+1))
+
     from loopy.compiled import CompiledKernel, get_highlighted_cl_code
 
     if isinstance(op_count, (int, float)):
-- 
GitLab