Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test file for internal apis #47

Merged
merged 1 commit into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions packages/perspective/test/js/constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,6 @@ module.exports = (perspective) => {
expect(arrow_result).toEqual(result);
});

it("Arrow schema", async function () {
// This only works for non parallel
var table = perspective.table(arrow);
let schema, stypes;
let types = [];
try{
schema = table.gnode.get_tblschema();
stypes = schema.types();

for (let i = 0; i < stypes.size(); i ++) {
types.push(stypes.get(i).value);
}
expect(arrow_psp_internal_schema).toEqual(types);
} finally {
if (schema) {
schema.delete();
}
if (stypes) {
stypes.delete();
}
}
});

it("CSV constructor", async function () {
var table = perspective.table(csv);
var view = table.view();
Expand Down
45 changes: 45 additions & 0 deletions packages/perspective/test/js/internal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/



import arrow from "../arrow/test-null.arrow";

var arrow_psp_internal_schema = [9, 10, 1, 2, 3, 4, 11, 19, 19, 12, 12, 12, 2];


module.exports = (perspective) => {

describe("Internal API", function () {

it("Arrow schema types are mapped correctly", async function () {
// This only works for non parallel
var table = perspective.table(arrow.slice());
let schema, stypes;
let types = [];
try{
schema = table.gnode.get_tblschema();
stypes = schema.types();

for (let i = 0; i < stypes.size(); i ++) {
types.push(stypes.get(i).value);
}
expect(arrow_psp_internal_schema).toEqual(types);
} finally {
if (schema) {
schema.delete();
}
if (stypes) {
stypes.delete();
}
}
});

});
}
2 changes: 2 additions & 0 deletions packages/perspective/test/js/perspective.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const constructor_tests = require("./constructors.js");
const pivot_tests = require("./pivots.js");
const update_tests = require("./updates.js");
const filter_tests = require("./filters.js");
const internal_tests = require('./internal.js');

describe("perspective.js", function() {

Expand All @@ -46,6 +47,7 @@ describe("perspective.js", function() {
pivot_tests(RUNTIMES[mode]);
update_tests(RUNTIMES[mode]);
filter_tests(RUNTIMES[mode]);
internal_tests(RUNTIMES[mode]);

});

Expand Down
4 changes: 4 additions & 0 deletions packages/perspective/test/js/test_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const constructor_tests = require("./constructors.js");
const pivot_tests = require("./pivots.js");
const update_tests = require("./updates.js");
const filter_tests = require("./filters.js");
const internal_tests = require('./internal.js');

const RUNTIMES = {
'WASM': perspective_wasm,
Expand All @@ -35,6 +36,9 @@ describe("perspective.js", function() {
update_tests(RUNTIMES[mode]);
filter_tests(RUNTIMES[mode]);

if (mode !== 'Parallel') {
internal_tests(RUNTIMES[mode]);
}
});

});
Expand Down