Skip to content

Commit

Permalink
Set up travis, add first test
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jun 21, 2012
1 parent 4c876ac commit 724af7d
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 69 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.6
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://secure.travis-ci.org/tmcw/simple-statistics.png?branch=master)](http://travis-ci.org/tmcw/simple-statistics)

A project to learn about and make simple reference implementations
of statistics algorithms.

Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
linear_regression: require('./src/linear_regression.js')
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
"url": "git://github.com/tmcw/node-statistics.git"
},
"dependencies": {},
"devDependencies": {},
"devDependencies": {
"mocha": "1.2.x"
},
"optionalDependencies": {},
"scripts": {
"test": "mocha"
},
"engines": {
"node": "*"
}
Expand Down
2 changes: 2 additions & 0 deletions src/linear_regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function linear_regression() {
return linreg;
}

if (module && module.exports) module.exports = linear_regression;

// This implementation was influenced by
//
// * [Least squares in Javascript](http://dracoblue.net/dev/linear-least-squares-in-javascript/159/)
Expand Down
8 changes: 8 additions & 0 deletions test/linear_regression.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var assert = require('assert');
var ss = require('../index.js');

it('correctly generates a line for a 0, 0 to 1, 1 dataset', function() {
var l = ss.linear_regression().data([[0, 0], [1, 1]]);
assert.equal(l.line()(0), 0);
assert.equal(l.line()(1), 1);
});
19 changes: 0 additions & 19 deletions tests/bayes.test.js

This file was deleted.

16 changes: 0 additions & 16 deletions tests/id3.test.js

This file was deleted.

33 changes: 0 additions & 33 deletions tests/weather.js

This file was deleted.

0 comments on commit 724af7d

Please sign in to comment.