mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
add unit test for coverage
This commit is contained in:
parent
d2566dd492
commit
fc5aa6bcc3
19
test/unit.js
19
test/unit.js
@ -449,5 +449,24 @@ test('setColor works will alpha channels', function(assert) {
|
||||
});
|
||||
});
|
||||
|
||||
test('toArray/fromArray working in both ways', function(assert) {
|
||||
var cv = require('../lib/opencv');
|
||||
|
||||
cv.readImage("./examples/files/mona.png", function(err, orig) {
|
||||
if (err) throw err;
|
||||
|
||||
var a = orig.toArray();
|
||||
var type = orig.type();
|
||||
var doubleConversion = cv.Matrix.fromArray(a, type).toArray();
|
||||
|
||||
var randomI = Math.floor(Math.random()*a.length)
|
||||
var randomJ = Math.floor(Math.random()*a[randomI].length)
|
||||
var randomK = Math.floor(Math.random()*a[randomI][randomJ].length)
|
||||
|
||||
assert.equal(a[randomI][randomJ][randomK], doubleConversion[randomI][randomJ][randomK]);
|
||||
assert.end();
|
||||
});
|
||||
});
|
||||
|
||||
// Test the examples folder.
|
||||
require('./examples')()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user