Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Initial version of realsense node javascript API testing
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyunfeix committed Oct 25, 2016
1 parent f049a2a commit 055828e
Show file tree
Hide file tree
Showing 73 changed files with 3,237 additions and 0 deletions.
24 changes: 24 additions & 0 deletions misc/nodeapi-realsense-tests/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2016 Intel Corporation.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of works must retain the original copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the original copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this work without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 changes: 17 additions & 0 deletions misc/nodeapi-realsense-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# RealSense Node JavaScript Test Suite

## Introduction

This test suite is for checking compliance with RealSense node API specification:
* https://github.com/otcshare/node-realsense/tree/master/src

## Authors

* Hao, Yunfei <[email protected]>
* Zhao, Ming <[email protected]>

## LICENSE

Copyright (c) 2016 Intel Corporation.
Except as noted, this software is licensed under BSD-3-Clause License.
Please see the COPYING file for the BSD-3-Clause License.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict"

const assert = require('assert');
var module = require('./pt.js');
var enum_group = [];

enum_group.push("access-order-by-id")

enum_group.push('invalid');

function _test(i) {
describe('check enum AccessOrder', function(){
it('checking member of AccessOrder: '+ enum_group[i], function(done) {

TODO:

});
});
}

for (var x in enum_group) {
_test(x);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict"

const assert = require("chai").assert;
const path = require('path');
var addon;

beforeEach(() => {
});

afterEach(() => {
});

describe('BoundingBox2DInfo API Test', function () {

describe('API Existance', function() {
it('addon.BoundingBox2DInfo is exist', function() {
assert.isTrue(typeof(addon.BoundingBox2DInfo) !== 'undefined' )
});

it('addon.BoundingBox2DInfo type is correct', function() {
assert.typeOf(addon.BoundingBox2DInfo,'function');
});

it('addon.BoundingBox2DInfo() object has a Rect attribute .rect', function () {
var test_obj = addon[ii.newMap['BoundingBox2DInfo']];
assert.typeOf(test_obj.rect,'Rect');
});

it('addon.BoundingBox2DInfo() object has a number attribute .confidence', function () {
var test_obj = addon[ii.newMap['BoundingBox2DInfo']];
assert.typeOf(test_obj.confidence,'number');
});

});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use strict"

const assert = require('assert');
var module = require('./pt.js');
var enum_group = [];

enum_group.push("classified")

enum_group.push("need-different-view-point")

enum_group.push("not-classified")

enum_group.push('invalid');

function _test(i) {
describe('check enum ClassifyResult', function(){
it('checking member of ClassifyResult: '+ enum_group[i], function(done) {

TODO:

});
});
}

for (var x in enum_group) {
_test(x);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict"

const assert = require('assert');
var module = require('./pt.js');
var enum_group = [];

enum_group.push("CPU")

enum_group.push("GPU")

enum_group.push('invalid');

function _test(i) {
describe('check enum ComputeEngine', function(){
it('checking member of ComputeEngine: '+ enum_group[i], function(done) {

TODO:

});
});
}

for (var x in enum_group) {
_test(x);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"use strict"

const assert = require('assert');
var module = require('./pt.js');
var enum_group = [];

enum_group.push("auto")

enum_group.push("close-range")

enum_group.push("mid-range")

enum_group.push("far-range")

enum_group.push("all")

enum_group.push('invalid');

function _test(i) {
describe('check enum DetectionMode', function(){
it('checking member of DetectionMode: '+ enum_group[i], function(done) {

var cfg = {}
cfg['detectMode']['tracking'] = enum_group[i];
var instance = new module.Instance(cfg);
instance.getInstanceConfig().then(data => {
assert.equal(data.tracking.detectMode, enum_group[i]);
done();
});

});
});
}

for (var x in enum_group) {
_test(x);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict"

const assert = require("chai").assert;
const path = require('path');
var addon;

beforeEach(() => {
});

afterEach(() => {
});

describe('EventData API Test', function () {

describe('API Existance', function() {
it('addon.EventData is exist', function() {
assert.isTrue(typeof(addon.EventData) !== 'undefined' )
});

it('addon.EventData type is correct', function() {
assert.typeOf(addon.EventData,'function');
});

it('addon.EventData() object has a TrackingAccuracy attribute .accuracy', function () {
var test_obj = addon[ii.newMap['EventData']];
assert.typeOf(test_obj.accuracy,'TrackingAccuracy');
});

it('addon.EventData() object has a number attribute .cameraPose', function () {
var test_obj = addon[ii.newMap['EventData']];
assert.typeOf(test_obj.cameraPose,'number');
});

});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"use strict"

const assert = require('assert');
var module = require('./pt.js');
var enum_group = [];

enum_group.push("neutral")

enum_group.push("happiness")

enum_group.push("sadness")

enum_group.push("surprise")

enum_group.push("fear")

enum_group.push("anger")

enum_group.push("disgust")

enum_group.push("contempt")

enum_group.push('invalid');

function _test(i) {
describe('check enum Expression', function(){
it('checking member of Expression: '+ enum_group[i], function(done) {

TODO:

});
});
}

for (var x in enum_group) {
_test(x);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use strict"

const assert = require("chai").assert;
const path = require('path');
var addon;

beforeEach(() => {
});

afterEach(() => {
});

describe('ExpressionData API Test', function () {

describe('API Existance', function() {
it('addon.ExpressionData is exist', function() {
assert.isTrue(typeof(addon.ExpressionData) !== 'undefined' )
});

it('addon.ExpressionData type is correct', function() {
assert.typeOf(addon.ExpressionData,'function');
});

it('addon.ExpressionData() object has a ExpressionInfo attribute .infos', function () {
var test_obj = addon[ii.newMap['ExpressionData']];
assert.typeOf(test_obj.infos,'ExpressionInfo');
});

});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict"

const assert = require("chai").assert;
const path = require('path');
var addon;

beforeEach(() => {
});

afterEach(() => {
});

describe('ExpressionInfo API Test', function () {

describe('API Existance', function() {
it('addon.ExpressionInfo is exist', function() {
assert.isTrue(typeof(addon.ExpressionInfo) !== 'undefined' )
});

it('addon.ExpressionInfo type is correct', function() {
assert.typeOf(addon.ExpressionInfo,'function');
});

it('addon.ExpressionInfo() object has a Expression attribute .type', function () {
var test_obj = addon[ii.newMap['ExpressionInfo']];
assert.typeOf(test_obj.type,'Expression');
});

it('addon.ExpressionInfo() object has a number attribute .confidence', function () {
var test_obj = addon[ii.newMap['ExpressionInfo']];
assert.typeOf(test_obj.confidence,'number');
});

});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict"

const assert = require("chai").assert;
const path = require('path');
var addon;

beforeEach(() => {
});

afterEach(() => {
});

describe('FaceLandmark API Test', function () {

describe('API Existance', function() {
it('addon.FaceLandmark is exist', function() {
assert.isTrue(typeof(addon.FaceLandmark) !== 'undefined' )
});

it('addon.FaceLandmark type is correct', function() {
assert.typeOf(addon.FaceLandmark,'function');
});

it('addon.FaceLandmark() object has a Point3D attribute .image', function () {
var test_obj = addon[ii.newMap['FaceLandmark']];
assert.typeOf(test_obj.image,'Point3D');
});

it('addon.FaceLandmark() object has a Point3D attribute .world', function () {
var test_obj = addon[ii.newMap['FaceLandmark']];
assert.typeOf(test_obj.world,'Point3D');
});

});

});
Loading

0 comments on commit 055828e

Please sign in to comment.