UNPKG

struffer

Version:
357 lines 11.7 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); const alsatian_1 = require("alsatian"); const index_1 = require("../src/index"); const common_1 = require("./common"); let FactoryTests = class FactoryTests extends common_1.FactoryTestsBase { get factory() { return index_1.AdvancedStruffer; } get defaultSize() { return 2; } basicGeneration(opts) { super.basicGeneration(opts); } instantiation(name, offset = null, types) { super.instantiation(name, offset, types); } }; __decorate([ alsatian_1.TestCase({ byteLength: 1, bitLength: 3, types: ['i2', 'i1be'], }), alsatian_1.TestCase({ byteLength: 3, bitLength: 17, types: ['u1', 'i3', 'u13'], }), alsatian_1.TestCase({ byteLength: 1, bitLength: 8, types: ['i5', 'unsigned int_2 BE', 'uint1'], }), alsatian_1.Test('Basic generation') ], FactoryTests.prototype, "basicGeneration", null); __decorate([ alsatian_1.TestCase('Foobar3000', undefined, ['byte', 'char', 'short', 'int', 'signed short int']), alsatian_1.TestCase('MisterTesty', 24, ['uint2be', 'u3', 'i_4be']), alsatian_1.TestCase('UnaCosa', 1, ['long int', 'long long uint', 'uint', 'i32', 'u12']), alsatian_1.TestCase('TypeTesting', undefined, ['signed long uint', 'short i', 'signed long u']), alsatian_1.Test('AdvancedStruffer instantiation') ], FactoryTests.prototype, "instantiation", null); FactoryTests = __decorate([ alsatian_1.TestFixture('AdvancedStruffer factory tests') ], FactoryTests); exports.FactoryTests = FactoryTests; let ObjectAPITests = class ObjectAPITests extends common_1.ObjectAPITestsBase { get factory() { return index_1.AdvancedStruffer; } get defaultSize() { return 2; } /* * some data bytes are separated so we know what bits correspond to who. * the third byte and part of the fourth byte belong to `uint13`. * part of the fourth byte, the fifth byte, the sixth byte and part of the * seventh byte belong to `int` */ // tslint:disable-next-line:max-line-length retrieval(bufferData, stuff) { super.retrieval(bufferData, stuff); } assignment(stuff) { super.assignment(stuff); } presence(...names) { super.presence(...names); } deletion(...names) { super.deletion(...names); } enumeration(...names) { super.enumeration(...names); } propertyDescription(...names) { super.propertyDescription(...names); } }; __decorate([ alsatian_1.TestCase([4, parseInt('110' + '111' + '11', 2), 102, parseInt('00011' + '111', 2), 255, 255, 252, 24], [ ['u8', 4], ['i3', -2], ['uint_3be', 7], ['int_2 BE', -1], ['uint13', 3267], ['int', -125], ]), alsatian_1.Test('Object API member retrieval') ], ObjectAPITests.prototype, "retrieval", null); __decorate([ alsatian_1.TestCase([ ['u8', 4], ['i3', -2], ['uint_3be', 7], ['int_2 BE', -1], ['uint13', 3267], ['int', -125], ]), alsatian_1.Test('Object API member assignment') ], ObjectAPITests.prototype, "assignment", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Object API member presence') ], ObjectAPITests.prototype, "presence", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Object API member "deletion"') ], ObjectAPITests.prototype, "deletion", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Object API member enumeration') ], ObjectAPITests.prototype, "enumeration", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Object API member property description') ], ObjectAPITests.prototype, "propertyDescription", null); ObjectAPITests = __decorate([ alsatian_1.TestFixture('AdvancedStruffer Object API tests') ], ObjectAPITests); exports.ObjectAPITests = ObjectAPITests; let MapAPITests = class MapAPITests extends common_1.MapAPITestsBase { get factory() { return index_1.AdvancedStruffer; } get defaultSize() { return 2; } /* * some data bytes are separated so we know what bits correspond to who. * the third byte and part of the fourth byte belong to `uint13`. * part of the fourth byte, the fifth byte, the sixth byte and part of the * seventh byte belong to `int` */ // tslint:disable-next-line:max-line-length retrieval(bufferData, stuff) { super.retrieval(bufferData, stuff); } assignment(stuff) { super.assignment(stuff); } presence(...names) { super.presence(...names); } deletion(...names) { super.deletion(...names); } enumeration(...names) { super.enumeration(...names); } clearance(...names) { super.clearance(...names); } iteration(thisArg = undefined, ...names) { super.iteration(thisArg, ...names); } valueEnumeration(...names) { super.valueEnumeration(...names); } entryEnumeration(...names) { super.entryEnumeration(...names); } automaticIteration(...names) { super.automaticIteration(...names); } }; __decorate([ alsatian_1.TestCase([4, parseInt('110' + '111' + '11', 2), 102, parseInt('00011' + '111', 2), 255, 255, 252, 24], [ ['u8', 4], ['i3', -2], ['uint_3be', 7], ['int_2 BE', -1], ['uint13', 3267], ['int', -125], ]), alsatian_1.Test('Map API member retrieval') ], MapAPITests.prototype, "retrieval", null); __decorate([ alsatian_1.TestCase([ ['u8', 4], ['i3', -2], ['uint_3be', 7], ['int_2 BE', -1], ['uint13', 3267], ['int', -125], ]), alsatian_1.Test('Map API member assignment') ], MapAPITests.prototype, "assignment", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Map API member presence') ], MapAPITests.prototype, "presence", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Map API member "deletion"') ], MapAPITests.prototype, "deletion", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Map API member enumeration') ], MapAPITests.prototype, "enumeration", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Map API member clearance') ], MapAPITests.prototype, "clearance", null); __decorate([ alsatian_1.TestCase(undefined, 'foobar', 'bar', 'foo', 'something', 'UTF-8-Up-Next...', '👍'), alsatian_1.TestCase({ me: true }, 'foobar', 'bar', 'foo', 'something', 'UTF-8-Up-Next...', '👍'), alsatian_1.Test('Map API member iteration') ], MapAPITests.prototype, "iteration", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Map API member value enumeration') ], MapAPITests.prototype, "valueEnumeration", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Map API member entry enumeration') ], MapAPITests.prototype, "entryEnumeration", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Map API member automatic iteration') ], MapAPITests.prototype, "automaticIteration", null); MapAPITests = __decorate([ alsatian_1.TestFixture('AdvancedStruffer Map API tests') ], MapAPITests); exports.MapAPITests = MapAPITests; let BatchAPITests = class BatchAPITests extends common_1.BatchAPITestsBase { get factory() { return index_1.AdvancedStruffer; } get defaultSize() { return 2; } // tslint:disable-next-line:max-line-length retrieval(bufferData, stuff) { super.retrieval(bufferData, stuff); } assignment(stuff) { super.assignment(stuff); } presence(...names) { super.presence(...names); } deletion(...names) { super.deletion(...names); } }; __decorate([ alsatian_1.TestCase([4, parseInt('110' + '111' + '11', 2), 102, parseInt('00011' + '111', 2), 255, 255, 252, 24], [ ['u8', 4], ['i3', -2], ['uint_3be', 7], ['int_2 BE', -1], ['uint13', 3267], ['int', -125], ]), alsatian_1.Test('Batch API member retrieval') ], BatchAPITests.prototype, "retrieval", null); __decorate([ alsatian_1.TestCase([ ['u8', 4], ['i3', -2], ['uint_3be', 7], ['int_2 BE', -1], ['uint13', 3267], ['int', -125], ]), alsatian_1.Test('Batch API member assignment') ], BatchAPITests.prototype, "assignment", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Batch API member presence') ], BatchAPITests.prototype, "presence", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Batch API member deletion') ], BatchAPITests.prototype, "deletion", null); BatchAPITests = __decorate([ alsatian_1.TestFixture('AdvancedStruffer Batch API tests') ], BatchAPITests); exports.BatchAPITests = BatchAPITests; class MiscellaneousTests extends common_1.MiscellaneousTestsBase { get factory() { return index_1.AdvancedStruffer; } get defaultSize() { return 2; } bitEnumeration(...names) { super.bitEnumeration(...names); } bitEntryEnumeration(...names) { super.bitEntryEnumeration(...names); } getBits() { super.getBits(); } setBits() { super.setBits(); } toString(name, members) { super.toString(name, members); } coercion(name, members) { super.coercion(name, members); } inspection(name, members) { super.inspection(name, members); } } __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Member bit enumeration') ], MiscellaneousTests.prototype, "bitEnumeration", null); __decorate([ common_1.CommonAPITestCase, alsatian_1.Test('Member bit entry enumeration') ], MiscellaneousTests.prototype, "bitEntryEnumeration", null); __decorate([ alsatian_1.Test('Member bit retrieval') ], MiscellaneousTests.prototype, "getBits", null); __decorate([ alsatian_1.Test('Member bit assignment') ], MiscellaneousTests.prototype, "setBits", null); __decorate([ alsatian_1.TestCase('FooStruff', [ ['u23', 'foo', 352], ['i3', 'bar', -2], ['unsigned byte BE', 'something', 255], ]), alsatian_1.Test('Accurate toString representation') ], MiscellaneousTests.prototype, "toString", null); __decorate([ alsatian_1.TestCase('FooStruff', [ ['u23', 'foo', 352], ['i3', 'bar', -2], ['unsigned byte BE', 'something', 255], ]), alsatian_1.Test('Accurate coercion') ], MiscellaneousTests.prototype, "coercion", null); __decorate([ alsatian_1.TestCase('FooStruff', [ ['u23', 'foo', 352], ['i3', 'bar', -2], ['unsigned byte BE', 'something', 255], ]), alsatian_1.Test('Accurate util.inspect representation') ], MiscellaneousTests.prototype, "inspection", null); exports.MiscellaneousTests = MiscellaneousTests; //# sourceMappingURL=advanced-struffer.test.js.map