summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabio Fiorina <fiorinaf@gnutls.org>2002-10-07 19:34:30 +0000
committerFabio Fiorina <fiorinaf@gnutls.org>2002-10-07 19:34:30 +0000
commit22980812f7038378127cc9e8b3a3d70c0699e109 (patch)
tree6ecbf0d8ac659da36e2500fd226c5ded5d663f17 /tests
parent56db6def01a8d8c5a195453cd1efb05641e70a14 (diff)
downloadlibtasn1-22980812f7038378127cc9e8b3a3d70c0699e109.tar.gz
libtasn1-22980812f7038378127cc9e8b3a3d70c0699e109.tar.bz2
libtasn1-22980812f7038378127cc9e8b3a3d70c0699e109.zip
*** empty log message ***
Diffstat (limited to 'tests')
-rw-r--r--tests/Test_parser.asn4
-rw-r--r--tests/Test_parser.c9
-rw-r--r--tests/Test_tree.asn9
-rw-r--r--tests/Test_tree.c25
4 files changed, 36 insertions, 11 deletions
diff --git a/tests/Test_parser.asn b/tests/Test_parser.asn
index d108853..8290dc7 100644
--- a/tests/Test_parser.asn
+++ b/tests/Test_parser.asn
@@ -12,8 +12,8 @@ BEGIN
Sequence1 ::= SEQUENCE{
int1 INTEGER,
- int2 INTEGER
-
+ int2 INTEGER,
+ generic GeneralString
}
diff --git a/tests/Test_parser.c b/tests/Test_parser.c
index 8236844..7c3a397 100644
--- a/tests/Test_parser.c
+++ b/tests/Test_parser.c
@@ -81,7 +81,8 @@ test_type test_array[]={
{12,"const1 INTEGER ::= 10",ASN1_SUCCESS,""},
{12,"const1 INTEGER ::= v1",
ASN1_SYNTAX_ERROR,_FILE_":12: parse error near 'v1'"},
-
+ {16," generic generalstring",
+ ASN1_IDENTIFIER_NOT_FOUND,_FILE_":: identifier 'generalstring' not found"},
/* end */
@@ -145,7 +146,7 @@ main(int argc,char *argv[])
if(result!=ASN1_SUCCESS){
printf("File '%s' not correct\n",fileCorrectName);
- libasn1_perror(result);
+ libtasn1_perror(result);
printf("ErrorDescription = %s\n\n",errorDescription);
exit(1);
}
@@ -172,9 +173,9 @@ main(int argc,char *argv[])
errorCounter++;
printf("ERROR N. %d:\n",errorCounter);
printf(" Line %d - %s\n",test->lineNumber,test->line);
- printf(" Error expected: %s - %s\n",libasn1_strerror(test->errorNumber),
+ printf(" Error expected: %s - %s\n",libtasn1_strerror(test->errorNumber),
test->errorDescription);
- printf(" Error detected: %s - %s\n\n",libasn1_strerror(result),
+ printf(" Error detected: %s - %s\n\n",libtasn1_strerror(result),
errorDescription);
}
diff --git a/tests/Test_tree.asn b/tests/Test_tree.asn
index 68fa0bf..1026dff 100644
--- a/tests/Test_tree.asn
+++ b/tests/Test_tree.asn
@@ -64,6 +64,15 @@ BMPString ::= [UNIVERSAL 30] IMPLICIT OCTET STRING
UTF8String ::= [UNIVERSAL 12] IMPLICIT OCTET STRING
-- The content of this type conforms to RFC 2279.
+
+Test3 ::= SEQUENCE{
+ a INTEGER,
+ b [1] EXPLICIT GeneralString2
+}
+
+GeneralString2 ::= [2] EXPLICIT GeneralString
+
+
END
diff --git a/tests/Test_tree.c b/tests/Test_tree.c
index 6629d22..d5613de 100644
--- a/tests/Test_tree.c
+++ b/tests/Test_tree.c
@@ -106,6 +106,21 @@ test_type test_array[]={
{ACT_VISIT,"Seq","",ASN1_PRINT_ALL,ASN1_SUCCESS},
{ACT_DELETE,"","",0,ASN1_SUCCESS},
+ /* Test GeneralString */
+ {ACT_CREATE,"TEST_TREE.Test3","test",0,ASN1_SUCCESS},
+ {ACT_WRITE,"test.a","1234",0,ASN1_SUCCESS},
+ {ACT_WRITE,"test.b","prova",5,ASN1_SUCCESS},
+ {ACT_ENCODING,"test",0,0,ASN1_SUCCESS},
+ {ACT_PRINT_DER,0,0,0,ASN1_SUCCESS},
+ {ACT_DELETE,"","",0,ASN1_SUCCESS},
+ {ACT_CREATE,"TEST_TREE.Test3","test",0,ASN1_SUCCESS},
+ //{ACT_DECODING,0,0,0,ASN1_SUCCESS},
+ {ACT_DECODING_ELEMENT,"test.b",0,0,ASN1_SUCCESS},
+ {ACT_READ,"test.b","prova",5,ASN1_SUCCESS},
+ {ACT_VISIT,"test","",ASN1_PRINT_ALL,ASN1_SUCCESS},
+ {ACT_DELETE,"","",0,ASN1_SUCCESS},
+
+
/* end */
{ACT_NULL}
@@ -136,7 +151,7 @@ main(int argc,char *argv[])
result=asn1_array2tree(Test_tree_asn1_tab,&definitions,errorDescription);
if(result!=ASN1_SUCCESS){
- libasn1_perror(result);
+ libtasn1_perror(result);
printf("ErrorDescription = %s\n\n",errorDescription);
exit(1);
}
@@ -231,8 +246,8 @@ main(int argc,char *argv[])
printf("ERROR N. %d:\n",errorCounter);
printf(" Action %d - %s - %s - %d\n",test->action,test->par1,
test->par2,test->par3);
- printf(" Error expected: %s\n",libasn1_strerror(test->errorNumber));
- printf(" Error detected: %s\n\n",libasn1_strerror(result));
+ printf(" Error expected: %s\n",libtasn1_strerror(test->errorNumber));
+ printf(" Error detected: %s\n\n",libtasn1_strerror(result));
}
break;
@@ -250,11 +265,11 @@ main(int argc,char *argv[])
errorCounter++;
printf("ERROR N. %d:\n",errorCounter);
printf(" Action %d - %s\n",test->action,test->par1);
- printf(" Error expected: %s - %d - ",libasn1_strerror(test->errorNumber),
+ printf(" Error expected: %s - %d - ",libtasn1_strerror(test->errorNumber),
test->par3);
for(k=0;k<test->par3;k++)
printf("%02x",test->par2[k]);
- printf("\n Error detected: %s - %d - ",libasn1_strerror(result),
+ printf("\n Error detected: %s - %d - ",libtasn1_strerror(result),
valueLen);
for(k=0;k<valueLen;k++)
printf("%02x",value[k]);