Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / testing / performance / talos / page_load_test / sunspider / string-validate-input.html
blob9d0771c6233d8f154201a472cf21401547725636
1 <!DOCTYPE html>
2 <head>
3 <!--
4 Copyright (C) 2007 Apple Inc. All rights reserved.
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9 1. Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
15 THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 -->
28 <title>SunSpider string-validate-input</title>
29 <link rel="stylesheet" href="sunspider.css"></link>
30 </head>
32 <body>
33 <h3>string-validate-input</h3>
34 <div id="console">
35 </div>
36 <script>
39 letters = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
40 numbers = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26);
41 colors = new Array("FF","CC","99","66","33","00");
43 var endResult;
45 function doTest()
47 endResult = "";
49 // make up email address
50 for (var k=0;k<4000;k++)
52 name = makeName(6);
53 (k%2)?email=name+"@mac.com":email=name+"(at)mac.com";
55 // validate the email address
56 var pattern = /^[a-zA-Z0-9\-\._]+@[a-zA-Z0-9\-_]+(\.?[a-zA-Z0-9\-_]*)\.[a-zA-Z]{2,3}$/;
58 if(pattern.test(email))
60 var r = email + " appears to be a valid email address.";
61 addResult(r);
63 else
65 r = email + " does NOT appear to be a valid email address.";
66 addResult(r);
70 // make up ZIP codes
71 for (var s=0;s<4000;s++)
73 var zipGood = true;
74 var zip = makeNumber(4);
75 (s%2)?zip=zip+"xyz":zip=zip.concat("7");
77 // validate the zip code
78 for (var i = 0; i < zip.length; i++) {
79 var ch = zip.charAt(i);
80 if (ch < "0" || ch > "9") {
81 zipGood = false;
82 r = zip + " contains letters.";
83 addResult(r);
86 if (zipGood && zip.length>5)
88 zipGood = false;
89 r = zip + " is longer than five characters.";
90 addResult(r);
92 if (zipGood)
94 r = zip + " appears to be a valid ZIP code.";
95 addResult(r);
100 function makeName(n)
102 var tmp = "";
103 for (var i=0;i<n;i++)
105 var l = Math.floor(26*Math.random());
106 tmp += letters[l];
108 return tmp;
111 function makeNumber(n)
113 var tmp = "";
114 for (var i=0;i<n;i++)
116 var l = Math.floor(9*Math.random());
117 tmp = tmp.concat(l);
119 return tmp;
122 function addResult(r)
124 endResult += "\n" + r;
127 doTest();
130 </script>
133 </body>
134 </html>