UNPKG

struffer

Version:
352 lines 11.2 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.default; } get defaultSize() { return 8; } basicGeneration(opts) { super.basicGeneration(opts); } instantiation(name, offset = null, types) { super.instantiation(name, offset, types); } memberSizeInvalidity() { alsatian_1.Expect(() => { const Test = index_1.default('Test', [ ['u3', 'foobar'], ]); }).toThrow(); } }; __decorate([ alsatian_1.TestCase({ byteLength: 3, bitLength: 24, types: ['i8', 'i16be'], }), alsatian_1.TestCase({ byteLength: 6, bitLength: 48, types: ['u8', 'i8', 'u32'], }), alsatian_1.TestCase({ byteLength: 4, bitLength: 32, types: ['i16', 'unsigned int_8 BE', 'uint8'], }), 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, ['uint8be', 'u16', 'i_be']), alsatian_1.TestCase('UnaCosa', 1, ['long int', 'long long uint', 'uint', 'i32', 'u16']), alsatian_1.TestCase('TypeTesting', undefined, ['signed long uint', 'short i', 'signed long u']), alsatian_1.Test('Struffer instantiation') ], FactoryTests.prototype, "instantiation", null); __decorate([ alsatian_1.Test('Struffer member size invalidity') ], FactoryTests.prototype, "memberSizeInvalidity", null); FactoryTests = __decorate([ alsatian_1.TestFixture('Struffer factory tests') ], FactoryTests); exports.FactoryTests = FactoryTests; let ObjectAPITests = class ObjectAPITests extends common_1.ObjectAPITestsBase { get factory() { return index_1.default; } get defaultSize() { return 8; } 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, 254, 224, 0, 0, 0, 255, 255, 0, 0, 12, 195, 255, 255, 255, 131], [ ['u8', 4], ['i8', -2], ['uint_be', 7], ['short int BE', -1], ['uint', 3267], ['int', -125], ]), alsatian_1.Test('Object API member retrieval') ], ObjectAPITests.prototype, "retrieval", null); __decorate([ alsatian_1.TestCase([ ['u8', 4], ['i8', -2], ['uint_be', 7], ['short int BE', -1], ['uint', 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('Struffer Object API tests') ], ObjectAPITests); exports.ObjectAPITests = ObjectAPITests; let MapAPITests = class MapAPITests extends common_1.MapAPITestsBase { get factory() { return index_1.default; } get defaultSize() { return 8; } 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, 254, 224, 0, 0, 0, 255, 255, 0, 0, 12, 195, 255, 255, 255, 131], [ ['u8', 4], ['i8', -2], ['uint_be', 7], ['short int BE', -1], ['uint', 3267], ['int', -125], ]), alsatian_1.Test('Map API member retrieval') ], MapAPITests.prototype, "retrieval", null); __decorate([ alsatian_1.TestCase([ ['u8', 4], ['i8', -2], ['uint_be', 7], ['short int BE', -1], ['uint', 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('Struffer Map API tests') ], MapAPITests); exports.MapAPITests = MapAPITests; let BatchAPITests = class BatchAPITests extends common_1.BatchAPITestsBase { get factory() { return index_1.default; } get defaultSize() { return 8; } 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, 254, 224, 0, 0, 0, 255, 255, 0, 0, 12, 195, 255, 255, 255, 131], [ ['u8', 4], ['i8', -2], ['uint_be', 7], ['short int BE', -1], ['uint', 3267], ['int', -125], ]), alsatian_1.Test('Batch API member retrieval') ], BatchAPITests.prototype, "retrieval", null); __decorate([ alsatian_1.TestCase([ ['u8', 4], ['i8', -2], ['uint_be', 7], ['short int BE', -1], ['uint', 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('Struffer Batch API tests') ], BatchAPITests); exports.BatchAPITests = BatchAPITests; class MiscellaneousTests extends common_1.MiscellaneousTestsBase { get factory() { return index_1.default; } get defaultSize() { return 8; } 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', [ ['u16', 'foo', 352], ['i8', 'bar', -2], ['unsigned byte BE', 'something', 255], ]), alsatian_1.Test('Accurate toString representation') ], MiscellaneousTests.prototype, "toString", null); __decorate([ alsatian_1.TestCase('FooStruff', [ ['u16', 'foo', 352], ['i8', 'bar', -2], ['unsigned byte BE', 'something', 255], ]), alsatian_1.Test('Accurate coercion') ], MiscellaneousTests.prototype, "coercion", null); __decorate([ alsatian_1.TestCase('FooStruff', [ ['u16', 'foo', 352], ['i8', 'bar', -2], ['unsigned byte BE', 'something', 255], ]), alsatian_1.Test('Accurate util.inspect representation') ], MiscellaneousTests.prototype, "inspection", null); exports.MiscellaneousTests = MiscellaneousTests; //# sourceMappingURL=struffer.test.js.map