"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Test_1 = require("../Test");
const Types_1 = require("../../../Types");
const StructHelpers_1 = require("./StructHelpers");
const TypeRegistry_1 = require("../../../TypeRegistry");
describe('TsGen', () => {
    describe('class', () => {
        it('simple', () => {
            const result = StructHelpers_1.generateClass(Types_1.mockIl2CppTypeDefinitionInfo({ TypeName: 'SomeType', Namespace: 'Test' }), Test_1.fakeContext);
            expect(Test_1.printTsNode(result)).toMatchInlineSnapshot(`
        "export class SomeType extends il2js.NativeStruct {
            public static [TypeName] = \\"Test.SomeType\\";
            static get size() { return 0; }
            public static fieldNames: string[] = [];
            public static staticMethods = {};
        }"
      `);
        });
        it('with address', () => {
            const result = StructHelpers_1.generateClass(Types_1.mockIl2CppTypeDefinitionInfo({ TypeName: 'SomeType', Namespace: 'Test', Address: 42 }), Test_1.fakeContext);
            expect(Test_1.printTsNode(result)).toMatchInlineSnapshot(`
        "export class SomeType extends il2js.NativeStruct {
            public static [TypeName] = \\"Test.SomeType\\";
            static get size() { return 0; }
            public static address = 42;
            public static fieldNames: string[] = [];
            public static staticMethods = {};
        }"
      `);
        });
        it('with members', () => {
            const result = StructHelpers_1.generateClass(Types_1.mockIl2CppTypeDefinitionInfo({ TypeName: 'SomeType', Namespace: 'Test' }, {
                ImageName: 'image',
                Fields: [
                    {
                        Type: Types_1.mockIl2CppTypeInfo({ TypeName: 'CString', Namespace: 'System', Indirection: 1 }),
                        Name: 'title',
                        Offset: 0x8,
                    },
                ],
            }), Test_1.fakeContext);
            expect(Test_1.printTsNode(result)).toMatchInlineSnapshot(`
        "export class SomeType extends il2js.NativeStruct {
            public static [TypeName] = \\"Test.SomeType\\";
            static get size() { return 0; }
            public static fieldNames: string[] = [];
            public static staticMethods = {};
        }"
      `);
        });
        it('with member pointer', () => {
            const result = StructHelpers_1.generateClass(Types_1.mockIl2CppTypeDefinitionInfo({ TypeName: 'SomeType', Namespace: 'Test' }, {
                ImageName: 'image',
                Fields: [
                    {
                        Type: Types_1.mockIl2CppTypeInfo({ TypeName: 'CString', Namespace: 'System', Indirection: 2 }),
                        Name: 'title',
                        Offset: 0x8,
                    },
                ],
            }), Test_1.fakeContext);
            expect(Test_1.printTsNode(result)).toMatchInlineSnapshot(`
        "export class SomeType extends il2js.NativeStruct {
            public static [TypeName] = \\"Test.SomeType\\";
            static get size() { return 0; }
            public static fieldNames: string[] = [];
            public static staticMethods = {};
        }"
      `);
        });
        it('with parent', () => {
            const result = StructHelpers_1.generateClass(Types_1.mockIl2CppTypeDefinitionInfo({
                TypeName: 'SomeType',
                Namespace: 'Test',
                BaseType: Types_1.mockIl2CppTypeInfo({ TypeName: 'Bar', Namespace: 'Foo' }),
            }), Test_1.fakeContext);
            expect(Test_1.printTsNode(result)).toMatchInlineSnapshot(`
        "export class SomeType extends il2js.NativeStruct {
            public static [TypeName] = \\"Test.SomeType\\";
            static get size() { return 0; }
            public static fieldNames: string[] = [];
            public static staticMethods = {};
        }"
      `);
        });
        it('with parent<T>', () => {
            const result = StructHelpers_1.generateClass(Types_1.mockIl2CppTypeDefinitionInfo({
                TypeName: 'SomeType',
                Namespace: 'Test',
                BaseType: Types_1.mockIl2CppTypeInfo({
                    TypeName: 'Bar',
                    Namespace: 'Foo',
                    TypeArguments: [Types_1.mockIl2CppTypeInfo({ TypeName: 'CString', Namespace: 'System' })],
                }),
            }), {
                rootNamespace: '',
                typeFunctions: {},
                types: new TypeRegistry_1.TypeRegistry(),
            });
            expect(Test_1.printTsNode(result)).toMatchInlineSnapshot(`
        "export class SomeType extends il2js.NativeStruct {
            public static [TypeName] = \\"Test.SomeType\\";
            static get size() { return 0; }
            public static fieldNames: string[] = [];
            public static staticMethods = {};
        }"
      `);
        });
    });
});
//# sourceMappingURL=StructHelpers.test.js.map