OER support for UTCTime and GeneralizedTime, also fuzz-testing
diff --git a/tests/tests-randomized/Makefile.am b/tests/tests-randomized/Makefile.am
index 605b64f..4e6415f 100644
--- a/tests/tests-randomized/Makefile.am
+++ b/tests/tests-randomized/Makefile.am
@@ -34,6 +34,8 @@
 TESTS += bundles/08-OBJECT-IDENTIFIER-bundle.txt
 TESTS += bundles/09-RELATIVE-OID-bundle.txt
 TESTS += bundles/10-UTF8String-bundle.txt
+TESTS += bundles/11-UTCTime-bundle.txt
+TESTS += bundles/12-GeneralizedTime-bundle.txt
 
 EXTRA_DIST =                    \
     random-test-driver.c        \
diff --git a/tests/tests-randomized/bundles/11-UTCTime-bundle.txt b/tests/tests-randomized/bundles/11-UTCTime-bundle.txt
new file mode 100644
index 0000000..8676f98
--- /dev/null
+++ b/tests/tests-randomized/bundles/11-UTCTime-bundle.txt
@@ -0,0 +1 @@
+UTCTime
diff --git a/tests/tests-randomized/bundles/12-GeneralizedTime-bundle.txt b/tests/tests-randomized/bundles/12-GeneralizedTime-bundle.txt
new file mode 100644
index 0000000..3a261cc
--- /dev/null
+++ b/tests/tests-randomized/bundles/12-GeneralizedTime-bundle.txt
@@ -0,0 +1 @@
+GeneralizedTime
diff --git a/tests/tests-skeletons/check-GeneralizedTime.c b/tests/tests-skeletons/check-GeneralizedTime.c
index 0aa74b9..21ea725 100644
--- a/tests/tests-skeletons/check-GeneralizedTime.c
+++ b/tests/tests-skeletons/check-GeneralizedTime.c
@@ -188,6 +188,21 @@
 	FREEMEM(gt);
 }
 
+static void
+compare(int lineno, int cmp_control, const char *astr, const char *bstr) {
+    GeneralizedTime_t a = {(uint8_t *)strdup(astr), strlen(astr)};
+    GeneralizedTime_t b = {(uint8_t *)strdup(bstr), strlen(bstr)};
+    int cmp_result = asn_DEF_GeneralizedTime.op->compare_struct(
+        &asn_DEF_GeneralizedTime, &a, &b);
+    if(cmp_result != cmp_control) {
+        fprintf(stderr, "%03d: [%s] == [%s] = %d, expected %d\n", lineno, astr,
+                bstr, cmp_result, cmp_control);
+        assert(cmp_result == cmp_control);
+    }
+    ASN_STRUCT_RESET(asn_DEF_GeneralizedTime, &a);
+    ASN_STRUCT_RESET(asn_DEF_GeneralizedTime, &b);
+}
+
 int
 main(int ac, char **av) {
 	char *tz = getenv("TZ");
@@ -264,6 +279,16 @@
 	RECODE("20050702123312.0080010+1056", "20050702013712.008001Z");
 #endif
 
+    compare(__LINE__, 0, "20040125093007", "20040125093007");
+    compare(__LINE__, 0, "20040125093007-0000", "20040125093007Z");
+    compare(__LINE__, 1, "20040125093008", "20040125093007");
+    compare(__LINE__, 1, "20040125093008-0000", "20040125093007-0000");
+    compare(__LINE__, 0, "20040125093008-0000", "20040125093008-0000");
+    compare(__LINE__, 1, "20040125093008-0000", "20040125093007Z");
+    compare(__LINE__, 0, "20040125093007-0000", "20040125093007+0000");
+    compare(__LINE__, 1, "20040125093007-0030", "20040125093007Z");
+    compare(__LINE__, -1, "20040125093007+0030", "20040125093007Z");
+
 	return 0;
 }
 
diff --git a/tests/tests-skeletons/check-UTCTime.c b/tests/tests-skeletons/check-UTCTime.c
index e1c2556..8f85b55 100644
--- a/tests/tests-skeletons/check-UTCTime.c
+++ b/tests/tests-skeletons/check-UTCTime.c
@@ -33,6 +33,21 @@
 	if(as_gmt) check(time_str, sample, as_gmt);
 }
 
+static void
+compare(int lineno, int cmp_control, const char *astr, const char *bstr) {
+    UTCTime_t a = {(uint8_t *)strdup(astr), strlen(astr)};
+    UTCTime_t b = {(uint8_t *)strdup(bstr), strlen(bstr)};
+    int cmp_result =
+        asn_DEF_UTCTime.op->compare_struct(&asn_DEF_UTCTime, &a, &b);
+    if(cmp_result != cmp_control) {
+        fprintf(stderr, "%03d: [%s] == [%s] = %d, expected %d\n", lineno, astr,
+                bstr, cmp_result, cmp_control);
+        assert(cmp_result == cmp_control);
+    }
+    ASN_STRUCT_RESET(asn_DEF_UTCTime, &a);
+    ASN_STRUCT_RESET(asn_DEF_UTCTime, &b);
+}
+
 int
 main(int ac, char **av) {
 
@@ -57,6 +72,16 @@
 		check("040125093000,1234", 1075051800, 0);
 	}
 
+    compare(__LINE__, 0, "040125093007", "040125093007");
+    compare(__LINE__, 0, "040125093007-0000", "040125093007Z");
+    compare(__LINE__, 1, "040125093008", "040125093007");
+    compare(__LINE__, 1, "040125093008-0000", "040125093007-0000");
+    compare(__LINE__, 0, "040125093008-0000", "040125093008-0000");
+    compare(__LINE__, 1, "040125093008-0000", "040125093007Z");
+    compare(__LINE__, 0, "040125093007-0000", "040125093007+0000");
+    compare(__LINE__, 1, "040125093007-0030", "040125093007Z");
+    compare(__LINE__, -1, "040125093007+0030", "040125093007Z");
+
 	return 0;
 }