Add tests for x509_crt_parse_path()
diff --git a/tests/suites/test_suite_x509parse.data b/tests/suites/test_suite_x509parse.data
index 567dcd2..85e7728 100644
--- a/tests/suites/test_suite_x509parse.data
+++ b/tests/suites/test_suite_x509parse.data
@@ -722,3 +722,15 @@
X509 CRL ASN1 (TBSCertList, no entries)
x509parse_crl:"30463031020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030300d06092a864886f70d01010e050003020001":"CRL version \: 1\nissuer name \: CN=ABCD\nthis update \: 2009-01-01 00\:00\:00\nnext update \: 0000-00-00 00\:00\:00\nRevoked certificates\:\nsigned using \: RSA with SHA-224\n":0
+
+X509 CRT parse path #1 (empty dir)
+x509_crt_parse_path:"data_files/dir0":0:0
+
+X509 CRT parse path #2 (one cert)
+x509_crt_parse_path:"data_files/dir1":0:1
+
+X509 CRT parse path #3 (two certs)
+x509_crt_parse_path:"data_files/dir2":0:2
+
+X509 CRT parse path #4 (two certs, one non-cert)
+x509_crt_parse_path:"data_files/dir3":1:2
diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function
index ff57058..4cc0803 100644
--- a/tests/suites/test_suite_x509parse.function
+++ b/tests/suites/test_suite_x509parse.function
@@ -224,6 +224,27 @@
}
/* END_CASE */
+/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_CRT_PARSE_C */
+void x509_crt_parse_path( char *crt_path, int ret, int nb_crt )
+{
+ x509_crt chain, *cur;
+ int i;
+
+ x509_crt_init( &chain );
+
+ TEST_ASSERT( x509_crt_parse_path( &chain, crt_path ) == ret );
+
+ /* Check how many certs we got */
+ for( i = 0, cur = &chain; cur != NULL; cur = cur->next )
+ if( cur->raw.p != NULL )
+ i++;
+
+ TEST_ASSERT( i == nb_crt );
+
+ x509_crt_init( &chain );
+}
+/* END_CASE */
+
/* BEGIN_CASE depends_on:POLARSSL_X509_CRT_PARSE_C:POLARSSL_SELF_TEST */
void x509_selftest()
{