Permalink
Browse files

begin revamp of unit and speed tests to run command line

  • Loading branch information...
1 parent 2f5e2b3 commit 4ca723b3cf0fa2383ce3f5ecfbe614e932bae38c @trevnorris trevnorris committed Mar 8, 2012
View
@@ -0,0 +1,22 @@
+var vows = require( 'vows' ),
+ assert = require('assert' )
+ suite = vows.describe( 'jStat.extend' );
+
+require( '../env.js' );
+
+suite.addBatch({
+ 'jStat' : {
+ 'topic' : function() {
+ return jStat.extend;
+ },
+ 'extending' : function( extend ) {
+ assert.deepEqual( extend({ happy : 'sad' },{ here : 'there' }),{
+ happy : 'sad',
+ here : 'there'
+ });
+ assert.deepEqual( extend({ one : 'two' },{ one : 'more' }),{ one : 'more' });
+ }
+ }
+});
+
+suite.export( module );
View
@@ -0,0 +1,47 @@
+var vows = require( 'vows' ),
+ assert = require('assert' )
+ suite = vows.describe( 'jStat' );
+
+require( '../env.js' );
+
+suite.addBatch({
+ 'jStat' : {
+ 'topic' : function() {
+ return jStat;
+ },
+ 'basic checks' : function( jStat ) {
+ assert.isFunction( jStat.fn.toArray );
+ assert.isFunction( jStat.fn.push );
+ assert.isFunction( jStat.fn.sort );
+ assert.isFunction( jStat.fn.splice );
+
+ assert.deepEqual( jStat(), [] );
+ assert.deepEqual( jStat( null ), [] );
+ assert.deepEqual( jStat( undefined ), [] );
+ assert.deepEqual( jStat( [] ).toArray(), [] );
+
+ assert.isTrue( jStat.fn.constructor === jStat );
+ assert.isTrue( jStat.fn.init.prototype === jStat.fn );
+ assert.isTrue( jStat() instanceof jStat );
+ assert.isTrue( jStat( null ) instanceof jStat );
+ assert.isTrue( jStat( undefined ) instanceof jStat );
+ assert.isTrue( jStat( [] ) instanceof jStat );
+
+ assert.equal( jStat.fn.length, 0 );
+ assert.equal( jStat([ 1, 2, 3 ]).length, 1 );
+ assert.equal( jStat([ 1, 2, 3 ])[0].length, 3 );
+ },
+ 'matrix/vector generation' : function( jStat ) {
+ assert.deepEqual( jStat([1,2,3]).toArray(), [1,2,3] );
+ assert.deepEqual( jStat([[1,2],[3,4]]).toArray(), [[1,2],[3,4]] );
+ },
+ 'sequence generation' : function( jStat ) {
+ assert.deepEqual( jStat( 0, 0.5, 6 ).toArray(), [ 0, 0.1, 0.2, 0.3, 0.4, 0.5 ]);
+ assert.deepEqual( jStat( 0, 5, 6, function( x ) {
+ return x * 2;
+ }).toArray(), [ 0, 2, 4, 6, 8, 10 ]);
+ }
+ }
+});
+
+suite.export( module );
View
@@ -0,0 +1,45 @@
+var vows = require( 'vows' ),
+ assert = require('assert' )
+ suite = vows.describe( 'jStat.utils' );
+
+require( '../env.js' );
+
+suite.addBatch({
+ 'jStat' : {
+ 'topic' : function() {
+ return jStat.utils;
+ },
+ 'calcRdx' : function( utils ) {
+ assert.equal( utils.calcRdx( 1e5, 1e10 ), 1e7 );
+ },
+ 'isArray' : function( utils ) {
+ assert.isFalse( utils.isArray( true ));
+ assert.isTrue( utils.isArray( [] ));
+ assert.isFalse( utils.isArray( {} ));
+ assert.isFalse( utils.isArray( '123' ));
+ assert.isFalse( utils.isArray( /reg/ ));
+ assert.isFalse( utils.isArray( 1234 ));
+ assert.isFalse( utils.isArray( function() {} ));
+ },
+ 'isFunction' : function( utils ) {
+ assert.isFalse( utils.isFunction( true ));
+ assert.isFalse( utils.isFunction( [] ));
+ assert.isFalse( utils.isFunction( {} ));
+ assert.isFalse( utils.isFunction( '123' ));
+ assert.isFalse( utils.isFunction( /reg/ ));
+ assert.isFalse( utils.isFunction( 1234 ));
+ assert.isTrue( utils.isFunction( function() {} ));
+ },
+ 'isNumber' : function( utils ) {
+ assert.isFalse( utils.isNumber( true ));
+ assert.isFalse( utils.isNumber( [] ));
+ assert.isFalse( utils.isNumber( {} ));
+ assert.isFalse( utils.isNumber( '123' ));
+ assert.isFalse( utils.isNumber( /reg/ ));
+ assert.isTrue( utils.isNumber( 1234 ));
+ assert.isFalse( utils.isNumber( function() {} ));
+ }
+ }
+});
+
+suite.export( module );
View
@@ -1,270 +0,0 @@
-html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section, menu, time, mark, audio, video { margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent; }
-
-article, aside, figure, footer, header, hgroup, nav, section { display:block; }
-nav ul { list-style:none; }
-blockquote, q { quotes:none; }
-blockquote:before, blockquote:after, q:before, q:after { content:''; content:none; }
-a { margin:0; padding:0; font-size:100%; vertical-align:baseline; background:transparent; }
-ins { background-color:#ff9; color:#000; text-decoration:none; }
-mark { background-color:#ff9; color:#000; font-style:italic; font-weight:bold; }
-del { text-decoration:line-through; }
-abbr[title], dfn[title] { border-bottom:1px dotted #000; cursor:help; }
-table { border-collapse:collapse; border-spacing:0; }
-hr { display:block; height:1px; border:0; border-top:1px solid #ccc; margin:1em 0; padding:0; }
-input, select { vertical-align:middle; }
-
-body { font:13px sans-serif; *font-size:small; *font:x-small; line-height:1.22; }
-table { font-size:inherit; font:100%; }
-select, input, textarea { font:99% sans-serif; }
-pre, code, kbd, samp { font-family:monospace, sans-serif; }
-
-body, select, input, textarea { color:#444; }
-h1,h2,h3,h4,h5,h6 { font-weight:bold; text-rendering:optimizeLegibility; }
-html { -webkit-font-smoothing:antialiased; }
-a:hover, a:active { outline:none; }
-a, a:active, a:visited { color:#607890; }
-a:hover { color:#036; }
-ul { margin-left:30px; }
-ol { margin-left:30px; list-style-type:decimal; }
-small { font-size:85%; }
-strong, th { font-weight:bold; }
-td, td img { vertical-align:top; }
-sub { vertical-align:sub; font-size:smaller; }
-sup { vertical-align:super; font-size:smaller; }
-
-pre { padding:15px; white-space:pre; white-space:pre-wrap; white-space:pre-line; word-wrap:break-word; }
-
-input[type="radio"] { vertical-align:text-bottom; }
-input[type="checkbox"] { vertical-align:bottom; *vertical-align:baseline; }
-.ie6 input { vertical-align:text-bottom; }
-label, input[type=button], input[type=submit], button { cursor:pointer; }
-
-::-moz-selection{ background:#FF5E99; color:#fff; text-shadow:none; }
-::selection { background:#FF5E99; color:#fff; text-shadow:none; }
-
-a:link { -webkit-tap-highlight-color:#FF5E99; }
-
-html { overflow-y:scroll; }
-button { width:auto; overflow:visible; }
-.ie7 img { -ms-interpolation-mode:bicubic; }
-
-.ir { display:block; text-indent:-999em; overflow:hidden; background-repeat:no-repeat; }
-.hidden { display:none; visibility:hidden; }
-.visuallyhidden { position:absolute !important; clip:rect(1px 1px 1px 1px); clip:rect(1px, 1px, 1px, 1px); }
-.invisible { visibility:hidden; }
-.clearfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; }
-.clearfix { display:inline-block; }
-* html .clearfix { height:1%; }
-.clearfix { display:block; }
-
-
-
-
-/* Primary Styles
- Author:
-*/
-body{
- background-color:#ecf5e5;
-}
-input, label, button{
- cursor:pointer;
-}
-
-
-#calper-init{
-
-}
-#calper-init h1{
- font-size:1.3em;
- line-height:1.6em;
- margin-bottom:7px;
- border-bottom:1px solid #d6dde4;
-}
-#calper-init p, #calper-init label, #calper-init input{
- line-height:1.5em;
-}
-#calper-init .init-options label{
- float:left;
- margin-right:20px;
-}
-#calper-init .init-options input{
- width:50px;
- float:left;
-}
-#calper-init .init-options{
- width:250px;
- float:left;
- margin-bottom:7px;
- padding-left:20px;
-}
-#calper-init .init-choices{
- width:142px;
- float:left;
- padding-left:20px;
- margin-right:20px;
- border-left:1px solid #d6dde4;
-}
-#calper-init .init-choices:nth-child(4n-3){
- border-left:0 none;
-}
-#calper-init .init-choices input{
- float:right;
-}
-#init-start{
- float:right;
-}
-
-
-#calper-running{
- text-align:center;
-}
-
-
-#test-table{
- width:100%;
- margin-top:10px;
- border:2px solid #b1d1ed;
- -moz-border-radius:4px;
- -webkit-border-radius:4px;
- border-radius:4px;
-}
-#test-table th{
- padding:8px 0;
-}
-#calper-table tr:last-child{
- -webkit-border-bottom-right-radius:4px;
- -webkit-border-bottom-left-radius:4px;
- -moz-border-radius-bottomright:4px;
- -moz-border-radius-bottomleft:4px;
- border-bottom-right-radius:4px;
- border-bottom-left-radius:4px;
-}
-#calper-table tr:last-child td:first-child{
- -webkit-border-bottom-left-radius:2px;
- -moz-border-radius-bottomleft:2px;
- border-bottom-left-radius:2px;
-}
-#calper-table tr:last-child td:last-child{
- -webkit-border-bottom-right-radius:2px;
- -moz-border-radius-bottomright:2px;
- border-bottom-right-radius:2px;
-}
-#calper-table td{
- background-color:#fff;
- border-top:1px solid #b1d1ed;
- color:#000;
- text-align:right;
- padding:6px 0;
-}
-#rem-time{
- float:right;
-}
-.data-graph{
- text-align:center !important;
- width:410px;
-}
-.calper-data-title{
- font-weight:bold;
- text-align:left !important;
- text-indent:12px;
-}
-
-.select-all{
- float: right;
-}
-
-#calper-footer{
- text-align:center;
- margin-top:10px;
-}
-
-
-.main-holder{
- background-color:#185fa1;
- color:#fff;
-
- width:830px;
- position:absolute;
- top:30px;
- left:50%;
- margin-left:-425px;
- padding:20px 10px;
-
- -moz-border-radius:8px;
- -webkit-border-radius:8px;
- border-radius:8px;
-
- -moz-box-shadow:0px 0px 4px #000;
- -webkit-box-shadow:0px 0px 4px #000;
- box-shadow:0px 0px 4px #000;
-}
-.baseline-content{
- margin-top:35px;
- clear:both;
-}
-.error-overlay{
- position:fixed;
- width:350px;
- top:75px;
- left:50%;
- margin-left:-178px;
- border:3px solid #dd7876;
- background-color:#ffeceb;
- padding:10px;
- font-size:1.6em;
- text-align:center;
-
- -moz-border-radius:8px;
- -webkit-border-radius:8px;
- border-radius:8px;
-
- -moz-box-shadow:0px 0px 4px #000;
- -webkit-box-shadow:0px 0px 4px #000;
- box-shadow:0px 0px 4px #000;
-}
-
-
-.line-clear{
- width:100%;
- height:0;
- display:block;
- clear:both;
-}
-.hoverable{
- cursor:pointer;
-}
-
-
-
-
-/*
- * print styles
- */
-@media print {
- * { background:transparent !important; color:#444 !important; text-shadow:none; }
- a, a:visited { color:#444 !important; text-decoration:underline; }
- a:after { content:" (" attr(href) ")"; }
- abbr:after { content:" (" attr(title) ")"; }
- .ir a:after { content:""; } /* Don't show links for images */
- pre, blockquote { border:1px solid #999; page-break-inside:avoid; }
- img { page-break-inside:avoid; }
- @page { margin:0.5cm; }
- p, h2, h3 { orphans:3; widows:3; }
- h2, h3{ page-break-after:avoid; }
-}
-
-
-
-@media all and (orientation:portrait) {
-
-}
-
-@media all and (orientation:landscape) {
-
-}
-
-/* Grade-A Mobile Browsers */
-@media screen and (max-device-width:480px) {
- html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; }
-
-}
Oops, something went wrong.

0 comments on commit 4ca723b

Please sign in to comment.