Bug 462294 - Add "View Video" to context menu for <video> elements. r=gavin, ui...
[wine-gecko.git] / nsprpub / pr / tests / testbit.c
blob1ad0b8f4ce2a09355380600557494798bdc0ae96
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
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/
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.
15 * The Original Code is the Netscape Portable Runtime (NSPR).
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
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.
36 * ***** END LICENSE BLOCK ***** */
39 ** File: lazyinit.c
40 ** Description: Test the functions and macros declared in prbit.h
44 #include "nspr.h"
46 #define ErrorReport(x) { printf((x)); failed = 1; }
48 prbitmap_t myMap[512/32] = { 0 };
50 PRInt32 rc;
51 PRInt32 i;
52 PRIntn failed = 0;
54 PRIntn main(PRIntn argc, char **argv )
57 ** Test bitmap things.
59 if ( PR_TEST_BIT( myMap, 0 ))
60 ErrorReport("Test 0.0: Failed\n");
62 if ( PR_TEST_BIT( myMap, 31 ))
63 ErrorReport("Test 0.1: Failed\n");
65 if ( PR_TEST_BIT( myMap, 128 ))
66 ErrorReport("Test 0.2: Failed\n");
68 if ( PR_TEST_BIT( myMap, 129 ))
69 ErrorReport("Test 0.3: Failed\n");
72 PR_SET_BIT( myMap, 0 );
73 if ( !PR_TEST_BIT( myMap, 0 ))
74 ErrorReport("Test 1.0: Failed\n");
76 PR_CLEAR_BIT( myMap, 0 );
77 if ( PR_TEST_BIT( myMap, 0 ))
78 ErrorReport("Test 1.0.1: Failed\n");
80 PR_SET_BIT( myMap, 31 );
81 if ( !PR_TEST_BIT( myMap, 31 ))
82 ErrorReport("Test 1.1: Failed\n");
84 PR_CLEAR_BIT( myMap, 31 );
85 if ( PR_TEST_BIT( myMap, 31 ))
86 ErrorReport("Test 1.1.1: Failed\n");
88 PR_SET_BIT( myMap, 128 );
89 if ( !PR_TEST_BIT( myMap, 128 ))
90 ErrorReport("Test 1.2: Failed\n");
92 PR_CLEAR_BIT( myMap, 128 );
93 if ( PR_TEST_BIT( myMap, 128 ))
94 ErrorReport("Test 1.2.1: Failed\n");
96 PR_SET_BIT( myMap, 129 );
97 if ( !PR_TEST_BIT( myMap, 129 ))
98 ErrorReport("Test 1.3: Failed\n");
100 PR_CLEAR_BIT( myMap, 129 );
101 if ( PR_TEST_BIT( myMap, 129 ))
102 ErrorReport("Test 1.3.1: Failed\n");
106 ** Test Ceiling and Floor functions and macros
108 if ((rc = PR_CeilingLog2(32)) != 5 )
109 ErrorReport("Test 10.0: Failed\n");
111 if ((rc = PR_FloorLog2(32)) != 5 )
112 ErrorReport("Test 10.1: Failed\n");
116 ** Evaluate results and exit
118 if (failed)
120 printf("FAILED\n");
121 return(1);
123 else
125 printf("PASSED\n");
126 return(0);
128 } /* end main() */
129 /* end testbit.c */