static S0 M4(byte arg0, short arg1, ulong arg2, S1 arg3, sbyte arg4) { arg3.F0.F3 = arg3.F4; arg3.F2 = 60051; arg3.F0.F0 = arg3.F0.F1; return(new S0(new C0(6984032767818396336UL, 9510612816836575691UL, 0, 127), 1UL, 1221518606U, 12294, new C0(0UL, 1UL, 0, -16), 1L)); }
static void M0() { long var0 = -5766193242987524694L; var0 = 9223372036854775806L; var0 = var0++; ulong var1 = (ulong)(-128 - M1(new C0((short)M1(new C0(5258, 1UL, -22183, -29371, 101), var0++, -70417790, new long[] { -104574387912924340L }, M2(0, s_6, 2, s_4, s_4.F4++, new long[] { -9223372036854775808L })), s_7, s_4.F2, s_4.F2, s_4.F4), s_6.F6, s_6.F7, new long[] { 654811172258269143L, -6662808390998894627L, 9223372036854775807L, -6998318517880700204L, -4682130570604720816L, -7871539898688320396L, 5519763522892085928L, -4994323005253093373L, 2474274635420194606L }, s_7)); { if (false || (s_4.F3 == '>')) { if (false) { s_5 = -102; } } { uint[] var2 = s_2; if (false) { { M3(new bool[][] { new bool[] { true }, new bool[] { true, false }, new bool[] { false }, new bool[] { false }, new bool[] { false, true }, new bool[] { true }, new bool[] { true, false }, new bool[] { true } }); M10(M12(87), new byte[] { 254, 223, 0, 207, 228, 105, 1 }, s_6.F0); S1 var3 = new S1((sbyte)M9(10L), false, s_6); s_6 = s_6; sbyte var4 = -10; var3.F0 = var4--; } s_6.F3 = -9223372036854775808L % (short)((short)(s_6.F2 | s_6.F0) | 1); char[][] var5 = new char[][] { new char[] { '7', 'J', '_', 'F', '7', 'e' }, new char[] { 'P' }, new char[] { ',', '/', 'v', 'T' }, new char[] { '0', '@', 'A', '+' }, new char[] { 'b', 'h', 'L', 'e', '^', '"' }, new char[] { 'O', 's', 'x', 'Z', 'j', 'F' } }; } } } }
static long M3(S1 arg2) { arg2 = new S1(1107856514, 44866, 1); arg2.F2 = (byte)(-1814316380 / (short)arg2.F0); System.Console.WriteLine(arg2.F2); return(-5854609374700736918L); }
public void StructParameterlessFunction() { S1 t = new S1(); var result = t.ParameterlessMethod(); Assert.AreEqual("Parameterless Method", result, "Incorrect Return Value for t.ParameterlessMethod"); }
static S1 M5() { if (false) { M6((long)(M7(M10(), '9', (int)M8(), (long)M7(M10(), (char)M8(), (int)M8(), 4212779369351903234L, M10(), new S0(new C0(18446744073709551615UL, 1UL, 13066, -50), 8669068212076503112UL, 10U, 65534, new C0(18446744073709551614UL, 10433559932533486456UL, 1, -46), -10L)), M10(), new S0(new C0(1UL, 1UL, 61425, -128), 0UL, 1802318369U, 1, new C0(1830720595806169986UL, 0UL, 0, -43), 2L)) & (byte)(1374335560 * (short)(0 | (short)M8())))); C0 var0 = new C0(1UL, 13411516252449935095UL, 1, -69); s_1 = 1521281036U; { var0.F2 = var0.F2++; var0.F3 = -111; int var1 = 1620789831; } var0.F2 = var0.F2; } else { s_1 = s_1; s_2 = s_2; if (false) { s_1 = s_1; } s_1 = s_1; S1 var2 = new S1(new C0(0UL, 9155222944381276077UL, 16178, 125), 15933816727119313894UL, 16510, -107, 0, '*', 7534, false); } return(new S1(new C0(672699011834134485UL, 0UL, 49893, 19), 0UL, 65534, 127, -127, 'R', 59758, true)); }
private async void ScrollViewViewChanging(object sender, ScrollViewerViewChangingEventArgs e) { try { var sc = sender as ScrollViewer; HandleGoUpRefreshButtons(sc); if (sc.VerticalOffset >= GridMainScrollViewer.ActualHeight && !tryingEnableSCs) { tryingEnableSCs = true; sc.DisableScroll(); S1?.EnableScroll(); S2?.EnableScroll(); //isMainScrollEnabled = false; ("DISABELING SC MAIN").PrintDebug(); GridMainScrollViewer.Height = 0; //SCMain.ChangeView(null, GridMainScrollViewer.ActualHeight, null); try { await Task.Delay(40); S1?.ChangeView(null, lastSC1Offset, null); S2?.ChangeView(null, lastSC2Offset, null); } catch { } await Task.Delay(500); tryingEnableSCs = false; } } catch { } }
private static void Main(string[] args) { S1 newItem = new S1() { Age = 11, Name = "John" }; D1 oldItem = new D1() { Age = 10 }; //there is an item in a database which is of D1 type. This convertor receives an object S1 in order to update the D1 item. // the rule is that Sx updatates Dx (where x is 1,2,3,4,5...) Convertor <S1, D1> convertor = new Convertor <S1, D1>(newItem, oldItem); S2 newItem2 = new S2() { City = "London", Name = "Lynda" }; D2 oldItem2 = new D2() { City = "Paris" }; Convertor <S2, D2> convertor2 = new Convertor <S2, D2>(newItem2, oldItem2); Console.ReadKey(); }
private static void allTests(Communicator communicator) { Console.Out.Write("testing equals() for Slice structures... "); Console.Out.Flush(); // // Define some default values. // C def_cls = new C(5); S1 def_s = new S1("name"); string[] def_ss = new string[] { "one", "two", "three" }; int[] def_il = new int[3]; def_il[0] = 1; def_il[1] = 2; def_il[2] = 3; var def_sd = new Dictionary <string, string>(); def_sd.Add("abc", "def"); var def_prx = IObjectPrx.Parse("test", communicator); _ = new S2(true, 98, 99, 100, 101, 1.0f, 2.0, "string", def_ss, def_il, def_sd, def_s, def_cls, def_prx); // // Compare default-constructed structures. // { Assert(new S2().Equals(new S2())); } Console.Out.WriteLine("ok"); }
static byte M4(short arg0) { char[] var0 = new char[] { '^', '<', 'v', '\'', '|' }; var0[0] = var0[0]; var0[0] = var0[0]; if (true) { { s_2 = s_2; if (s_2.F2.F0) { M5(); } M6(true, s_2, s_1++); } int[][] var1 = new int[][] { new int[] { 0, 1785475729, 2147483646 } }; } else { { s_2.F2.F1 = s_1; s_2.F3 = s_2.F3++; } s_2.F2.F2 = s_2.F2.F2; S0 var2 = s_2.F1; s_2.F2 = new S0(true, 6954, '5', 2L, 66, 0); } return(s_2.F3++); }
static long M5() { { short var0 = s_2.F2.F5; } { uint var1 = 1U; } M6(true, s_2, 0); if (s_2.F1.F0) { s_2.F2.F5 = s_2.F2.F5; byte var2 = 1; } else { s_2 = s_2; } M6(s_2.F1.F0, s_2, s_2.F1.F1); s_2.F2.F3 = (long)M6(s_2.F2.F0, s_2, 3584); return(s_2.F2.F3); }
public S2(short f0, S0 f1, S1 f2, uint f3) { F0 = f0; F1 = f1; F2 = f2; F3 = f3; }
public long M82(ref short[] arg0) { Runtime_71600.s_13 = this.F1++; S1 var1 = new S1(0); return(Runtime_71600.s_39[0].F1); }
static long M2(ulong arg0) { if (false) { ulong var0 = arg0; byte var1 = 254; if ('8' != 127) { arg0 = (ulong)(7455381553322460295L ^ (long)(65534 * (ushort)(M3((char)M4()) | 9223372036854775807L))); var0 = 11928294148317733625UL; } else { var0 = (ulong)M3('9'); } { arg0 *= arg0; } var1 = 1; } S1 var2 = new S1(2, -32767, true); arg0 = (ulong)M3((char)(-9223372036854775808L * (long)(arg0 % (uint)(569875673U | 1)))); return(-9223372036854775807L); }
public static void Test() { S2 <int> di = new S2 <int>(); S2 <string> ds = new S2 <string>(); S2 <object> d = new S2 <object>(); S1 <int> s1i = new S1 <int>(); S1 <string> s1s = new S1 <string>(); S1 <object> s1 = new S1 <object>(); I <S2 <int> > is2i = s1i; I <S2 <string> > is2s = s1s; I <S2 <object> > is2 = s1; is2i.m(di); is2s.m(ds); is2.m(d); I <S1 <int> > is1i = di; I <S1 <string> > is1s = ds; I <S1 <object> > is1 = d; is1i.m(s1i); is1s.m(s1s); is1.m(s1); }
static ushort[] M5(ushort arg0) { C0[] var0 = new C0[] { new C0(new S0(-1343378209177874991L), new S0(1626487047184424691L), 14338431731344779345UL, 80), new C0(new S0(9223372036854775807L), new S0(-7355287178831194485L), 1UL, -81), new C0(new S0(7371772918902697677L), new S0(8674983025391772085L), 1610263912013510191UL, 1), new C0(new S0(3144861531924677210L), new S0(-66661252930336962L), 3546514074252009448UL, -91), new C0(new S0(-4656092296110881961L), new S0(-3831680923676101008L), 18446744073709551614UL, 1), new C0(new S0(-6004127002962765200L), new S0(-8225654234112529760L), 10005550970466850414UL, -13), new C0(new S0(0L), new S0(2527934944983769946L), 18446744073709551614UL, 4), new C0(new S0(7816031718450076492L), new S0(-9223372036854775808L), 1UL, 126), new C0(new S0(-10L), new S0(-6281958666163577086L), 18446744073709551615UL, 1) }; { var0[0] = var0[0]; if (true) { var0[0].F0 = var0[0].F1; } else { s_7 = s_4; var0[0].F2 += var0[0].F2; S1 var1 = new S1(new C0(new S0(-2144620709378650667L), new S0(0L), 10UL, 2)); { if (false) { arg0 = arg0; var1.F0.F0.F0 = var0[0].F1.F0 | 1; var1.F0 = var1.F0; var1.F0.F0.F0 = 1L; M6(); } s_8 = 2; if (false) { sbyte var2 = var1.F0.F3; M7(); char[][] var3 = new char[][] { new char[] { '5', 'D', 'D', '=', 'R', 'O', ';' }, new char[] { '(', 'g', '<' }, new char[] { 'i', 'L', 'D', 'x' }, new char[] { 't', '3', 'q', 'Q', 'x', '8', 'T' }, new char[] { '`', 'Q' }, new char[] { 'd', '"', 'S' } }; } else { arg0 = 0; C0 var4 = new C0(new S0(-4267311932612672981L), new S0(-6168862286059639852L), 2741217338383289954UL, 1); M7(); var0[0].F1.F0 = 5555806712368512685L; var4.F3 = s_3; char[][] var5 = new char[][] { new char[] { 'g', 'n' }, new char[] { '5', ';', 'v', 'x', 'Y' }, new char[] { 'O', 'O', '2', '7' }, new char[] { '8', 's', 'm' }, new char[] { 'f', 'r', 'A', 'u' }, new char[] { '&', '{', 'V', 'D', '<' }, new char[] { '(' }, new char[] { '3' } }; } s_5 = s_5; } s_1 = (uint)(0L + (byte)M7()); var0[0].F1.F0 = var1.F0.F0.F0; } var0[0].F1 = var0[0].F1; } if (true) { s_3 = s_3--; M6(); } var0[0] = new C0(new S0(0L), new S0(-9223372036854775808L), 11365811670504873473UL, -89); return(new ushort[] { 45955, 19016, 0, 0, 1, 46550, 65535, 2, 48450, 43921 }); }
public void CharactersComparedOneByOne_Invariant(RegexOptions options) { // Regex compares characters one by one. If that changes, it could impact the behavior of // a case like this, where these characters are not the same, but the strings compare // as equal with the invariant culture (and some other cultures as well). const string S1 = "\u00D6\u200D"; const string S2 = "\u004F\u0308"; // Validate the chosen strings to make sure they compare the way we want to test via Regex Assert.False(S1[0] == S2[0]); Assert.False(S1[1] == S2[1]); Assert.StartsWith(S1, S2, StringComparison.InvariantCulture); Assert.True(S1.Equals(S2, StringComparison.InvariantCulture)); // Test varying lengths of strings to validate codegen changes that kick in at longer lengths foreach (int multiple in new[] { 1, 10, 100 }) { string pattern = string.Concat(Enumerable.Repeat(S1, multiple)); string input = string.Concat(Enumerable.Repeat(S2, multiple)); Regex r; // Validate when the string is at the beginning of the pattern, as it impacts Boyer-Moore prefix matching. r = new Regex(pattern, options); Assert.False(r.IsMatch(input)); Assert.True(r.IsMatch(pattern)); // Validate when it's not at the beginning of the pattern, as it impacts "multi" matching. r = new Regex("[abc]" + pattern, options); Assert.False(r.IsMatch("a" + input)); Assert.True(r.IsMatch("a" + pattern)); } }
public void ChangeValue(String Key, IEnumerable <int> Values) { isValid(); List <String> List1 = new List <String>(); String S = ""; foreach (int S1 in Values) { S += S1.ToString() + Splitter; } foreach (String s in File.ReadAllLines(FilePath)) { if (s.StartsWith("[" + Key + "]")) { if (Log != null) { Log.Write(LogID, "Entry: " + s + " :Was Changed to: " + "[" + Key + "]" + "=" + S + " :In: " + FilePath, new SEV_Info(), false); } List1.Add("[" + Key + "]" + "=" + S); } else { List1.Add(s); } } File.WriteAllLines(FilePath, List1); }
public int CompareTo(HexWeight other) { int cs0 = S0.CompareTo(other.S0); if (cs0 != 0) { return(cs0); } int cs1 = S1.CompareTo(other.S1); if (cs1 != 0) { return(cs1); } int cs2 = S2.CompareTo(other.S2); if (cs2 != 0) { return(cs2); } int cs3 = S3.CompareTo(other.S3); if (cs3 != 0) { return(cs3); } int cs4 = S4.CompareTo(other.S4); if (cs4 != 0) { return(cs4); } int cs5 = S5.CompareTo(other.S5); if (cs5 != 0) { return(cs5); } return(0); }
public void CalculateTest() { Input input = new Input { Set = 1, HargaKainA = 32, Lebar = 110, Tinggi = 104, HargaCincin = 7, Layout = "T", }; IFormula formula = new S1(); Output actual = formula.Calculate(input); Assert.AreEqual(actual.Jumlah, 261.60); Assert.AreEqual(actual.UpahKainA, 12); Assert.AreEqual(actual.UpahCincin, 44.80); Assert.AreEqual(actual.HargaKainA, 204.80); Assert.AreEqual(actual.Keping, 4); Assert.AreEqual(actual.TailorTotalKeping, 4); Assert.AreEqual(actual.TailorKeping, 2); Assert.AreEqual(actual.TailorMeterA, 3); Assert.AreEqual(actual.TailorKepingA, 2); Assert.IsTrue(actual.DetailedBreakdown.Contains("Jumlah")); Assert.IsTrue(actual.DetailedBreakdown.Contains("Harga")); input.Layout = "L"; actual = formula.Calculate(input); Assert.AreEqual(actual.TailorKeping, 4); Assert.AreEqual(actual.TailorMeterA, 5.88); Assert.AreEqual(actual.TailorKepingA, 1); }
static uint M7(ulong arg0, long arg1) { { { arg1 = arg1; if (true) { { arg1 = arg1; arg1 = arg1; arg1 = arg1; arg0 = 5530022416532008604UL; if (false) { ushort[][] var0 = new ushort[][] { new ushort[] { 7572, 65535 }, new ushort[] { 10, 0, 62862, 18580 }, new ushort[] { 1, 0, 24255, 16133 }, new ushort[] { 55187, 0, 46229, 61594 }, new ushort[] { 1, 43316, 19351 }, new ushort[] { 10, 65535, 47132, 38510 } }; var0[0] = new ushort[] { 50303, 10655, 0 }; arg0 %= (ulong)(arg0 | 1); } else { S0 var1 = new S0('G', 3288683166U, 0, false, 10817461041123516016UL, 32400, -7539173485063554328L); } } s_1 = new S1(false, 'e', new C0(31329, 1, 247, 1, -908209605, -127, false), '&', 1, false); } } } return(4277888664U); }
//ball.coeff. public void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "") { if (G == 0 || FC == 0 || D == 0) { MessageBox.Show(msgbox1); } else { if (g_check.Checked == true) { S1 = (G / (FC * (D * D))) * 1.442; } if (gr_check.Checked == true) { S1 = G / (FC * (D * D)); } label1.Text = S1.ToString("0.000"); } } else { MessageBox.Show(msgbox2); } }
private void form_services_Load(object sender, EventArgs e) { AddS.Enabled = true; Reset.Enabled = true; EditS.Enabled = false; DeleteS.Enabled = false; loadAll(); S1.Hide(); S2.Hide(); label1.Hide(); label2.Hide(); string select = "SELECT max(trt_id) from dc_trtmnt"; conn.Open(); MySqlCommand comm = new MySqlCommand(select, conn); MySqlDataAdapter adp = new MySqlDataAdapter(comm); comm.ExecuteNonQuery(); conn.Close(); DataTable dt = new DataTable(); adp.Fill(dt); if (dt.Rows.Count == 1) { int treat_id = (int)dt.Rows[0][0]; int add1 = treat_id + 1; label1.Text = "SC0" + add1; src_id.Text = label1.Text; src_id.Enabled = false; } }
static long[, ] M5(byte arg0, S1 arg1, C1 arg2) { if (arg2.F0) { arg2.F1 = arg2.F5.F2.F1--; if (true) { return(new long[, ] { { -1L, -2L, -5842655618513657623L, 4359718742095707754L, 1736333196000475670L, 0L, 0L, -5633452860715607723L, -10L }, { -1L, -4675626489485986974L, 7881759397048264442L, 3166400873011447273L, 5757568556805613609L, 2425272153434652111L, -2293910763557074231L, -9223372036854775807L, -6648199162226520823L }, { 5799015714767585250L, -10L, 7703428203223063055L, 4078000370160934518L, 9223372036854775807L, -4194552523580683606L, -2542307549365968412L, -10L, 0L } }); } arg2.F0 = true; } else { arg2.F5.F0 = arg2.F5.F0; arg2.F5.F2.F6 = false; arg2.F5.F3 = '0'; arg2.F5.F5 = false; ushort var0 = arg2.F5.F2.F1; } arg2.F5.F2.F2 = arg2.F5.F2.F2; return(new long[, ] { { 8031902024365547722L, 8520262681225877787L, 5194027635727659925L, 8010677708635688197L }, { -4718125768149936964L, -2454864269832924162L, 0L, -28979492287756874L }, { -3176037227211611932L, -9223372036854775808L, 6353958992132951506L, -145941704221088016L }, { 1L, -9223372036854775807L, 1327122562854222933L, 1L } }); }
public static uint M4(ref S1 arg1) { int var0 = s_3++; arg1.F6.F1 = 16700531892663534200UL; return(1); }
public short Method7(S1 p_s1_194, S2 p_s2_195, ref S2 p_s2_196, ref S2 p_s2_197, S1 p_s1_198, out S1 p_s1_199, S2 p_s2_200, S2 p_s2_201) { unchecked { short short_207 = 2; int int_208 = 0; switch (int_208 << int_25 + s_int_9) { case 1: { break; } case 5: { break; } case 2: { break; } default: { s_s1_17 = s1_33; break; } } return(short_207); } }
private void StrictSetEqual <S1, S2>() where S1 : IStrictSet <int>, new() where S2 : IStrictSet <int>, new() { var s1 = new S1(); var s2 = new S2(); Fill(s1, 0, 10000); Fill(s2, 0, 5000); Assert.False(s1.IsEqualWith(s2)); var s3 = new S1(); var s4 = new S2(); Fill(s3, 0, 1000); Fill(s4, 0, 1000); Assert.True(s3.IsEqualWith(s4)); var s5 = new S1(); var s6 = new S2(); Fill(s5, 0, 1000); Fill(s6, 1000, 1000); Assert.False(s5.IsEqualWith(s6)); var s7 = new S1(); var s8 = new S2(); Fill(s7, 0, 1000); Fill(s8, 0, 1999); Assert.False(s7.IsEqualWith(s8)); var s9 = new S1(); var s10 = new S2(); Assert.True(s9.IsEqualWith(s10)); }
static int Main () { var s = new S1 (); if (s.Value != 17) return 1; var s2 = new S2 (); if (s2.Value != 23) return 2; var s3 = new S3 (); if (s3.Value != 5) return 3; var s4 = new S4 (5); if (s4.Value != 11) return 4; var s5 = new S5 (2); if (s5.Value != 9) return 5; Console.WriteLine ("ok"); return 0; }
private void StrictSetDisjoint <S1, S2>() where S1 : IStrictSet <int>, new() where S2 : IStrictSet <int>, new() { var s1 = new S1(); var s2 = new S2(); Fill(s1, 0, 1000); Fill(s2, 1000, 2000); Assert.True(s1.IsDisjointWith(s2)); var s3 = new S1(); var s4 = new S2(); Fill(s3, 0, 2000); Fill(s4, 1000, 2000); Assert.False(s3.IsDisjointWith(s4)); var s5 = new S1(); var s6 = new S2(); Assert.True(s5.IsDisjointWith(s6)); var s7 = new S1(); var s8 = new S2(); Fill(s7, 0, 1000); Assert.True(s7.IsDisjointWith(s8)); Assert.True(s8.IsDisjointWith(s7)); }
private static void TestStructures() { S1 s1 = new S1(); TestS1_1(ref s1); TestS1_2(ref s1); S2 s2 = new S2(); TestS2_1(ref s2); TestS2_2(ref s2); S3 s3 = new S3(); TestS3_1(ref s3); TestS3_2(ref s3); S4 s4 = new S4(); TestS4_1(ref s4); TestS4_2(ref s4); S5 s5 = new S5 { a1 = "1", a2 = "2" }; TestS5_1(ref s5); TestS5_2(ref s5); }
public void BaseDispose() { // Explicit logout if we are in issuing page try { ResultState result = TestContext.CurrentContext.Result.Outcome; if ("PASSED" != result.Status.ToString().ToUpper() && takeScreenshot) { string filePrefix = TestContext.CurrentContext.Test.Name.Split(',')[0].Replace("\"", "").Replace("(", "").Replace(")", "").Replace("Test", "_"); string filepath = TestResultsDir + "/" + filePrefix + "_" + CurrentBrowser + DateTime.Now.ToString().Replace("/", "").Replace(":", "") + ".png"; TakeScreenshot(filepath); } else { takeScreenshot = true; } } catch (Exception) { } try { S1.Logout(); } catch (Exception) { } WebDriver.Quit(); }
public override Task RunAsync(string[] args) { Output.Write("testing Equals() for Slice structures... "); Output.Flush(); // Define some default values. var def_cls = new C(5); var def_s = new S1("name"); string[] def_ss = new string[] { "one", "two", "three" }; int[] def_il = new int[3] { 1, 2, 3 }; var def_sd = new Dictionary <string, string> { { "abc", "def" } }; var def_prx = IObjectPrx.Parse("test", Communicator); _ = new S2(true, 98, 99, 100, 101, 1.0f, 2.0, "string", def_ss, def_il, def_sd, def_s, def_cls, def_prx); // Compare default-constructed structures. Assert(new S2() == new S2()); var s3 = new S3("foo", new int[] { 4, 7, 10 }); var s3Copy = s3; Assert(s3 == s3Copy); Assert(s3.GetHashCode() == s3Copy.GetHashCode()); s3Copy.IntList = new int[] { 4, 7, 10 }; // same values, different object Assert(s3 != s3Copy); Assert(s3.GetHashCode() != s3Copy.GetHashCode()); // can be the same, just unlikely Output.WriteLine("ok"); return(Task.CompletedTask); }
public void TestPassStructAsObjectWithMutation() { Func<bool> f = () => { var s1 = new S1 { x = 0, y = 1 }; var r = MutateS1(s1); return r == 1 && s1.x == 0 && s1.y == 1; }; this.Test(f); }
public static int Main () { S1? s1 = new S1 (); switch (s1) { default: return 1; } }
public void DescribeTo() { P1 p1 = new P1(); P2 p2 = new P2(); S1 s1 = new S1(); S2 s2 = new S2(); this.testee.Register(p1); this.testee.Register(p2); this.testee.Register(s1); this.testee.Register(s2); StringWriter writer = new StringWriter(); this.testee.DescribeTo(writer); writer.Close(); writer.ToString(); }
public static int Main () { S1? s1 = new S1 (); switch (s1) { case 1: break; default: return 1; } S2? s2 = new S2 (); switch (s2) { case null: break; default: return 2; } S3? s3 = new S3 (); switch (s3) { case 2: break; default: return 3; } S4 s4 = new S4 (); switch (s4) { case 3: break; default: return 4; } return 0; }
private static void allTests(Ice.Communicator communicator) { Console.Out.Write("testing equals() for Slice structures... "); Console.Out.Flush(); // // Define some default values. // C def_cls = new C(5); S1 def_s = new S1("name"); string[] def_ss = new string[]{ "one", "two", "three" }; IntList def_il = new IntList(); def_il.Add(1); def_il.Add(2); def_il.Add(3); Dictionary<string, string> def_sd = new Dictionary<string, string>(); def_sd.Add("abc", "def"); Ice.ObjectPrx def_prx = communicator.stringToProxy("test"); S2 def_s2 = new S2(true, (byte)98, (short)99, 100, 101, (float)1.0, 2.0, "string", def_ss, def_il, def_sd, def_s, def_cls, def_prx); // // Compare default-constructed structures. // { test(new S2().Equals(new S2())); } // // Change one primitive member at a time. // { S2 v; v = (S2)def_s2.Clone(); test(v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.bo = false; test(!v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.by--; test(!v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.sh--; test(!v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.i--; test(!v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.l--; test(!v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.f--; test(!v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.d--; test(!v.Equals(def_s2)); v = (S2)def_s2.Clone(); v.str = ""; test(!v.Equals(def_s2)); } // // String member // { S2 v1, v2; v1 = (S2)def_s2.Clone(); v1.str = (string)def_s2.str.Clone(); test(v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.str = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v2.str = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.str = null; v2.str = null; test(v1.Equals(v2)); } // // Sequence member // { S2 v1, v2; v1 = (S2)def_s2.Clone(); v1.ss = (string[])def_s2.ss.Clone(); test(v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.ss = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v2.ss = null; test(!v1.Equals(v2)); } // // Custom sequence member // { S2 v1, v2; v1 = (S2)def_s2.Clone(); v1.il = (IntList)def_s2.il.Clone(); test(v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v1.il = new IntList(); test(!v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.il = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v2.il = null; test(!v1.Equals(v2)); } // // Dictionary member // { S2 v1, v2; v1 = (S2)def_s2.Clone(); v1.sd = new Dictionary<string, string>(def_s2.sd); test(v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v1.sd = new Dictionary<string, string>(); test(!v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.sd = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v2.sd = null; test(!v1.Equals(v2)); } // // Struct member // { S2 v1, v2; v1 = (S2)def_s2.Clone(); v1.s = (S1)def_s2.s.Clone(); test(v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v1.s = new S1("name"); test(v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v1.s = new S1("noname"); test(!v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.s = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v2.s = null; test(!v1.Equals(v2)); } // // Class member // { S2 v1, v2; v1 = (S2)def_s2.Clone(); v1.cls = (C)def_s2.cls.Clone(); test(!v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.cls = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v2.cls = null; test(!v1.Equals(v2)); } // // Proxy member // { S2 v1, v2; v1 = (S2)def_s2.Clone(); v1.prx = communicator.stringToProxy("test"); test(v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v1.prx = communicator.stringToProxy("test2"); test(!v1.Equals(def_s2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v1.prx = null; test(!v1.Equals(v2)); v1 = (S2)def_s2.Clone(); v2 = (S2)def_s2.Clone(); v2.prx = null; test(!v1.Equals(v2)); } Console.Out.WriteLine("ok"); }
public static extern S1 InvokeCallback1R(MyCallback1 callback, S1 s);
/* These tests are not working on non Windows CoreCLR. Enable this when GH Issue #2076 is resolved. [DllImport("jitstructtests_lib")] public static extern S28 InvokeCallback28R(MyCallback28 callback, S28 s); [DllImport("jitstructtests_lib")] public static extern S29 InvokeCallback29R(MyCallback29 callback, S29 s); Enable this when GH Issue #2076 is resolved. */ static public int Main1() { Program3 p = new Program3(); S1 s1 = new S1(); s1.x = 1; s1.y = 2; s1.z = 3; s1.w = 4; InvokeCallback1((par) => { Console.WriteLine("S1: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s1); S2 s2; s2.x = 1; s2.y = 2; s2.z = 3; InvokeCallback2((par) => { Console.WriteLine("S2: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s2); S3 s3; s3.x = 1; s3.y = 2; s3.z = 3; InvokeCallback3((par) => { Console.WriteLine("S3: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s3); S4 s4; s4.x = 1; s4.y = 2; InvokeCallback4((par) => { Console.WriteLine("S4: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s4); S5 s5; s5.x = 1; s5.y = 2; InvokeCallback5((par) => { Console.WriteLine("S5: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s5); S6 s6; s6.x = 1; s6.y = 2; s6.z = 3; s6.w = 4; InvokeCallback6((par) => { Console.WriteLine("S6: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s6); S7 s7; s7.x = 1; s7.y = 2; s7.z = 3; InvokeCallback7((par) => { Console.WriteLine("S7: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s7); S8 s8; s8.x = 1; s8.y = 2; InvokeCallback8((par) => { Console.WriteLine("S8: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s8); S9 s9; s9.x = 1; s9.y = 2; s9.z = 3; s9.w = 4; InvokeCallback9((par) => { Console.WriteLine("S9: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s9); S10 s10; s10.a = 1; s10.b = 2; s10.c = 3; s10.d = 4; s10.e = 5; s10.f = 6; s10.g = 7; s10.h = 8; InvokeCallback10((par) => { Console.WriteLine("S10: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}", par.a, par.b, par.c, par.d, par.e, par.f, par.g, par.h); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5 || par.f != 6 || par.g != 7 || par.h != 8) { throw new System.Exception(); } }, s10); S11 s11; s11.a = 1; s11.b = 2; s11.c = 3; s11.d = 4; s11.e = 5; InvokeCallback11((par) => { Console.WriteLine("S11: {0}, {1}, {2}, {3}, {4}", par.a, par.b, par.c, par.d, par.e); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5) { throw new System.Exception(); } }, s11); S12 s12; s12.a = 1; s12.b = 2; s12.c = 3; s12.d = 4; s12.e = 5; s12.f = 6; s12.g = 7; s12.h = 8; s12.i = 9; InvokeCallback12((par) => { Console.WriteLine("S12: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", par.a, par.b, par.c, par.d, par.e, par.f, par.g, par.h, par.i); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5 || par.f != 6 || par.g != 7 || par.h != 8 || par.i != 9) { throw new System.Exception(); } }, s12); S13 s13; s13.hasValue = 1; s13.x = 2; InvokeCallback13((par) => { Console.WriteLine("S13: {0}, {1}", par.hasValue, par.x); if (par.hasValue != 1 || par.x != 2) { throw new System.Exception(); } }, s13); S14 s14; s14.x = 1; s14.y = 2; InvokeCallback14((par) => { Console.WriteLine("S14: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s14); S15 s15; s15.a = 1; s15.b = 2; s15.c = 3; s15.d = 4; s15.e = 5; s15.f = 6; s15.g = 7; s15.h = 8; s15.i = 9; InvokeCallback15((par) => { Console.WriteLine("S15: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", par.a, par.b, par.c, par.d, par.e, par.f, par.g, par.h, par.i); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5 || par.f != 6 || par.g != 7 || par.h != 8 || par.i != 9) { throw new System.Exception(); } }, s15); S16 s16; s16.x = 1; s16.y = 2; InvokeCallback16((par) => { Console.WriteLine("S16: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s16); S17 s17; s17.x = 1; s17.y = 2; InvokeCallback17((par) => { Console.WriteLine("S17: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s17); S18 s18; s18.x = 1; s18.y = 2; s18.z = 3; InvokeCallback18((par) => { Console.WriteLine("S18: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s18); S19 s19; s19.x = 1; s19.y = 2; s19.z = 3; s19.w = 4; InvokeCallback19((par) => { Console.WriteLine("S19: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s19); S20 s20; s20.x = 1; s20.y = 2; s20.z = 3; s20.w = 4; InvokeCallback20((par) => { Console.WriteLine("S20: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s20); /* These tests are not working on non Windows CoreCLR. Enable this when GH Issue #2076 is resolved. TestClass testClass = new TestClass(); S28 s28; s28.x = null; s28.y = 1; InvokeCallback28((par) => { Console.WriteLine("S28: {0}, {1}", par.x == null ? "Null" : "Not null", par.y); if (par.x != null || par.y != 1) { throw new System.Exception(); } }, s28); s28.x = testClass; s28.y = 5; InvokeCallback28((par) => { Console.WriteLine("S28: {0}, {1}", par.x == null ? "Null" : "Not null", par.y); if (par.x != testClass || par.y != 5) { throw new System.Exception(); } }, s28); S29 s29; s29.x = 1; s29.y = null; InvokeCallback29((par) => { Console.WriteLine("S29: {0}, {1}", par.x, par.y == null ? "Null" : "Not null"); if (par.x != 1 || par.y != null) { throw new System.Exception(); } }, s29); s29.x = 5; s29.y = testClass; InvokeCallback29((par) => { Console.WriteLine("S29: {0}, {1}", par.x, par.y == null ? "Null" : "Not null"); if (par.x != 5 || par.y != testClass) { throw new System.Exception(); } }, s29); Enable this when GH Issue #2076 is resolved. */ S30 s30; s30.x = 1; s30.y = 2; S30 s30_2; s30_2.x = 3; s30_2.y = 4; S30 s30_3; s30_3.x = 5; s30_3.y = 6; // Program p = new Program(); InvokeCallback30(p.Test30, s30, s30_2, s30_3); S1 s1r = InvokeCallback1R((par) => { Console.WriteLine("S1: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s1); Console.WriteLine("S1R: {0}, {1}, {2}, {3}", s1r.x, s1r.y, s1r.z, s1r.w); if (s1r.x != 1 || s1r.y != 2 || s1r.z != 3 || s1r.w != 4) { throw new System.Exception(); } S2 s2r = InvokeCallback2R((par) => { Console.WriteLine("S2: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s2); Console.WriteLine("S2R: {0}, {1}, {2}", s2r.x, s2r.y, s2r.z); if (s2r.x != 1 || s2r.y != 2 || s2r.z != 3) { throw new System.Exception(); } S3 s3r = InvokeCallback3R((par) => { Console.WriteLine("S3: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s3); Console.WriteLine("S3R: {0}, {1}, {2}", s3r.x, s3r.y, s3r.z); if (s3r.x != 1 || s3r.y != 2 || s3r.z != 3) { throw new System.Exception(); } S4 s4r = InvokeCallback4R((par) => { Console.WriteLine("S4: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s4); Console.WriteLine("S4R: {0}, {1}", s4r.x, s4r.y); if (s4r.x != 1 || s4r.y != 2) { throw new System.Exception(); } S5 s5r = InvokeCallback5R((par) => { Console.WriteLine("S5: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s5); Console.WriteLine("S5R: {0}, {1}", s5r.x, s5r.y); if (s5r.x != 1 || s5r.y != 2) { throw new System.Exception(); } S6 s6r = InvokeCallback6R((par) => { Console.WriteLine("S6: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s6); Console.WriteLine("S6R: {0}, {1}, {2}, {3}", s6r.x, s6r.y, s6r.z, s6r.w); if (s6r.x != 1 || s6r.y != 2 || s6r.z != 3 || s6r.w != 4) { throw new System.Exception(); } S7 s7r = InvokeCallback7R((par) => { Console.WriteLine("S7: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s7); Console.WriteLine("S7R: {0}, {1}, {2}", s7r.x, s7r.y, s7r.z); if (s7r.x != 1 || s7r.y != 2 || s7r.z != 3) { throw new System.Exception(); } S8 s8r = InvokeCallback8R((par) => { Console.WriteLine("S8: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s8); Console.WriteLine("S8R: {0}, {1}", s8r.x, s8r.y); if (s8r.x != 1 || s8r.y != 2) { throw new System.Exception(); } S9 s9r = InvokeCallback9R((par) => { Console.WriteLine("S9: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s9); Console.WriteLine("S9R: {0}, {1}, {2}, {3}", s9r.x, s9r.y, s9r.z, s9r.w); if (s9r.x != 1 || s9r.y != 2 || s9r.z != 3 || s9r.w != 4) { throw new System.Exception(); } S10 s10r = InvokeCallback10R((par) => { Console.WriteLine("S10: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}", par.a, par.b, par.c, par.d, par.e, par.f, par.g, par.h); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5 || par.f != 6 || par.g != 7 || par.h != 8) { throw new System.Exception(); } }, s10); Console.WriteLine("S10R: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}", s10r.a, s10r.b, s10r.c, s10r.d, s10r.e, s10r.f, s10r.g, s10r.h); if (s10r.a != 1 || s10r.b != 2 || s10r.c != 3 || s10r.d != 4 || s10r.e != 5 || s10r.f != 6 || s10r.g != 7 || s10r.h != 8) { throw new System.Exception(); } S11 s11r = InvokeCallback11R((par) => { Console.WriteLine("S11: {0}, {1}, {2}, {3}, {4}", par.a, par.b, par.c, par.d, par.e); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5) { throw new System.Exception(); } }, s11); Console.WriteLine("S11R: {0}, {1}, {2}, {3}, {4}", s11r.a, s11r.b, s11r.c, s11r.d, s11r.e); if (s11r.a != 1 || s11r.b != 2 || s11r.c != 3 || s11r.d != 4 || s11r.e != 5) { throw new System.Exception(); } S12 s12r = InvokeCallback12R((par) => { Console.WriteLine("S12: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", par.a, par.b, par.c, par.d, par.e, par.f, par.g, par.h, par.i); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5 || par.f != 6 || par.g != 7 || par.h != 8 || par.i != 9) { throw new System.Exception(); } }, s12); Console.WriteLine("S12R: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", s12r.a, s12r.b, s12r.c, s12r.d, s12r.e, s12r.f, s12r.g, s12r.h, s12r.i); if (s12r.a != 1 || s12r.b != 2 || s12r.c != 3 || s12r.d != 4 || s12r.e != 5 || s12r.f != 6 || s12r.g != 7 || s12r.h != 8 || s12r.i != 9) { throw new System.Exception(); } S13 s13r = InvokeCallback13R((par) => { Console.WriteLine("S13: {0}, {1}", par.hasValue, par.x); if (par.hasValue != 1 || par.x != 2) { throw new System.Exception(); } }, s13); Console.WriteLine("S13R: {0}, {1}", s13r.hasValue, s13r.x); if (s13r.hasValue != 1 || s13r.x != 2) { throw new System.Exception(); } S14 s14r = InvokeCallback14R((par) => { Console.WriteLine("S14: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s14); Console.WriteLine("S14R: {0}, {1}", s14r.x, s14r.y); if (s14r.x != 1 || s14r.y != 2) { throw new System.Exception(); } S15 s15r = InvokeCallback15R((par) => { Console.WriteLine("S15: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", par.a, par.b, par.c, par.d, par.e, par.f, par.g, par.h, par.i); if (par.a != 1 || par.b != 2 || par.c != 3 || par.d != 4 || par.e != 5 || par.f != 6 || par.g != 7 || par.h != 8 || par.i != 9) { throw new System.Exception(); } }, s15); Console.WriteLine("S15R: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", s15r.a, s15r.b, s15r.c, s15r.d, s15r.e, s15r.f, s15r.g, s15r.h, s15r.i); if (s15r.a != 1 || s15r.b != 2 || s15r.c != 3 || s15r.d != 4 || s15r.e != 5 || s15r.f != 6 || s15r.g != 7 || s15r.h != 8 || s15r.i != 9) { throw new System.Exception(); } S16 s16r = InvokeCallback16R((par) => { Console.WriteLine("S16: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y != 2) { throw new System.Exception(); } }, s16); Console.WriteLine("S16R: {0}, {1}", s16r.x, s16r.y); if (s16r.x != 1 || s16r.y != 2) { throw new System.Exception(); } S17 s17r = InvokeCallback17R((par) => { Console.WriteLine("S17: {0}, {1}", par.x, par.y); if (par.x != 1 || par.y!= 2) { throw new System.Exception(); } }, s17); Console.WriteLine("S17R: {0}, {1}", s17r.x, s17r.y); if (s17r.x != 1 || s17r.y != 2) { throw new System.Exception(); } S18 s18r = InvokeCallback18R((par) => { Console.WriteLine("S18: {0}, {1}, {2}", par.x, par.y, par.z); if (par.x != 1 || par.y != 2 || par.z != 3) { throw new System.Exception(); } }, s18); Console.WriteLine("S18R: {0}, {1}, {2}", s18r.x, s18r.y, s18r.z); if (s18r.x != 1 || s18r.y != 2 || s18r.z != 3) { throw new System.Exception(); } S19 s19r = InvokeCallback19R((par) => { Console.WriteLine("S19: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s19); Console.WriteLine("S19R: {0}, {1}, {2}, {3}", s19r.x, s19r.y, s19r.z, s19r.w); if (s19r.x != 1 || s19r.y != 2 || s19r.z != 3 || s19r.w != 4) { throw new System.Exception(); } S20 s20r = InvokeCallback20R((par) => { Console.WriteLine("S20: {0}, {1}, {2}, {3}", par.x, par.y, par.z, par.w); if (par.x != 1 || par.y != 2 || par.z != 3 || par.w != 4) { throw new System.Exception(); } }, s20); Console.WriteLine("S20R: {0}, {1}, {2}, {3}", s20r.x, s20r.y, s20r.z, s20r.w); if (s20r.x != 1 || s20r.y != 2 || s20r.z != 3 || s20r.w != 4) { throw new System.Exception(); } /* These tests are not working on non Windows CoreCLR. Enable this when GH Issue #2076 is resolved. s28.x = null; S28 s28r = InvokeCallback28R((par) => { Console.WriteLine("S28: {0}, {1}", par.x == null ? "Null" : "Not null", par.y); if (par.x == null || par.y != 5) { throw new System.Exception(); } }, s28); Console.WriteLine("S28R: {0}, {1}", s28r.x == null ? "Null" : "Not null", s28r.y); if (s28r.x == null || s28r.y != 5) { throw new System.Exception(); } s28.x = testClass; s28.y = 5; s28r = InvokeCallback28R((par) => { Console.WriteLine("S28: {0}, {1}", par.x == null ? "Null" : "Not null", par.y); if (par.x != testClass || par.y != 5) { throw new System.Exception(); } }, s28); Console.WriteLine("S28R: {0}, {1}", s28r.x == null ? "Null" : "Not null", s28r.y); if (s28r.x != testClass || s28r.y != 5) { throw new System.Exception(); } s29.y = null; S29 s29r = InvokeCallback29R((par) => { Console.WriteLine("S29: {0}, {1}", par.x, par.y == null ? "Null" : "Not null"); if (par.x != 5 || par.y == null) { throw new System.Exception(); } }, s29); Console.WriteLine("S29R: {0}, {1}", s29r.x, s29r.y == null ? "Null" : "Not null"); if (s29r.x != 5 || s29r.y == null) { throw new System.Exception(); } s29.x = 5; s29.y = testClass; s29r = InvokeCallback29R((par) => { Console.WriteLine("S29: {0}, {1}", par.x, par.y == null ? "Null" : "Not null"); if (par.x != 5 || par.y != testClass) { throw new System.Exception(); } }, s29); Console.WriteLine("S29R: {0}, {1}", s29r.x, s29r.y == null ? "Null" : "Not null"); if (s29r.x != 5 || s29r.y != testClass) { throw new System.Exception(); } Enable this when GH Issue #2076 is resolved. */ return 100; }
public void TestStructCopyFromArg() { Func<int, int, int> f = (a, b) => { var s1 = new S1 { x = a }; return CopyMutateS1Ret(s1, b) + s1.x; }; this.Test(f); }
public void TestStructCopy() { Func<int, int, int> f = (a, b) => { var s1 = new S1 { x = a }; var s2 = s1; s2.x = b; return s1.x + s2.x; }; this.Test(f); }
private static int CopyMutateS1Ret(S1 s, int i) { s.x = i; var a = s; a.x = i - 1; return s.x - a.x; }
public static extern void InvokeCallback1(MyCallback1 callback, S1 s);