[test] Add schema and count validators in Project Wycheproof tests

The schema and test counts are currently validated only at the point
of attempting to generate source code.  Promote these checks to become
standard validators.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
diff --git a/src/tests/wycheproof/import.py b/src/tests/wycheproof/import.py
index ee4144d..323b076 100755
--- a/src/tests/wycheproof/import.py
+++ b/src/tests/wycheproof/import.py
@@ -267,6 +267,24 @@
     schema = scalar_field(str)
     testGroups = list_field(TestGroup)
 
+    @schema.validator
+    def validate_schema(self, attr, value):
+        """Validate schema"""
+        if value != self.SCHEMA:
+            raise ValueError(
+                "%s: found schema %s (expected %s)" %
+                (self.SRCFILE, value, self.SCHEMA)
+            )
+
+    @numberOfTests.validator
+    def validate_number_of_tests(self, attr, value):
+        """Validate number of tests"""
+        if value != len(self.tests):
+            raise ValueError(
+                "%s: found %d tests (expected %d)" %
+                (self.SRCFILE, len(self.tests), value)
+            )
+
     @property
     def basename(self):
         """Base name for test cases"""
@@ -279,20 +297,10 @@
 
     def source(self):
         """Generate source code"""
-        if self.schema != self.SCHEMA:
-            raise ValueError(
-                "%s: found schema %s (expected %s)" %
-                (self.SRCFILE, self.schema, self.SCHEMA)
-            )
         generator = Path(__file__).name
         execname = "wycheproof_%s_exec" % self.basename
         tests = self.tests
         label = tests[0].test_label
-        if len(tests) != self.numberOfTests:
-            raise ValueError(
-                "%s: found %d tests (expected %d)" %
-                (self.SRCFILE, len(tests), self.numberOfTests)
-            )
         definitions = "\n".join(x.definition() for x in tests)
         invocations = "".join(x.invocation() for x in tests if not x.skip)
         code = (