Skip to content

Commit

Permalink
add simple method existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Aug 17, 2015
1 parent bb2fca0 commit d0b7e37
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 52 deletions.
44 changes: 44 additions & 0 deletions js/dist/graph-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,49 @@ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr =

var set = _require2.set;

var type = require("aureooms-js-type");

/* js/src/001-spec */
/* js/src/001-spec/00-methods.js */

var methods = function methods(title, Constructor) {

test("graph-spec : check existence of methods > " + title, function (assert) {

assert.ok(type.isfunction(Constructor), "constructor");

var G = new Constructor();

assert.ok(type.isfunction(G.vadd), "vadd");
assert.ok(type.isfunction(G.vdel), "vdel");
assert.ok(type.isfunction(G.eadd), "eadd");
assert.ok(type.isfunction(G.edel), "edel");
assert.ok(G.vitr != null, "vitr");
assert.ok(G.eitr != null, "eitr");
assert.ok(G.iitr != null, "iitr");
assert.ok(G.initr != null, "initr");
assert.ok(G.outitr != null, "outitr");
assert.ok(G.nitr != null, "nitr");
assert.ok(G.dsitr != null, "dsitr");
assert.ok(G.dpitr != null, "dpitr");
assert.ok(G.vertices != null, "vertices");
assert.ok(G.edges != null, "edges");
assert.ok(G.incident != null, "incident");
assert.ok(G.ingoing != null, "ingoing");
assert.ok(G.outgoing != null, "outgoing");
assert.ok(G.endpoints != null, "endpoints");
assert.ok(G.reverse != null, "reverse");
});
};

exports.methods = methods;

/* js/src/001-spec/01-Graph.js */

