// public static void complex_ptr_in() // { // } // public static void complex_ptr_in_own() // { // } public static void complex_out() { var complex = new test.StructComplex(); test.ITesting t = new test.Testing(); bool r = t.StructComplexOut(out complex); Test.Assert(r, "Function returned false"); checkStructComplex(complex); }
private static test.StructComplex structComplexWithValues() { var complex = new test.StructComplex(); complex.Farray = new eina.Array <int>(); complex.Farray.Push(0x0); complex.Farray.Push(0x2A); complex.Farray.Push(0x42); complex.Finarray = new eina.Inarray <int>(); complex.Finarray.Push(0x0); complex.Finarray.Push(0x2A); complex.Finarray.Push(0x42); complex.Flist = new eina.List <string>(); complex.Flist.Append("0x0"); complex.Flist.Append("0x2A"); complex.Flist.Append("0x42"); complex.Finlist = new eina.Inlist <int>(); complex.Finlist.Append(0x0); complex.Finlist.Append(0x2A); complex.Finlist.Append(0x42); complex.Fhash = new eina.Hash <string, string>(); complex.Fhash["aa"] = "aaa"; complex.Fhash["bb"] = "bbb"; complex.Fhash["cc"] = "ccc"; complex.Fiterator = complex.Farray.GetIterator(); complex.Fany_value = new eina.Value(eina.ValueType.Double); complex.Fany_value.Set(-9007199254740992.0); complex.Fany_value_ptr = new eina.Value(eina.ValueType.String); complex.Fany_value_ptr.Set("abc"); complex.Fbinbuf = new eina.Binbuf(); complex.Fbinbuf.Append(126); complex.Fslice.Length = 1; complex.Fslice.Mem = eina.MemoryNative.Alloc(1); Marshal.WriteByte(complex.Fslice.Mem, 125); complex.Fobj = new test.Numberwrapper(); complex.Fobj.SetNumber(42); return(complex); }
private static void checkZeroedStructComplex(test.StructComplex complex) { Test.Assert(complex.Farray == null); Test.Assert(complex.Finarray == null); Test.Assert(complex.Flist == null); Test.Assert(complex.Finlist == null); Test.Assert(complex.Fhash == null); Test.Assert(complex.Fiterator == null); Test.Assert(complex.Fany_value == null); Test.Assert(complex.Fany_value_ptr == null); Test.Assert(complex.Fbinbuf == null); Test.Assert(complex.Fslice.Length == 0); Test.Assert(complex.Fslice.Mem == IntPtr.Zero); Test.Assert(complex.Fobj == null); }
private static void checkStructComplex(test.StructComplex complex) { Test.Assert(complex.Farray.ToArray().SequenceEqual(base_seq_int)); Test.Assert(complex.Finarray.ToArray().SequenceEqual(base_seq_int)); Test.Assert(complex.Flist.ToArray().SequenceEqual(base_seq_str)); Test.Assert(complex.Finlist.ToArray().SequenceEqual(base_seq_int)); Test.Assert(complex.Fhash["aa"] == "aaa"); Test.Assert(complex.Fhash["bb"] == "bbb"); Test.Assert(complex.Fhash["cc"] == "ccc"); int idx = 0; foreach (int e in complex.Fiterator) { Test.Assert(e == base_seq_int[idx]); ++idx; } double double_val = 0; Test.Assert(complex.Fany_value.Get(out double_val)); Test.Assert(double_val == -9007199254740992.0); string str_val = null; Test.Assert(complex.Fany_value_ptr.Get(out str_val)); Test.Assert(str_val == "abc"); Test.Assert(complex.Fbinbuf.Length == 1); Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126); Test.Assert(complex.Fslice.Length == 1); Test.Assert(complex.Fslice.GetBytes()[0] == 125); Test.Assert(complex.Fobj != null); Test.Assert(complex.Fobj.GetNumber() == 42); }
private static void complex_default_instantiation() { var complex = new test.StructComplex(); checkZeroedStructComplex(complex); }