VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/nsprpub/pr/tests/vercheck.c@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is the Netscape Portable Runtime (NSPR).
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1999-2000
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38/*
39 * File: vercheck.c
40 *
41 * Description:
42 * This test tests the PR_VersionCheck() function. The
43 * compatible_version and incompatible_version arrays
44 * need to be updated for each patch or release.
45 *
46 * Tested areas: library version compatibility check.
47 */
48
49#include "prinit.h"
50
51#include <stdio.h>
52#include <stdlib.h>
53
54/*
55 * This release (4.5) is backward compatible with the
56 * 4.0.x, 4.1.x, 4.2.x, 4.3.x, and 4.4.x releases. It, of course,
57 * is compatible with itself.
58 */
59static char *compatible_version[] = {
60 "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
61 "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1", PR_VERSION
62};
63
64/*
65 * This release is not backward compatible with the old
66 * NSPR 2.1 and 3.x releases.
67 *
68 * Any release is incompatible with future releases and
69 * patches.
70 */
71static char *incompatible_version[] = {
72 "2.1 19980529",
73 "3.0", "3.0.1",
74 "3.1", "3.1.1", "3.1.2", "3.1.3",
75 "3.5", "3.5.1",
76 "4.5.3",
77 "4.6", "4.6.1",
78 "10.0", "11.1", "12.14.20"
79};
80
81int main()
82{
83 int idx;
84 int num_compatible = sizeof(compatible_version) / sizeof(char *);
85 int num_incompatible = sizeof(incompatible_version) / sizeof(char *);
86
87 printf("NSPR release %s:\n", PR_VERSION);
88 for (idx = 0; idx < num_compatible; idx++) {
89 if (PR_VersionCheck(compatible_version[idx]) == PR_FALSE) {
90 fprintf(stderr, "Should be compatible with version %s\n",
91 compatible_version[idx]);
92 exit(1);
93 }
94 printf("Compatible with version %s\n", compatible_version[idx]);
95 }
96
97 for (idx = 0; idx < num_incompatible; idx++) {
98 if (PR_VersionCheck(incompatible_version[idx]) == PR_TRUE) {
99 fprintf(stderr, "Should be incompatible with version %s\n",
100 incompatible_version[idx]);
101 exit(1);
102 }
103 printf("Incompatible with version %s\n", incompatible_version[idx]);
104 }
105
106 printf("PASS\n");
107 return 0;
108}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette