start adding some systematic tests
authorDan Vanderkam <danvdk@gmail.com>
Thu, 27 Aug 2009 03:03:52 +0000 (03:03 +0000)
committerDan Vanderkam <danvdk@gmail.com>
Thu, 27 Aug 2009 03:03:52 +0000 (03:03 +0000)
tests/data.js [new file with mode: 0644]
tests/noise.html [new file with mode: 0644]
tests/two-series.html [new file with mode: 0644]

diff --git a/tests/data.js b/tests/data.js
new file mode 100644 (file)
index 0000000..8bd1210
--- /dev/null
@@ -0,0 +1,433 @@
+function data() {
+return "" +
+"Date,High,Low\n" +
+"200701011,62,39\n" +
+"200701021,62,44\n" +
+"200701031,62,42\n" +
+"200701041,57,45\n" +
+"200701051,54,44\n" +
+"200701061,55,36\n" +
+"200701071,62,45\n" +
+"200701081,66,48\n" +
+"200701091,63,39\n" +
+"200701101,57,37\n" +
+"200701111,50,37\n" +
+"200701121,48,35\n" +
+"200701131,48,30\n" +
+"200701141,48,28\n" +
+"200701151,53,28\n" +
+"200701161,50,30\n" +
+"200701171,57,37\n" +
+"200701181,61,33\n" +
+"200701191,55,35\n" +
+"200701201,61,35\n" +
+"200701211,64,43\n" +
+"200701221,61,36\n" +
+"200701231,57,35\n" +
+"200701241,60,35\n" +
+"200701251,55,39\n" +
+"200701261,54,44\n" +
+"200701271,57,48\n" +
+"200701281,59,45\n" +
+"200701291,63,45\n" +
+"200701301,59,41\n" +
+"200701311,55,48\n" +
+"200702011,53,46\n" +
+"200702021,55,44\n" +
+"200702031,59,37\n" +
+"200702041,66,39\n" +
+"200702051,64,43\n" +
+"200702061,61,46\n" +
+"200702071,61,51\n" +
+"200702081,60,51\n" +
+"200702091,61,55\n" +
+"200702101,62,55\n" +
+"200702111,61,46\n" +
+"200702121,59,43\n" +
+"200702131,57,46\n" +
+"200702141,61,39\n" +
+"200702151,64,44\n" +
+"200702161,71,46\n" +
+"200702171,73,51\n" +
+"200702181,60,46\n" +
+"200702191,63,44\n" +
+"200702201,57,45\n" +
+"200702211,59,48\n" +
+"200702221,55,44\n" +
+"200702231,55,42\n" +
+"200702241,57,39\n" +
+"200702251,55,48\n" +
+"200702261,57,44\n" +
+"200702271,53,39\n" +
+"200702281,53,37\n" +
+"200703011,54,37\n" +
+"200703021,61,39\n" +
+"200703031,66,43\n" +
+"200703041,70,48\n" +
+"200703051,68,53\n" +
+"200703061,69,46\n" +
+"200703071,62,51\n" +
+"200703081,61,46\n" +
+"200703091,60,45\n" +
+"200703101,68,46\n" +
+"200703111,79,48\n" +
+"200703121,80,52\n" +
+"200703131,73,53\n" +
+"200703141,64,48\n" +
+"200703151,78,46\n" +
+"200703161,78,50\n" +
+"200703171,62,51\n" +
+"200703181,66,46\n" +
+"200703191,64,48\n" +
+"200703201,60,48\n" +
+"200703211,66,46\n" +
+"200703221,73,43\n" +
+"200703231,78,48\n" +
+"200703241,68,48\n" +
+"200703251,64,53\n" +
+"200703261,66,48\n" +
+"200703271,57,46\n" +
+"200703281,66,42\n" +
+"200703291,73,42\n" +
+"200703301,72,46\n" +
+"200703311,69,46\n" +
+"200704011,64,46\n" +
+"200704021,69,46\n" +
+"200704031,71,46\n" +
+"200704041,69,50\n" +
+"200704051,71,52\n" +
+"200704061,64,52\n" +
+"200704071,68,51\n" +
+"200704081,71,51\n" +
+"200704091,66,50\n" +
+"200704101,72,46\n" +
+"200704111,63,50\n" +
+"200704121,64,46\n" +
+"200704131,70,44\n" +
+"200704141,57,51\n" +
+"200704151,68,46\n" +
+"200704161,75,46\n" +
+"200704171,62,48\n" +
+"200704181,61,45\n" +
+"200704191,57,42\n" +
+"200704201,64,46\n" +
+"200704211,61,43\n" +
+"200704221,63,48\n" +
+"200704231,70,44\n" +
+"200704241,66,46\n" +
+"200704251,66,48\n" +
+"200704261,69,48\n" +
+"200704271,82,50\n" +
+"200704281,81,55\n" +
+"200704291,70,53\n" +
+"200704301,77,51\n" +
+"200705011,70,48\n" +
+"200705021,66,52\n" +
+"200705031,63,48\n" +
+"200705041,64,51\n" +
+"200705051,73,46\n" +
+"200705061,88,54\n" +
+"200705071,91,57\n" +
+"200705081,84,60\n" +
+"200705091,73,55\n" +
+"200705101,57,52\n" +
+"200705111,64,51\n" +
+"200705121,64,50\n" +
+"200705131,72,46\n" +
+"200705141,66,50\n" +
+"200705151,63,51\n" +
+"200705161,70,48\n" +
+"200705171,68,50\n" +
+"200705181,73,50\n" +
+"200705191,70,52\n" +
+"200705201,73,51\n" +
+"200705211,78,54\n" +
+"200705221,81,51\n" +
+"200705231,86,55\n" +
+"200705241,78,55\n" +
+"200705251,69,54\n" +
+"200705261,69,55\n" +
+"200705271,69,54\n" +
+"200705281,73,52\n" +
+"200705291,69,53\n" +
+"200705301,66,55\n" +
+"200705311,64,54\n" +
+"200706011,66,54\n" +
+"200706021,64,54\n" +
+"200706031,70,55\n" +
+"200706041,73,59\n" +
+"200706051,68,55\n" +
+"200706061,70,53\n" +
+"200706071,75,51\n" +
+"200706081,70,50\n" +
+"200706091,75,53\n" +
+"200706101,75,55\n" +
+"200706111,75,53\n" +
+"200706121,79,52\n" +
+"200706131,90,59\n" +
+"200706141,89,60\n" +
+"200706151,86,59\n" +
+"200706161,72,55\n" +
+"200706171,79,53\n" +
+"200706181,79,57\n" +
+"200706191,73,55\n" +
+"200706201,71,55\n" +
+"200706211,77,55\n" +
+"200706221,79,54\n" +
+"200706231,77,54\n" +
+"200706241,77,53\n" +
+"200706251,82,53\n" +
+"200706261,71,54\n" +
+"200706271,73,55\n" +
+"200706281,73,57\n" +
+"200706291,77,60\n" +
+"200706301,75,54\n" +
+"200707011,78,54\n" +
+"200707021,82,57\n" +
+"200707031,72,57\n" +
+"200707041,84,59\n" +
+"200707051,84,61\n" +
+"200707061,75,60\n" +
+"200707071,73,55\n" +
+"200707081,78,55\n" +
+"200707091,73,57\n" +
+"200707101,73,59\n" +
+"200707111,78,62\n" +
+"200707121,75,59\n" +
+"200707131,79,60\n" +
+"200707141,73,60\n" +
+"200707151,78,62\n" +
+"200707161,75,59\n" +
+"200707171,77,60\n" +
+"200707181,75,63\n" +
+"200707191,80,59\n" +
+"200707201,79,59\n" +
+"200707211,77,61\n" +
+"200707221,75,63\n" +
+"200707231,79,64\n" +
+"200707241,73,61\n" +
+"200707251,72,57\n" +
+"200707261,75,60\n" +
+"200707271,78,60\n" +
+"200707281,77,57\n" +
+"200707291,73,57\n" +
+"200707301,80,59\n" +
+"200707311,75,59\n" +
+"200708011,75,59\n" +
+"200708021,73,60\n" +
+"200708031,79,60\n" +
+"200708041,77,59\n" +
+"200708051,71,57\n" +
+"200708061,71,59\n" +
+"200708071,73,57\n" +
+"200708081,71,55\n" +
+"200708091,77,60\n" +
+"200708101,77,57\n" +
+"200708111,73,57\n" +
+"200708121,72,55\n" +
+"200708131,75,55\n" +
+"200708141,73,55\n" +
+"200708151,75,57\n" +
+"200708161,79,60\n" +
+"200708171,80,55\n" +
+"200708181,78,57\n" +
+"200708191,77,55\n" +
+"200708201,80,64\n" +
+"200708211,82,62\n" +
+"200708221,82,60\n" +
+"200708231,82,57\n" +
+"200708241,78,59\n" +
+"200708251,73,61\n" +
+"200708261,73,61\n" +
+"200708271,78,59\n" +
+"200708281,86,62\n" +
+"200708291,88,68\n" +
+"200708301,90,68\n" +
+"200708311,80,66\n" +
+"200709011,87,62\n" +
+"200709021,89,61\n" +
+"200709031,78,61\n" +
+"200709041,78,63\n" +
+"200709051,89,57\n" +
+"200709061,82,64\n" +
+"200709071,75,61\n" +
+"200709081,73,62\n" +
+"200709091,71,61\n" +
+"200709101,73,59\n" +
+"200709111,71,59\n" +
+"200709121,72,60\n" +
+"200709131,77,57\n" +
+"200709141,75,60\n" +
+"200709151,73,57\n" +
+"200709161,72,61\n" +
+"200709171,72,55\n" +
+"200709181,73,55\n" +
+"200709191,66,55\n" +
+"200709201,71,52\n" +
+"200709211,77,57\n" +
+"200709221,64,57\n" +
+"200709231,68,55\n" +
+"200709241,78,52\n" +
+"200709251,84,53\n" +
+"200709261,87,57\n" +
+"200709271,75,55\n" +
+"200709281,66,54\n" +
+"200709291,73,52\n" +
+"200709301,75,48\n" +
+"200710011,71,57\n" +
+"200710021,81,53\n" +
+"200710031,73,54\n" +
+"200710041,69,55\n" +
+"200710051,64,50\n" +
+"200710061,73,45\n" +
+"200710071,77,46\n" +
+"200710081,79,53\n" +
+"200710091,72,53\n" +
+"200710101,69,54\n" +
+"200710111,70,48\n" +
+"200710121,64,54\n" +
+"200710131,70,53\n" +
+"200710141,66,51\n" +
+"200710151,68,52\n" +
+"200710161,66,52\n" +
+"200710171,66,50\n" +
+"200710181,73,50\n" +
+"200710191,72,57\n" +
+"200710201,66,54\n" +
+"200710211,73,51\n" +
+"200710221,81,51\n" +
+"200710231,84,53\n" +
+"200710241,79,55\n" +
+"200710251,66,53\n" +
+"200710261,68,46\n" +
+"200710271,66,52\n" +
+"200710281,75,52\n" +
+"200710291,63,55\n" +
+"200710301,63,53\n" +
+"200710311,63,54\n" +
+"200711011,66,53\n" +
+"200711021,77,50\n" +
+"200711031,80,48\n" +
+"200711041,77,48\n" +
+"200711051,66,48\n" +
+"200711061,62,52\n" +
+"200711071,61,48\n" +
+"200711081,59,53\n" +
+"200711091,63,48\n" +
+"200711101,66,48\n" +
+"200711111,63,48\n" +
+"200711121,68,44\n" +
+"200711131,72,51\n" +
+"200711141,75,55\n" +
+"200711151,69,51\n" +
+"200711161,63,55\n" +
+"200711171,66,51\n" +
+"200711181,64,53\n" +
+"200711191,66,48\n" +
+"200711201,63,46\n" +
+"200711211,64,43\n" +
+"200711221,64,37\n" +
+"200711231,70,37\n" +
+"200711241,60,37\n" +
+"200711251,60,46\n" +
+"200711261,63,42\n" +
+"200711271,63,45\n" +
+"200711281,64,46\n" +
+"200711291,62,41\n" +
+"200711301,55,42\n" +
+"200712011,57,37\n" +
+"200712021,61,45\n" +
+"200712031,66,50\n" +
+"200712041,61,54\n" +
+"200712051,60,50\n" +
+"200712061,57,48\n" +
+"200712071,55,45\n" +
+"200712081,53,42\n" +
+"200712091,57,39\n" +
+"200712101,57,39\n" +
+"200712111,57,41\n" +
+"200712121,55,35\n" +
+"200712131,59,34\n" +
+"200712141,55,34\n" +
+"200712151,55,39\n" +
+"200712161,55,43\n" +
+"200712171,57,48\n" +
+"200712181,57,43\n" +
+"200712191,59,41\n" +
+"200712201,55,43\n" +
+"200712211,53,39\n" +
+"200712221,53,32\n" +
+"200712231,55,37\n" +
+"200712241,57,45\n" +
+"200712251,57,37\n" +
+"200712261,53,43\n" +
+"200712271,48,37\n" +
+"200712281,48,43\n" +
+"200712291,57,44\n" +
+"200712301,52,43\n" +
+"200712311,57,42\n";
+}
+
+function NoisyData() {
+return "" +
+"Date,A,B\n" +
+"20061001,3.01953818828,0.7212041046,2.18487394958,0.599318549691\n" +
+"20061002,3.63321799308,0.778297234566,1.69491525424,0.531417655826\n" +
+"20061003,2.44328097731,0.644967734352,2.51256281407,0.640539070386\n" +
+"20061004,3.52733686067,0.774700921683,2.68456375839,0.66207105053\n" +
+"20061005,3.28719723183,0.741636245748,2.35294117647,0.621407707226\n" +
+"20061006,1.58450704225,0.523967868159,3.78657487091,0.791868460623\n" +
+"20061007,5.32859680284,0.946589405904,4.0404040404,0.807910739509\n" +
+"20061008,2.64084507042,0.672799548916,2.37288135593,0.626609885481\n" +
+"20061009,2.26480836237,0.620990945917,3.5413153457,0.75897176848\n" +
+"20061010,3.29289428076,0.74289969528,2.02702702703,0.579191340004\n" +
+"20061011,2.7633851468,0.681234043829,1.1744966443,0.4413034044\n" +
+"20061012,3.28719723183,0.741636245748,3.37268128162,0.741327769578\n" +
+"20061013,1.77304964539,0.55569466381,1.85810810811,0.555011329732\n" +
+"20061014,3.39892665474,0.7664008338,1.67224080268,0.524368852929\n" +
+"20061015,2.65017667845,0.675144574777,3.35570469799,0.737661045752\n" +
+"20061016,3.63951473137,0.779620631266,2.34899328859,0.620377617453\n" +
+"20061017,2.25694444444,0.618859623032,1.68067226891,0.526990133716\n" +
+"20061018,4.47504302926,0.857766274964,2.51677852349,0.641599927369\n" +
+"20061019,2.44755244755,0.646081155692,1.68067226891,0.526990133716\n" +
+"20061020,3.67775831874,0.787656442774,3.066439523,0.711598843969\n" +
+"20061021,3.94265232975,0.823839169829,3.85906040268,0.788990618726\n" +
+"20061022,2.59067357513,0.660187558973,3.71621621622,0.777438794254\n" +
+"20061023,4.33275563258,0.847570482324,3.85906040268,0.788990618726\n" +
+"20061024,3.10344827586,0.720049610821,2.84280936455,0.679611549697\n" +
+"20061025,1.40350877193,0.492720767725,2.7027027027,0.666482380968\n" +
+"20061026,1.95035460993,0.582291234145,2.36486486486,0.624518599275\n" +
+"20061027,2.30905861456,0.632980642182,2.03045685279,0.580161203819\n" +
+"20061028,4.09252669039,0.835706590809,2.87648054146,0.68754192469\n" +
+"20061029,2.66903914591,0.679883997626,2.02360876897,0.578224712918\n" +
+"20061030,4.74516695958,0.89127787497,4.36241610738,0.836670992529\n" +
+"20061031,2.78260869565,0.685905251933,3.20945945946,0.724388507178\n" +
+"20061101,1.5873015873,0.524884521441,1.51260504202,0.500373860545\n" +
+"20061102,2.78745644599,0.687083077461,2.0202020202,0.57726130639\n" +
+"20061103,5.11463844797,0.925157232782,2.68907563025,0.663168401088\n" +
+"20061104,4.9001814882,0.919644816432,3.07692307692,0.713993047527\n" +
+"20061105,5.13274336283,0.928343545136,3.55329949239,0.761492892041\n" +
+"20061106,1.92644483363,0.575222935029,2.35294117647,0.621407707226\n" +
+"20061107,2.46478873239,0.650573541306,1.52027027027,0.502889967904\n" +
+"20061108,2.13523131673,0.609772022763,2.6981450253,0.665374048085\n" +
+"20061109,3.88007054674,0.811026422222,2.72572402044,0.672079879106\n" +
+"20061110,2.63620386643,0.671633132526,3.71621621622,0.777438794254\n" +
+"20061111,3.69718309859,0.791736755355,3.0303030303,0.703344064467\n" +
+"20061112,3.83944153578,0.802703592906,4.05405405405,0.81058250986\n" +
+"20061113,2.47787610619,0.653984033555,2.20338983051,0.604340313133\n" +
+"20061114,1.77304964539,0.55569466381,2.22222222222,0.60944692682\n" +
+"20061115,2.30088495575,0.630766388737,0.843170320405,0.375484163785\n" +
+"20061116,1.57894736842,0.522144132232,2.19594594595,0.602321544724\n" +
+"20061118,2.45183887916,0.647198426991,1.69491525424,0.531417655826\n" +
+"20061119,3.52733686067,0.774700921683,1.85185185185,0.55316023504\n" +
+"20061120,2.97723292469,0.711254751484,2.6981450253,0.665374048085\n" +
+"20061121,2.29681978799,0.629665059963,2.01680672269,0.576301104352\n" +
+"20061122,3.01418439716,0.719945245328,2.5466893039,0.649125445325\n" +
+"20061123,3.78378378378,0.809917534069,2.6936026936,0.664269394219\n" +
+"20061124,3.18584070796,0.738851643987,2.01005025126,0.57439025002\n" +
+"20061125,2.83185840708,0.697868332879,3.066439523,0.711598843969\n" +
+"20061126,3.01953818828,0.7212041046,2.53378378378,0.645878720149\n" +
+"20061127,2.81195079086,0.693033387099,1.51006711409,0.499540743312\n" +
+"20061128,2.97723292469,0.711254751484,2.54237288136,0.648039583782\n" +
+"20061129,1.41093474427,0.495309102312,3.02013422819,0.701020603129";
+}
diff --git a/tests/noise.html b/tests/noise.html
new file mode 100644 (file)
index 0000000..3918e0e
--- /dev/null
@@ -0,0 +1,33 @@
+<html>
+  <head>
+    <title>noise</title>
+    <!--[if IE]>
+    <script type="text/javascript" src="excanvas.js"></script>
+    <![endif]-->
+    <script type="text/javascript" src="../dygraph-combined.js"></script>
+    <script type="text/javascript" src="data.js"></script>
+  </head>
+  <body>
+    <p>7-day rollup:</p>
+    <div id="g" style="width:600px; height:300px;"></div>
+    <p>14-Day Rollup:</p>
+    <div id="g30" style="width:600px; height:300px;"></div>
+
+    <script type="text/javascript">
+      g = new DateGraph(
+            document.getElementById("g"),
+            NoisyData, null, {
+              rollPeriod: 7,
+              errorBars: true
+            }
+          );
+      g30 = new DateGraph(
+            document.getElementById("g30"),
+            NoisyData, null, {
+              rollPeriod: 14,
+              errorBars: true
+            }
+          );
+    </script>
+  </body>
+</html>
diff --git a/tests/two-series.html b/tests/two-series.html
new file mode 100644 (file)
index 0000000..b065d5d
--- /dev/null
@@ -0,0 +1,29 @@
+<html>
+  <head>
+    <title>two series</title>
+    <!--[if IE]>
+    <script type="text/javascript" src="excanvas.js"></script>
+    <![endif]-->
+    <script type="text/javascript" src="../dygraph-combined.js"></script>
+    <script type="text/javascript" src="data.js"></script>
+  </head>
+  <body>
+    <p>No rollup:</p>
+    <div id="g" style="width:600px; height:300px;"></div>
+    <p>30-Day Rollup:</p>
+    <div id="g30" style="width:600px; height:300px;"></div>
+
+    <script type="text/javascript">
+      g = new DateGraph(
+            document.getElementById("g"),
+            data, null, {}
+          );
+      g30 = new DateGraph(
+            document.getElementById("g30"),
+            data, null, {
+              rollPeriod: 30
+            }
+          );
+    </script>
+  </body>
+</html>