UNPKG

gs-json

Version:

gs-JSON is a domain agnostic unifying 3D file format for geometric and semantic modelling (hence the 'gs').

146 lines (139 loc) 5.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.test_Topo_constructor = test_Topo_constructor; exports.test_Topo_getObjID = test_Topo_getObjID; exports.test_Topo_getGeom = test_Topo_getGeom; exports.test_Topo_getModel = test_Topo_getModel; exports.test_Topo_getAttribNames = test_Topo_getAttribNames; exports.test_Topo_getAttribValue = test_Topo_getAttribValue; exports.test_Topo_setAttribValue = test_Topo_setAttribValue; exports.test_Topo_getGroups = test_Topo_getGroups; var _gsJson = require("./gs-json"); var gs = _interopRequireWildcard(_gsJson); var _test_data = require("./test_data"); var td = _interopRequireWildcard(_test_data); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } describe("Tests for Topo class", function () { it("test_Topo_constructor", function () { expect(test_Topo_constructor()).toBe(true); }); it("test_Topo_getObjID", function () { expect(test_Topo_getObjID()).toBe(true); }); it("test_Topo_getGeom", function () { expect(test_Topo_getGeom()).toBe(true); }); it("test_Topo_getModel", function () { expect(test_Topo_getModel()).toBe(true); }); // it('test_Topo_getGeomType', () => { // expect( test_Topo_getGeomType() ).toBe(true); // }); it("test_Topo_getAttribNames", function () { expect(test_Topo_getAttribNames()).toBe(true); }); it("test_Topo_getAttribValue", function () { expect(test_Topo_getAttribValue()).toBe(true); }); it("test_Topo_setAttribValue", function () { expect(test_Topo_setAttribValue()).toBe(true); }); it("test_Topo_getGroups", function () { expect(test_Topo_getGroups()).toBe(true); }); }); function test_Topo_constructor() { // const k: Kernel = new Kernel(td.open_box()); // const path1: gs.ITopoPathData = {id: 0, tt: 1, ti: 0, st: 1, si: 0}; // // (0, gs.EGeomType.faces, 0, gs.EGeomType.edges, 0); // const path2: gs.ITopoPathData = {id: 0, tt: 1, ti: 0, st: 0, si: 0}; // // (0, gs.EGeomType.faces, 0, gs.EGeomType.vertices, 0); // const path3: gs.ITopoPathData = {id: 0, tt: 0, ti: 0, st: 1, si: 0}; // // (0, gs.EGeomType.wires, 0, gs.EGeomType.edges, 0); // const path4: gs.ITopoPathData = {id: 0, tt: 0, ti: 0, st: 0, si: 0}; // // (0, gs.EGeomType.wires, 0, gs.EGeomType.vertices, 0); // // the Top class is abstract // const f_e: gs.IEdge = new gs.Edge(k, path1); // const f_v: gs.IVertex = new gs.Vertex(k, path2); // const w_e: gs.IEdge = new gs.Edge(k, path3); // const w_v: gs.IVertex = new gs.Vertex(k, path4); return true; } function test_Topo_getObjID() { // const k: Kernel = new Kernel(td.open_box()); // const path: gs.ITopoPathData = {id: 0, tt: 1, ti: 0, st: 1, si: 0}; // // (0, gs.EGeomType.faces, 0, gs.EGeomType.edges, 0); // const e: gs.IEdge = new gs.Edge(k, path); // if(!(e.getObjID() === 0)) {return false;} return true; } function test_Topo_getGeom() { // const k: Kernel = new Kernel(td.open_box()); // const path: gs.ITopoPathData = {id: 0, tt: 1, ti: 0, st: 1, si: 0}; // // (0, gs.EGeomType.faces, 0, gs.EGeomType.edges, 0); // const e: gs.IEdge = new gs.Edge(k, path); // // if(!Arr.equal(e.getGeom().getPointIDs(), m.getGeom().getPointIDs())){return false;} return true; } function test_Topo_getModel() { // const k: Kernel = new Kernel(td.open_box()); // const path: gs.ITopoPathData = {id: 0, tt: 1, ti: 0, st: 1, si: 0}; // // (0, gs.EGeomType.faces, 0, gs.EGeomType.edges, 0); // const e: gs.IEdge = new gs.Edge(k, path); // // if(!Arr.equal(e.getModel().getGeom().getPointIDs(), m.getGeom().getPointIDs())){return false;} return true; } function test_Topo_getAttribNames() { // const k: Kernel = new Kernel(td.box_with_attribs()); // const path: gs.ITopoPathData = {id: 0, tt: 1, ti: 0, st: 1, si: 0}; // // (0, gs.EGeomType.faces, 0, gs.EGeomType.edges, 0); // const e: gs.IEdge = new gs.Edge(k, path); // if(!Arr.equal(e.getAttribNames(),["edge_id"])) {return false;} // // const path1: gs.ITopoPath = a1.getWires()[0].getTopoPath() ; return true; } function test_Topo_getAttribValue() { var m = new gs.Model(td.box_with_attribs()); var geom = m.getGeom(); var a1 = geom.getObj(0); var path1 = a1.getFaces()[0].getTopoPath(); if (!(geom.numTopos(gs.EGeomType.faces) === 6)) { return false; } var faces_id = m.getTopoAttrib("faces_id", gs.EGeomType.faces); if (!(a1.getFaces()[0].getAttribValue(faces_id) === 0)) { return false; } return true; } function test_Topo_setAttribValue() { var m = new gs.Model(td.box_with_attribs()); var geom = m.getGeom(); var a1 = geom.getObj(0); var path1 = a1.getFaces()[0].getTopoPath(); if (!(geom.numTopos(gs.EGeomType.faces) === 6)) { return false; } var faces_id = m.getTopoAttrib("faces_id", gs.EGeomType.faces); if (!(a1.getFaces()[0].getAttribValue(faces_id) === 0)) { return false; } a1.getFaces()[0].setAttribValue(faces_id, 49); if (a1.getFaces()[0].getAttribValue(faces_id) === 0) { return false; } if (!(a1.getFaces()[0].getAttribValue(faces_id) === 49)) { return false; } return true; } function test_Topo_getGroups() { var m = new gs.Model(td.box_with_attribs()); var g = m.getGeom(); var p = g.getObj(0); // TODO return true; } //# sourceMappingURL=_topo_tests.js.map