michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * File: vercheck.c michael@0: * michael@0: * Description: michael@0: * This test tests the PR_VersionCheck() function. The michael@0: * compatible_version and incompatible_version arrays michael@0: * need to be updated for each patch or release. michael@0: * michael@0: * Tested areas: library version compatibility check. michael@0: */ michael@0: michael@0: #include "prinit.h" michael@0: michael@0: #include michael@0: #include michael@0: michael@0: /* michael@0: * This release (4.10.6) is backward compatible with the michael@0: * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x, michael@0: * 4.8.x, 4.9.x, 4.10, 4.10.1, 4.10.2, 4.10.3, 4.10.4, and michael@0: * 4.10.5 releases. michael@0: * It, of course, is compatible with itself. michael@0: */ michael@0: static char *compatible_version[] = { michael@0: "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3", michael@0: "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1", michael@0: "4.5", "4.5.1", michael@0: "4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5", michael@0: "4.6.6", "4.6.7", "4.6.8", michael@0: "4.7", "4.7.1", "4.7.2", "4.7.3", "4.7.4", "4.7.5", michael@0: "4.7.6", michael@0: "4.8", "4.8.1", "4.8.2", "4.8.3", "4.8.4", "4.8.5", michael@0: "4.8.6", "4.8.7", "4.8.8", "4.8.9", michael@0: "4.9", "4.9.1", "4.9.2", "4.9.3", "4.9.4", "4.9.5", michael@0: "4.9.6", michael@0: "4.10", "4.10.1", "4.10.2", "4.10.3", "4.10.4", michael@0: "4.10.5", michael@0: PR_VERSION michael@0: }; michael@0: michael@0: /* michael@0: * This release is not backward compatible with the old michael@0: * NSPR 2.1 and 3.x releases. michael@0: * michael@0: * Any release is incompatible with future releases and michael@0: * patches. michael@0: */ michael@0: static char *incompatible_version[] = { michael@0: "2.1 19980529", michael@0: "3.0", "3.0.1", michael@0: "3.1", "3.1.1", "3.1.2", "3.1.3", michael@0: "3.5", "3.5.1", michael@0: "4.10.7", michael@0: "4.11", "4.11.1", michael@0: "10.0", "11.1", "12.14.20" michael@0: }; michael@0: michael@0: int main(int argc, char **argv) michael@0: { michael@0: int idx; michael@0: int num_compatible = sizeof(compatible_version) / sizeof(char *); michael@0: int num_incompatible = sizeof(incompatible_version) / sizeof(char *); michael@0: michael@0: printf("NSPR release %s:\n", PR_VERSION); michael@0: for (idx = 0; idx < num_compatible; idx++) { michael@0: if (PR_VersionCheck(compatible_version[idx]) == PR_FALSE) { michael@0: fprintf(stderr, "Should be compatible with version %s\n", michael@0: compatible_version[idx]); michael@0: exit(1); michael@0: } michael@0: printf("Compatible with version %s\n", compatible_version[idx]); michael@0: } michael@0: michael@0: for (idx = 0; idx < num_incompatible; idx++) { michael@0: if (PR_VersionCheck(incompatible_version[idx]) == PR_TRUE) { michael@0: fprintf(stderr, "Should be incompatible with version %s\n", michael@0: incompatible_version[idx]); michael@0: exit(1); michael@0: } michael@0: printf("Incompatible with version %s\n", incompatible_version[idx]); michael@0: } michael@0: michael@0: printf("PASS\n"); michael@0: return 0; michael@0: }