svn rev #25743: trunk/src/tests/asn.1/

ghudson@MIT.EDU ghudson at MIT.EDU
Wed Mar 7 19:37:44 EST 2012


http://src.mit.edu/fisheye/changelog/krb5/?cs=25743
Commit By: ghudson
Log Message:
Simplify some ASN.1 array encoder tests

Use encode_run() for pa_data and etype_info tests.


Changed Files:
U   trunk/src/tests/asn.1/krb5_encode_test.c
U   trunk/src/tests/asn.1/reference_encode.out
U   trunk/src/tests/asn.1/trval_reference.out
Modified: trunk/src/tests/asn.1/krb5_encode_test.c
===================================================================
--- trunk/src/tests/asn.1/krb5_encode_test.c	2012-03-08 00:37:41 UTC (rev 25742)
+++ trunk/src/tests/asn.1/krb5_encode_test.c	2012-03-08 00:37:44 UTC (rev 25743)
@@ -506,35 +506,13 @@
         krb5_pa_data **pa;
 
         ktest_make_sample_pa_data_array(&pa);
-        retval = encode_krb5_padata_sequence(pa,&(code));
-        if (retval) {
-            com_err("encoding padata_sequence",retval,"");
-            exit(1);
-        }
-        encoder_print_results(code, "padata_sequence", "");
-        retval = encode_krb5_typed_data(pa, &code);
-        if (retval) {
-            com_err("encoding typed_data", retval, "");
-            exit(1);
-        }
-        encoder_print_results(code, "typed_data", "");
-
+        encode_run(*pa, "padata_sequence", "", encode_krb5_padata_sequence);
+        encode_run(*pa, "typed_data", "", encode_krb5_typed_data);
         ktest_destroy_pa_data_array(&pa);
-    }
 
-    /****************************************************************/
-    /* encode_padata_sequence (empty) */
-    {
-        krb5_pa_data **pa;
-
         ktest_make_sample_empty_pa_data_array(&pa);
-        retval = encode_krb5_padata_sequence(pa,&(code));
-        if (retval) {
-            com_err("encoding padata_sequence(empty)",retval,"");
-            exit(1);
-        }
-        encoder_print_results(code, "padata_sequence(empty)", "");
-
+        encode_run(*pa, "padata_sequence", "(empty)",
+                   encode_krb5_padata_sequence);
         ktest_destroy_pa_data_array(&pa);
     }
 
@@ -544,58 +522,32 @@
         krb5_etype_info_entry **info;
 
         ktest_make_sample_etype_info(&info);
-        retval = encode_krb5_etype_info(info,&(code));
-        if (retval) {
-            com_err("encoding etype_info",retval,"");
-            exit(1);
-        }
-        encoder_print_results(code, "etype_info", "");
+        encode_run(*info, "etype_info", "", encode_krb5_etype_info);
+
         ktest_destroy_etype_info_entry(info[2]);      info[2] = 0;
         ktest_destroy_etype_info_entry(info[1]);      info[1] = 0;
+        encode_run(*info, "etype_info", "(only 1)", encode_krb5_etype_info);
 
-        retval = encode_krb5_etype_info(info,&(code));
-        if (retval) {
-            com_err("encoding etype_info (only 1)",retval,"");
-            exit(1);
-        }
-        encoder_print_results(code, "etype_info (only 1)", "");
-
         ktest_destroy_etype_info_entry(info[0]);      info[0] = 0;
+        encode_run(*info, "etype_info", "(no info)", encode_krb5_etype_info);
 
-        retval = encode_krb5_etype_info(info,&(code));
-        if (retval) {
-            com_err("encoding etype_info (no info)",retval,"");
-            exit(1);
-        }
-        encoder_print_results(code, "etype_info (no info)", "");
-
         ktest_destroy_etype_info(info);
     }
 
