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

Commit 055828e

Browse files
committed
Initial version of realsense node javascript API testing
1 parent f049a2a commit 055828e

File tree

73 files changed

+3237
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3237
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2016 Intel Corporation.
2+
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
5+
6+
* Redistributions of works must retain the original copyright notice, this list
7+
of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the original copyright notice,
9+
this list of conditions and the following disclaimer in the documentation
10+
and/or other materials provided with the distribution.
11+
* Neither the name of Intel Corporation nor the names of its contributors
12+
may be used to endorse or promote products derived from this work without
13+
specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
16+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18+
ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
19+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# RealSense Node JavaScript Test Suite
2+
3+
## Introduction
4+
5+
This test suite is for checking compliance with RealSense node API specification:
6+
* https://github.com/otcshare/node-realsense/tree/master/src
7+
8+
## Authors
9+
10+
* Hao, Yunfei <[email protected]>
11+
* Zhao, Ming <[email protected]>
12+
13+
## LICENSE
14+
15+
Copyright (c) 2016 Intel Corporation.
16+
Except as noted, this software is licensed under BSD-3-Clause License.
17+
Please see the COPYING file for the BSD-3-Clause License.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"use strict"
2+
3+
const assert = require('assert');
4+
var module = require('./pt.js');
5+
var enum_group = [];
6+
7+
enum_group.push("access-order-by-id")
8+
9+
enum_group.push('invalid');
10+
11+
function _test(i) {
12+
describe('check enum AccessOrder', function(){
13+
it('checking member of AccessOrder: '+ enum_group[i], function(done) {
14+
15+
TODO:
16+
17+
});
18+
});
19+
}
20+
21+
for (var x in enum_group) {
22+
_test(x);
23+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"use strict"
2+
3+
const assert = require("chai").assert;
4+
const path = require('path');
5+
var addon;
6+
7+
beforeEach(() => {
8+
});
9+
10+
afterEach(() => {
11+
});
12+
13+
describe('BoundingBox2DInfo API Test', function () {
14+
15+
describe('API Existance', function() {
16+
it('addon.BoundingBox2DInfo is exist', function() {
17+
assert.isTrue(typeof(addon.BoundingBox2DInfo) !== 'undefined' )
18+
});
19+
20+
it('addon.BoundingBox2DInfo type is correct', function() {
21+
assert.typeOf(addon.BoundingBox2DInfo,'function');
22+
});
23+
24+
it('addon.BoundingBox2DInfo() object has a Rect attribute .rect', function () {
25+
var test_obj = addon[ii.newMap['BoundingBox2DInfo']];
26+
assert.typeOf(test_obj.rect,'Rect');
27+
});
28+
29+
it('addon.BoundingBox2DInfo() object has a number attribute .confidence', function () {
30+
var test_obj = addon[ii.newMap['BoundingBox2DInfo']];
31+
assert.typeOf(test_obj.confidence,'number');
32+
});
33+
34+
});
35+
36+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"use strict"
2+
3+
const assert = require('assert');
4+
var module = require('./pt.js');
5+
var enum_group = [];
6+
7+
enum_group.push("classified")
8+
9+
enum_group.push("need-different-view-point")
10+
11+
enum_group.push("not-classified")
12+
13+
enum_group.push('invalid');
14+
15+
function _test(i) {
16+
describe('check enum ClassifyResult', function(){
17+
it('checking member of ClassifyResult: '+ enum_group[i], function(done) {
18+
19+
TODO:
20+
21+
});
22+
});
23+
}
24+
25+
for (var x in enum_group) {
26+
_test(x);
27+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use strict"
2+
3+
const assert = require('assert');
4+
var module = require('./pt.js');
5+
var enum_group = [];
6+
7+
enum_group.push("CPU")
8+
9+
enum_group.push("GPU")
10+
11+
enum_group.push('invalid');
12+
13+
function _test(i) {
14+
describe('check enum ComputeEngine', function(){
15+
it('checking member of ComputeEngine: '+ enum_group[i], function(done) {
16+
17+
TODO:
18+
19+
});
20+
});
21+
}
22+
23+
for (var x in enum_group) {
24+
_test(x);
25+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"use strict"
2+
3+
const assert = require('assert');
4+
var module = require('./pt.js');
5+
var enum_group = [];
6+
7+
enum_group.push("auto")
8+
9+
enum_group.push("close-range")
10+
11+
enum_group.push("mid-range")
12+
13+
enum_group.push("far-range")
14+
15+
enum_group.push("all")
16+
17+
enum_group.push('invalid');
18+
19+
function _test(i) {
20+
describe('check enum DetectionMode', function(){
21+
it('checking member of DetectionMode: '+ enum_group[i], function(done) {
22+
23+
var cfg = {}
24+
cfg['detectMode']['tracking'] = enum_group[i];
25+
var instance = new module.Instance(cfg);
26+
instance.getInstanceConfig().then(data => {
27+
assert.equal(data.tracking.detectMode, enum_group[i]);
28+
done();
29+
});
30+
31+
});
32+
});
33+
}
34+
35+
for (var x in enum_group) {
36+
_test(x);
37+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"use strict"
2+
3+
const assert = require("chai").assert;
4+
const path = require('path');
5+
var addon;
6+
7+
beforeEach(() => {
8+
});
9+
10+
afterEach(() => {
11+
});
12+
13+
describe('EventData API Test', function () {
14+
15+
describe('API Existance', function() {
16+
it('addon.EventData is exist', function() {
17+
assert.isTrue(typeof(addon.EventData) !== 'undefined' )
18+
});
19+
20+
it('addon.EventData type is correct', function() {
21+
assert.typeOf(addon.EventData,'function');
22+
});
23+
24+
it('addon.EventData() object has a TrackingAccuracy attribute .accuracy', function () {
25+
var test_obj = addon[ii.newMap['EventData']];
26+
assert.typeOf(test_obj.accuracy,'TrackingAccuracy');
27+
});
28+
29+
it('addon.EventData() object has a number attribute .cameraPose', function () {
30+
var test_obj = addon[ii.newMap['EventData']];
31+
assert.typeOf(test_obj.cameraPose,'number');
32+
});
33+
34+
});
35+
36+
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"use strict"
2+
3+
const assert = require('assert');
4+
var module = require('./pt.js');
5+
var enum_group = [];
6+
7+
enum_group.push("neutral")
8+
9+
enum_group.push("happiness")
10+
11+
enum_group.push("sadness")
12+
13+
enum_group.push("surprise")
14+
15+
enum_group.push("fear")
16+
17+
enum_group.push("anger")
18+
19+
enum_group.push("disgust")
20+
21+
enum_group.push("contempt")
22+
23+
enum_group.push('invalid');
24+
25+
function _test(i) {
26+
describe('check enum Expression', function(){
27+
it('checking member of Expression: '+ enum_group[i], function(done) {
28+
29+
TODO:
30+
31+
});
32+
});
33+
}
34+
35+
for (var x in enum_group) {
36+
_test(x);
37+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"use strict"
2+
3+
const assert = require("chai").assert;
4+
const path = require('path');
5+
var addon;
6+
7+
beforeEach(() => {
8+
});
9+
10+
afterEach(() => {
11+
});
12+
13+
describe('ExpressionData API Test', function () {
14+
15+
describe('API Existance', function() {
16+
it('addon.ExpressionData is exist', function() {
17+
assert.isTrue(typeof(addon.ExpressionData) !== 'undefined' )
18+
});
19+
20+
it('addon.ExpressionData type is correct', function() {
21+
assert.typeOf(addon.ExpressionData,'function');
22+
});
23+
24+
it('addon.ExpressionData() object has a ExpressionInfo attribute .infos', function () {
25+
var test_obj = addon[ii.newMap['ExpressionData']];
26+
assert.typeOf(test_obj.infos,'ExpressionInfo');
27+
});
28+
29+
});
30+
31+
});

0 commit comments

Comments
 (0)