Don't create fixtures for simple tests
[openssl.git] / test / x509_internal_test.c
1 /*
2  * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 /* Internal tests for the x509 and x509v3 modules */
11
12 #include <stdio.h>
13 #include <string.h>
14
15 #include <openssl/x509.h>
16 #include <openssl/x509v3.h>
17 #include "testutil.h"
18 #include "e_os.h"
19
20 /**********************************************************************
21  *
22  * Test of x509v3
23  *
24  ***/
25
26 #include "../crypto/x509v3/ext_dat.h"
27 #include "../crypto/x509v3/standard_exts.h"
28
29 static int test_standard_exts()
30 {
31     size_t i;
32     int prev = -1, good = 1;
33     const X509V3_EXT_METHOD **tmp;
34
35     tmp = standard_exts;
36     for (i = 0; i < OSSL_NELEM(standard_exts); i++, tmp++) {
37         if ((*tmp)->ext_nid < prev)
38             good = 0;
39         prev = (*tmp)->ext_nid;
40
41     }
42     if (!good) {
43         tmp = standard_exts;
44         fprintf(stderr, "Extensions out of order!\n");
45         for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)
46             fprintf(stderr, "%d : %s\n", (*tmp)->ext_nid,
47                     OBJ_nid2sn((*tmp)->ext_nid));
48     } else {
49         fprintf(stderr, "Order OK\n");
50     }
51
52     return good;
53 }
54
55 int main(int argc, char **argv)
56 {
57     ADD_TEST(test_standard_exts);
58
59     return run_tests(argv[0]);
60 }