var Graph = function Graph(title, Constructor) {

methods(title, Constructor);

test("graph-spec : Graph simple test > " + title, function (assert) {

var G = new Constructor();
Expand Down Expand Up @@ -1046,6 +1084,8 @@ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr =

var MultiGraph = function MultiGraph(title, Constructor) {

methods(title, Constructor);

test("graph-spec : MultiGraph simple test > " + title, function (assert) {

var G = new Constructor();
Expand Down Expand Up @@ -1727,6 +1767,8 @@ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr =

var DiGraph = function DiGraph(title, Constructor) {

methods(title, Constructor);

test("graph-spec : DiGraph simple test > " + title, function (assert) {

var G = new Constructor();
Expand Down Expand Up @@ -2460,6 +2502,8 @@ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr =

var MultiDiGraph = function MultiDiGraph(title, Constructor) {

methods(title, Constructor);

test("graph-spec : MultiDiGraph simple test > " + title, function (assert) {

var G = new Constructor();
Expand Down
2 changes: 1 addition & 1 deletion js/dist/graph-spec.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/dist/graph-spec.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions js/src/000-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
const { exhaust : ex , chain , all , map , range , list , zip } = require( "aureooms-js-itertools" ) ;
const cardinality = require( "aureooms-js-cardinality" ) ;
const { set } = require( "aureooms-js-collections" ) ;
const type = require( "aureooms-js-type" ) ;

35 changes: 35 additions & 0 deletions js/src/001-spec/00-methods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@


const methods = function ( title , Constructor ) {

test( "graph-spec : check existence of methods > " + title , function ( assert ) {

assert.ok( type.isfunction( Constructor ) , "constructor" ) ;

const G = new Constructor( ) ;

assert.ok( type.isfunction( G.vadd ) , "vadd" ) ;
assert.ok( type.isfunction( G.vdel ) , "vdel" ) ;
assert.ok( type.isfunction( G.eadd ) , "eadd" ) ;
assert.ok( type.isfunction( G.edel ) , "edel" ) ;
assert.ok( G.vitr != null , "vitr" ) ;
assert.ok( G.eitr != null , "eitr" ) ;
assert.ok( G.iitr != null , "iitr" ) ;
assert.ok( G.initr != null , "initr" ) ;
assert.ok( G.outitr != null , "outitr" ) ;
assert.ok( G.nitr != null , "nitr" ) ;
assert.ok( G.dsitr != null , "dsitr" ) ;
assert.ok( G.dpitr != null , "dpitr" ) ;
assert.ok( G.vertices != null , "vertices" ) ;
assert.ok( G.edges != null , "edges" ) ;
assert.ok( G.incident != null , "incident" ) ;
assert.ok( G.ingoing != null , "ingoing" ) ;
assert.ok( G.outgoing != null , "outgoing" ) ;
assert.ok( G.endpoints != null , "endpoints" ) ;
assert.ok( G.reverse != null , "reverse" ) ;

} ) ;

} ;

exports.methods = methods ;
2 changes: 2 additions & 0 deletions js/src/001-spec/01-Graph.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

const Graph = function ( title , Constructor ) {

methods( title , Constructor ) ;

test( "graph-spec : Graph simple test > " + title , function ( assert ) {

const G = new Constructor( ) ;
Expand Down
2 changes: 2 additions & 0 deletions js/src/001-spec/02-MultiGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

const MultiGraph = function ( title , Constructor ) {

methods( title , Constructor ) ;

test( "graph-spec : MultiGraph simple test > " + title , function ( assert ) {

const G = new Constructor( ) ;
Expand Down
2 changes: 2 additions & 0 deletions js/src/001-spec/03-DiGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

const DiGraph = function ( title , Constructor ) {

methods( title , Constructor ) ;

test( "graph-spec : DiGraph simple test > " + title , function ( assert ) {

const G = new Constructor( ) ;
Expand Down
2 changes: 2 additions & 0 deletions js/src/001-spec/04-MultiDiGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

const MultiDiGraph = function ( title , Constructor ) {

methods( title , Constructor ) ;

test( "graph-spec : MultiDiGraph simple test > " + title , function ( assert ) {

const G = new Constructor( ) ;
Expand Down
91 changes: 46 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
{
"main": "js/dist/graph-spec.js",
"author": "aureooms",
"keywords": [
"bricks",
"directed",
"ender",
"graph",
"javascript",
"js",
"spec",
"specification",
"undirected"
],
"scripts": {
"build": "./node_modules/.bin/aureooms-node-package-build",
"doc": "./node_modules/.bin/groc",
"test": "./node_modules/.bin/aureooms-node-package-test"
},
"name": "aureooms-js-graph-spec",
"homepage": "http://aureooms.github.io/js-graph-spec/",
"version": "5.0.1",
"description": "Graph specification code bricks for JavaScript",
"dependencies": {
"aureooms-js-itertools": "^1.2.0",
"aureooms-js-cardinality": "^1.1.0",
"aureooms-js-collections": "^1.0.0"
},
"license": "AGPL-3.0",
"spm": {
"main": "js/dist/graph-spec.js"
},
"devDependencies": {
"aureooms-js-adjacency-list": "^4.0.5",
"aureooms-js-adjacency-matrix": "^3.1.5",
"aureooms-js-dll": "^6.0.9",
"aureooms-node-package": "^5.0.2"
},
"bugs": {
"url": "https://github.com/aureooms/js-graph-spec/issues"
},
"repository": {
"url": "https://github.com/aureooms/js-graph-spec.git",
"type": "git"
}
}
"main": "js/dist/graph-spec.js",
"author": "aureooms",
"keywords": [
"bricks",
"directed",
"ender",
"graph",
"javascript",
"js",
"spec",
"specification",
"undirected"
],
"scripts": {
"build": "./node_modules/.bin/aureooms-node-package-build",
"doc": "./node_modules/.bin/groc",
"test": "./node_modules/.bin/aureooms-node-package-test"
},
"name": "aureooms-js-graph-spec",
"homepage": "http://aureooms.github.io/js-graph-spec/",
"version": "5.0.1",
"description": "Graph specification code bricks for JavaScript",
"dependencies": {
"aureooms-js-cardinality": "^1.1.0",
"aureooms-js-collections": "^1.0.0",
"aureooms-js-itertools": "^1.2.0",
"aureooms-js-type": "^1.0.2"
},
"license": "AGPL-3.0",
"spm": {
"main": "js/dist/graph-spec.js"
},
"devDependencies": {
"aureooms-js-adjacency-list": "^4.0.5",
"aureooms-js-adjacency-matrix": "^3.1.5",
"aureooms-js-dll": "^6.0.9",
"aureooms-node-package": "^5.0.2"
},
"bugs": {
"url": "https://github.com/aureooms/js-graph-spec/issues"
},
"repository": {
"url": "https://github.com/aureooms/js-graph-spec.git",
"type": "git"
}
}
8 changes: 4 additions & 4 deletions test/js/src/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var adjacencymatrix = require( "aureooms-js-adjacency-matrix" ) ;

var List = dll.DoublyLinkedList ;

spec.Graph( "Adjacency Matrix" , adjacencymatrix.Graph ) ;
spec.MultiGraph( "Adjacency List" , adjacencylist.MultiGraph( List ) ) ;
spec.DiGraph( "Adjacency Matrix" , adjacencymatrix.DiGraph ) ;
spec.MultiDiGraph( "Adjacency List" , adjacencylist.MultiDiGraph( List , Map ) ) ;
spec.Graph( "Adjacency Matrix Graph" , adjacencymatrix.Graph ) ;
spec.MultiGraph( "Adjacency List MultiGraph" , adjacencylist.MultiGraph( List ) ) ;
spec.DiGraph( "Adjacency Matrix DiGraph" , adjacencymatrix.DiGraph ) ;
spec.MultiDiGraph( "Adjacency List MultiDiGraph" , adjacencylist.MultiDiGraph( List , Map ) ) ;

0 comments on commit d0b7e37

Please sign in to comment.