public void WriteManagedToJavaWithNoTypes() { var v = new TypeNameMapGenerator(new string[0], logger: Diagnostic.CreateConsoleLogger()); var o = new MemoryStream(); v.WriteManagedToJava(o); var a = ToArray(o); Assert.AreEqual(52, a.Length); }
public void WriteManagedToJava() { var types = SupportDeclarations.GetTestTypeDefinitions(); var v = new TypeNameMapGenerator(types, logger: Diagnostic.CreateConsoleLogger()); var o = new MemoryStream(); v.WriteManagedToJava(o); var a = ToArray(o); Save(a, "__m2j"); var length = 190; var offset = 114; var e = "version=1\u0000" + $"entry-count={types.Count}\u0000" + "entry-len=" + length + "\u0000" + "value-offset=" + offset + "\u0000" + GetM2JEntryLine(typeof(AbstractClass), "my/AbstractClass", offset, length) + GetM2JEntryLine(typeof(AbstractClassInvoker), "my/AbstractClass", offset, length) + GetM2JEntryLine(typeof(ActivityName), "activity/Name", offset, length) + GetM2JEntryLine(typeof(ApplicationName), "application/Name", offset, length) + GetM2JEntryLine(typeof(DefaultName.A.B), "crc64197ae30a36756915/DefaultName_A_B", offset, length) + GetM2JEntryLine(typeof(DefaultName.A), "crc64197ae30a36756915/DefaultName_A", offset, length) + GetM2JEntryLine(typeof(DefaultName.C.D), "crc64197ae30a36756915/DefaultName_C_D", offset, length) + GetM2JEntryLine(typeof(DefaultName), "crc64197ae30a36756915/DefaultName", offset, length) + GetM2JEntryLine(typeof(ExampleActivity), "my/ExampleActivity", offset, length) + GetM2JEntryLine(typeof(ExampleInstrumentation), "my/ExampleInstrumentation", offset, length) + GetM2JEntryLine(typeof(ExampleOuterClass.ExampleInnerClass), "crc64197ae30a36756915/ExampleOuterClass$ExampleOuterClass_ExampleInnerClass", offset, length) + GetM2JEntryLine(typeof(ExampleOuterClass), "crc64197ae30a36756915/ExampleOuterClass", offset, length) + GetM2JEntryLine(typeof(InstrumentationName), "instrumentation/Name", offset, length) + GetM2JEntryLine(typeof(NonStaticOuterClass.NonStaticInnerClass), "register/NonStaticOuterClass$NonStaticInnerClass", offset, length) + GetM2JEntryLine(typeof(NonStaticOuterClass), "register/NonStaticOuterClass", offset, length) + GetM2JEntryLine(typeof(ProviderName), "provider/Name", offset, length) + GetM2JEntryLine(typeof(ReceiverName), "receiver/Name", offset, length) + GetM2JEntryLine(typeof(RegisterName.DefaultNestedName), "register/Name_DefaultNestedName", offset, length) + GetM2JEntryLine(typeof(RegisterName.OverrideNestedName), "register/Name$Override", offset, length) + GetM2JEntryLine(typeof(RegisterName), "register/Name", offset, length) + GetM2JEntryLine(typeof(ServiceName), "service/Name", offset, length) + "\u0000"; var ex = Encoding.UTF8.GetBytes(e); Save(ex, "__m2j.ex"); CollectionAssert.AreEqual(ex, a); }
public void WriteManagedToJava() { var v = new TypeNameMapGenerator(SupportDeclarations.GetTestTypeDefinitions(), logMessage: Console.WriteLine); var o = new MemoryStream(); v.WriteManagedToJava(o); var a = ToArray(o); Save(a, "__m2j"); var length = 259; var offset = 169; var e = "version=1\u0000" + "entry-count=19\u0000" + "entry-len=" + length + "\u0000" + "value-offset=" + offset + "\u0000" + GetM2JEntryLine(typeof(AbstractClass), "my/AbstractClass", offset, length) + GetM2JEntryLine(typeof(AbstractClassInvoker), "my/AbstractClass", offset, length) + GetM2JEntryLine(typeof(ActivityName), "activity/Name", offset, length) + GetM2JEntryLine(typeof(ApplicationName), "application/Name", offset, length) + GetM2JEntryLine(typeof(DefaultName.A.B), "md5fef72cac46d04ae5bdc90af5bb6221ad/DefaultName_A_B", offset, length) + GetM2JEntryLine(typeof(DefaultName.A), "md5fef72cac46d04ae5bdc90af5bb6221ad/DefaultName_A", offset, length) + GetM2JEntryLine(typeof(DefaultName.C.D), "md5fef72cac46d04ae5bdc90af5bb6221ad/DefaultName_C_D", offset, length) + GetM2JEntryLine(typeof(DefaultName), "md5fef72cac46d04ae5bdc90af5bb6221ad/DefaultName", offset, length) + GetM2JEntryLine(typeof(ExampleOuterClass.ExampleInnerClass), "md5fef72cac46d04ae5bdc90af5bb6221ad/ExampleOuterClass$ExampleOuterClass_ExampleInnerClass", offset, length) + GetM2JEntryLine(typeof(ExampleOuterClass), "md5fef72cac46d04ae5bdc90af5bb6221ad/ExampleOuterClass", offset, length) + GetM2JEntryLine(typeof(InstrumentationName), "instrumentation/Name", offset, length) + GetM2JEntryLine(typeof(NonStaticOuterClass.NonStaticInnerClass), "register/NonStaticOuterClass$NonStaticInnerClass", offset, length) + GetM2JEntryLine(typeof(NonStaticOuterClass), "register/NonStaticOuterClass", offset, length) + GetM2JEntryLine(typeof(ProviderName), "provider/Name", offset, length) + GetM2JEntryLine(typeof(ReceiverName), "receiver/Name", offset, length) + GetM2JEntryLine(typeof(RegisterName.DefaultNestedName), "register/Name_DefaultNestedName", offset, length) + GetM2JEntryLine(typeof(RegisterName.OverrideNestedName), "register/Name$Override", offset, length) + GetM2JEntryLine(typeof(RegisterName), "register/Name", offset, length) + GetM2JEntryLine(typeof(ServiceName), "service/Name", offset, length) + "\u0000"; var ex = Encoding.UTF8.GetBytes(e); Save(ex, "__m2j.ex"); CollectionAssert.AreEqual(ex, a); }