Пример #1
0
        public void CreateReferenceAndSetNull_FailingTest()
        {
            StringMarshaler m  = new StringMarshaler();
            Exception       ex = Assert.Throws <NullReferenceException>(() => m.Set(null));

            Assert.Equal("Object reference not set to an instance of an object.", ex.Message);
        }
Пример #2
0
        public int RunAsMain(Function f, uint argC, string[] argV, string[] envP)
        {
            var marshaledArgv = StringMarshaler.MarshalArray(argV);
            var marshaledEnvp = StringMarshaler.MarshalArray(envP);

            return(LLVM.RunFunctionAsMain(this.Unwrap(), f.Unwrap(), argC, out marshaledArgv[0], out marshaledEnvp[0]));
        }
Пример #3
0
        public new static void Marshal(ManagedExceptionNativeInfo value, Stream stream)
        {
            NativeUnitMarshaler <ManagedExceptionNativeInfo> .Marshal(value, stream);

            UInt64Marshaler.Marshal(value.ClassId, stream);
            StringMarshaler.Marshal(value.Message, stream);
            MarshalingManager.Marshal(value.Stack, stream);
        }
Пример #4
0
 public static void Marshal(T value, Stream stream)
 {
     UInt64Marshaler.Marshal(value.Uid, stream);
     UInt64Marshaler.Marshal(value.Id, stream);
     UInt64Marshaler.Marshal(value.BeginLifetime, stream);
     UInt64Marshaler.Marshal(value.EndLifetime, stream);
     StringMarshaler.Marshal(value.Name, stream);
 }
Пример #5
0
        public new static ManagedExceptionNativeInfo Demarshal(Stream stream)
        {
            ManagedExceptionNativeInfo unit = NativeUnitMarshaler <ManagedExceptionNativeInfo> .Demarshal(stream);

            unit.ClassId = UInt64Marshaler.Demarshal(stream);
            unit.Message = StringMarshaler.Demarshal(stream);
            unit.Stack   = MarshalingManager.Demarshal <ulong[]>(stream);
            return(unit);
        }
Пример #6
0
        public void CreateReferenceAndSetIteratorToFirst_PassingTest()
        {
            StringMarshaler   m = new StringMarshaler();
            Iterator <string> i = new Iterator <string>(testData);

            m.Set(i);

            Assert.Equal(testData[0], m.Value);
            Assert.Equal(testData[1], i.Current);
        }
Пример #7
0
        public static T Demarshal(Stream stream)
        {
            T value = new T();

            value.Uid           = UInt32Marshaler.Demarshal(stream);
            value.Id            = UInt64Marshaler.Demarshal(stream);
            value.BeginLifetime = UInt32Marshaler.Demarshal(stream);
            value.EndLifetime   = UInt32Marshaler.Demarshal(stream);
            value.Name          = StringMarshaler.Demarshal(stream);
            return(value);
        }
Пример #8
0
        public void CreateReferenceAndSetIteratorToLast_FailingTest()
        {
            StringMarshaler   m = new StringMarshaler();
            Iterator <string> i = new Iterator <string>(testData);

            for (int j = 0; j < this.testData.Count; j++)
            {
                i.Next();
            }

            Exception             ex     = Record.Exception(() => m.Set(i));
            BaseArgumentException exBase = ex as BaseArgumentException ?? throw new XunitException("Wrong exception type!");

            exBase.ErrorArgumentId = this.testArgument;

            Assert.Equal(ErrorCode.MISSING, exBase.ErrorCode);
            Assert.Equal(this.testArgument, exBase.ErrorArgumentId);
            Assert.Equal($"Could not find string parameter for -{this.testArgument}", exBase.ErrorMessage());
        }
Пример #9
0
        public void CreateRefernceAndTestSchema_PassingTest()
        {
            StringMarshaler m = new StringMarshaler();

            Assert.Equal(testSchema, m.Schema);
        }
Пример #10
0
        public static void ParseCommandLineOptions(int argc, string[] argv, string overview)
        {
            var marshaledArgv = StringMarshaler.MarshalArray(argv);

            LLVM.ParseCommandLineOptions(argc, out marshaledArgv[0], overview);
        }