Skip to content
Browse files

Added some simple tests

  • Loading branch information...
1 parent 514118a commit c69237660ec1e7debefff7e2317ef3aa7bc6655c @davglass committed
Showing with 32 additions and 0 deletions.
  1. +32 −0 tests/test.js
View
32 tests/test.js
@@ -0,0 +1,32 @@
+var vows = require('vows'),
+ assert = require('assert'),
+ proc = require('getrusage');
+
+vows.describe('Test Loading and Bindings').addBatch({
+ 'Should be loaded': {
+ topic: function () {
+ return proc
+ },
+ 'should have 3 methods': function (topic) {
+ assert.isFunction(topic.usage);
+ assert.isFunction(topic.getcputime);
+ assert.isFunction(topic.getsystemtime);
+ },
+ 'proc.usage() should return an object': function(topic) {
+ var usage = topic.usage();
+ var keys = [ 'utime','stime','maxrss','ixrss','idrss','isrss','minflt','majflt','nswap','inblock','oublock','msgsnd','msgrcv','nsignals','nvcsw','nivcsw'];
+ assert.isObject(usage);
+ assert.deepEqual(Object.keys(usage), keys);
+ },
+ 'proc.getcputime() should return a number': function(topic) {
+ var time = topic.getcputime();
+ assert.isNumber(time);
+ assert.isTrue((time > 0));
+ },
+ 'proc.getsystemtime() should return a number': function(topic) {
+ var time = topic.getsystemtime();
+ assert.isNumber(time);
+ assert.isTrue((time > 0));
+ }
+ }
+}).export(module);

0 comments on commit c692376

Please sign in to comment.
Something went wrong with that request. Please try again.