-    /* encode_etype_info 2*/
+    /* encode_etype_info2 */
     {
         krb5_etype_info_entry **info;
 
         ktest_make_sample_etype_info2(&info);
-        retval = encode_krb5_etype_info2(info,&(code));
-        if (retval) {
-            com_err("encoding etype_info",retval,"");
-            exit(1);
-        }
-        encoder_print_results(code, "etype_info2", "");
+        encode_run(*info, "etype_info2", "", encode_krb5_etype_info2);
+
         ktest_destroy_etype_info_entry(info[2]);      info[2] = 0;
         ktest_destroy_etype_info_entry(info[1]);      info[1] = 0;
+        encode_run(*info, "etype_info2", "(only 1)", encode_krb5_etype_info2);
 
-        retval = encode_krb5_etype_info2(info,&(code));
-        if (retval) {
-            com_err("encoding etype_info (only 1)",retval,"");
-            exit(1);
-        }
-        encoder_print_results(code, "etype_info2 (only 1)", "");
+        /* etype_info2 sequences aren't allowed to be empty. */
 
         ktest_destroy_etype_info(info);
-/*    ktest_destroy_etype_info_entry(info[0]);      info[0] = 0;*/
-
     }
 
     /****************************************************************/

Modified: trunk/src/tests/asn.1/reference_encode.out
===================================================================
--- trunk/src/tests/asn.1/reference_encode.out	2012-03-08 00:37:41 UTC (rev 25742)
+++ trunk/src/tests/asn.1/reference_encode.out	2012-03-08 00:37:44 UTC (rev 25743)
@@ -39,10 +39,10 @@
 encode_krb5_typed_data: 30 24 30 10 A0 03 02 01 0D A1 09 04 07 70 61 2D 64 61 74 61 30 10 A0 03 02 01 0D A1 09 04 07 70 61 2D 64 61 74 61
 encode_krb5_padata_sequence(empty): 30 00
 encode_krb5_etype_info: 30 33 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 30 05 A0 03 02 01 01 30 14 A0 03 02 01 02 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 32
-encode_krb5_etype_info (only 1): 30 16 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30
-encode_krb5_etype_info (no info): 30 00
+encode_krb5_etype_info(only 1): 30 16 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30
+encode_krb5_etype_info(no info): 30 00
 encode_krb5_etype_info2: 30 51 30 1E A0 03 02 01 00 A1 0D 1B 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 A2 08 04 06 73 32 6B 3A 20 30 30 0F A0 03 02 01 01 A2 08 04 06 73 32 6B 3A 20 31 30 1E A0 03 02 01 02 A1 0D 1B 0B 4D 6F 72 74 6F 6E 27 73 20 23 32 A2 08 04 06 73 32 6B 3A 20 32
-encode_krb5_etype_info2 (only 1): 30 20 30 1E A0 03 02 01 00 A1 0D 1B 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 A2 08 04 06 73 32 6B 3A 20 30
+encode_krb5_etype_info2(only 1): 30 20 30 1E A0 03 02 01 00 A1 0D 1B 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 A2 08 04 06 73 32 6B 3A 20 30
 encode_krb5_pa_enc_ts: 30 1A A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40
 encode_krb5_pa_enc_ts (no usec): 30 13 A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A
 encode_krb5_enc_data: 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65

Modified: trunk/src/tests/asn.1/trval_reference.out
===================================================================
--- trunk/src/tests/asn.1/trval_reference.out	2012-03-08 00:37:41 UTC (rev 25742)
+++ trunk/src/tests/asn.1/trval_reference.out	2012-03-08 00:37:44 UTC (rev 25743)
@@ -1094,14 +1094,14 @@
 .  .  [0] [Integer] 2
 .  .  [1] [Octet String] "Morton's #2"
 
-encode_krb5_etype_info (only 1):
+encode_krb5_etype_info(only 1):
 
 [Sequence/Sequence Of] 
 .  [Sequence/Sequence Of] 
 .  .  [0] [Integer] 0
 .  .  [1] [Octet String] "Morton's #0"
 
-encode_krb5_etype_info (no info):
+encode_krb5_etype_info(no info):
 
 [Sequence/Sequence Of] 
 
@@ -1120,7 +1120,7 @@
 .  .  [1] [General string] "Morton's #2"
 .  .  [2] [Octet String] "s2k: 2"
 
-encode_krb5_etype_info2 (only 1):
+encode_krb5_etype_info2(only 1):
 
 [Sequence/Sequence Of] 
 .  [Sequence/Sequence Of] 



More information about the cvs-krb5 mailing list