static void Main(string[] args) { tester t = tester.x; t.testenums(); Console.ReadKey(); }
public void staticsTest() { IList <Thread> threads = new List <Thread>(); IDictionary <int, string> result = new Dictionary <int, string>(); for (var i = 0; i < 500; i++) { var i1 = i; var t = new tester(i1, result); var thread = new Thread(() => t.bystat()); threads.Add(thread); } var sw = Stopwatch.StartNew(); foreach (var thread in threads) { thread.Start(); } foreach (var thread in threads) { thread.Join(); } sw.Stop(); statResult = sw.Elapsed; Console.WriteLine("stat: " + statResult); foreach (var test in result) { Assert.AreEqual(statics.exec(test.Key), test.Value); } }
void setUp(string replaceWhat, string replaceWith, bool isRegex) { if (!isRegex) { _type = Type.simpleReplace; applies = delegate { return(this.input.Contains(replaceWhat)); }; doAction = delegate { return(input.Replace(replaceWhat, replaceWith)); }; } else { _type = Type.Regex; regEx = new Regex(replaceWhat, RegexOptions.Compiled); if (regEx != null) { applies = delegate { return(regEx.IsMatch(this.input)); }; doAction = delegate { string res = input; foreach (Match m in regEx.Matches(this.input)) { res = res.Replace(m.Value, replaceWith); } return(res); }; } else { applies = delegate { return(false); } }; } } #endregion #endregion }
public void UpdaTetest() { using (ApplicationContext testdb = new ApplicationContext()) { tester testtester = new tester { Id_tester = 2 }; Assert.Pass(Program.UpdateTesterById(testdb, testtester), "Complete"); } }
static void Main(string[] args) { tester t = tester.alpha | tester.beta; if (t == tester.alpha) Console.WriteLine("alpha only"); if ((t & tester.alpha) != 0) Console.WriteLine("alpha"); if ((t & tester.beta) != 0) Console.WriteLine("beta"); if ((t & tester.gamma) != 0) Console.WriteLine("gamma"); if (t == (tester.beta | tester.alpha)) Console.WriteLine("alphabeta");
public ColorForm(ColorMeter c) { InitializeComponent(); tester t = new tester(); _colorMeter = c; _colorMeter.sendData += _colorMeter_sendData; colorDataGridView.CellBeginEdit += ColorDataGridView_CellBeginEdit; colorDataGridView.CellEndEdit += ColorDataGridView_CellEndEdit; _gridData = new ColorGridData(AddRow(true)); }
static void Main(string[] args) { tester t = new tester(); Console.WriteLine("Enter a string:"); string s1 = Console.ReadLine(); if (t.palindrome(s1)) { Console.WriteLine("\"{0}\" is a palindrome", s1); } Console.WriteLine("Enter a second string:"); string s2 = Console.ReadLine(); if (t.anagram(s1, s2)) { Console.WriteLine("\"{0}\" is an anagram to \"{1}\"", s1, s2); } }
public static void testenums(this tester x) { Console.WriteLine(x.ToString()); }
private void button4_Click(object sender, EventArgs e) { string message = textBox2.ToString(); tester test = new tester(message); client.Send<tester>(test); }
// We have to Declare our event handler in the class that is going to trigger it // but it is based on the Delegate declared in the Namespace // NB we do NOT need to use the args in this declaration // public event SelectionChanged OnSelectionChanged; /// <summary> /// Main Constructor /// This receives the newly selected index, and if different to /// previous value, triggers the Event Notification /// </summary> public MonitorDataGridSelectionChanges() { tester tst = new tester(); // SQLViewerGridSelectionChanged gsc = tst.IndexChange; }
public void testing(tester x) { this.man = x; Console.WriteLine(man); }
public formatingRule(tester Tester, action Action) { this.applies = Tester; this.doAction = Action; }
static void RingPolyTest() { RingPolynomial.SetModContext(7); tester test = () => { Random rnd = new Random(); int flen = rnd.Next(5, 20); int glen = rnd.Next(5, 21); int clen = rnd.Next(5, 22); RingPolynomial f = new RingPolynomial(); RingPolynomial g = new RingPolynomial(); RingPolynomial c = new RingPolynomial(); for (int i = 0; i < flen; i++) { f.Add(rnd.Next(0, (int)RingBint.mod)); } for (int i = 0; i < glen; i++) { g.Add(rnd.Next(0, (int)RingBint.mod)); } for (int i = 0; i < clen; i++) { c.Add(rnd.Next(0, (int)RingBint.mod)); } f = f.Normalize(); g = g.Normalize(); c = c.Normalize(); RingPolynomial.GCD(f, g, out RingPolynomial gcd); var sol = RingPolynomial.SolveEquation(f, g, c); if (!sol.isDefined) { Console.WriteLine("Решение не найдено!"); } f.Print('f'); g.Print('g'); c.Print('c'); Console.WriteLine(sol); if (f.IsNull() && !g.IsNull()) { if (c.IsNull()) { return(sol.zeroSolution.Y.IsNull() && (sol.solutionStep.X - new RingPolynomial { 1 }).IsNull() && sol.solutionStep.Y.IsNull()); } else { if ((c / g).Reminder.IsNull()) { return(sol.zeroSolution.Y == (c / g).Quotient.Normalize() && sol.solutionStep.Y.IsNull() && (sol.solutionStep.X - new RingPolynomial { 1 }).IsNull()); } else { return(sol.isDefined == false); } } } if (!f.IsNull() && g.IsNull()) { if (c.IsNull()) { return(sol.zeroSolution.X.IsNull() && (sol.solutionStep.Y - new RingPolynomial { 1 }).IsNull() && sol.solutionStep.X.IsNull()); } else { if ((c / f).Reminder.IsNull()) { return(sol.zeroSolution.X == (c / f).Quotient.Normalize() && sol.solutionStep.X.IsNull() && (sol.solutionStep.Y - new RingPolynomial { 1 }).IsNull()); } else { return(sol.isDefined == false); } } } if (f.IsNull() && g.IsNull()) { if (!c.IsNull()) { return(sol.isDefined == false); } else { return((sol.solutionStep.X - new RingPolynomial { 1 }).IsNull() && (sol.solutionStep.Y - new RingPolynomial { 1 }).IsNull()); } } if (c.IsNull()) { return((((sol.solutionStep.X) * f + (sol.solutionStep.Y) * g) - c).IsNull() && (sol.zeroSolution.X / sol.solutionStep.X).Reminder.IsNull() && (sol.zeroSolution.Y / sol.solutionStep.Y).Reminder.IsNull()); } if ((c / gcd).Reminder.IsNull()) { return((((sol.zeroSolution.X + sol.solutionStep.X) * f + (sol.zeroSolution.Y + sol.solutionStep.Y) * g) - c).IsNull()); } else { return(sol.isDefined == false); } }; int i = 0; bool res; while (res = test()) { Console.WriteLine("i =" + i + (res ? " OK" : "ERR")); i++; } }
void setUp(string replaceWhat, string replaceWith, bool isRegex) { if (!isRegex) { _type = Type.simpleReplace; applies = delegate { return this.input.Contains(replaceWhat); }; doAction = delegate { return input.Replace(replaceWhat, replaceWith); }; } else { _type = Type.Regex; regEx = new Regex(replaceWhat, RegexOptions.Compiled); if (regEx != null) { applies = delegate { return regEx.IsMatch(this.input); }; doAction = delegate { string res = input; foreach (Match m in regEx.Matches(this.input)) res = res.Replace(m.Value, replaceWith); return res; }; } else applies = delegate { return false; }; } }
public formatingRule(tester Tester, action Action) { this.applies = Tester; this.doAction = Action; }
public void staticsTest() { IList<Thread> threads = new List<Thread>(); IDictionary<int, string> result = new Dictionary<int, string>(); for (var i = 0; i < 500; i++) { var i1 = i; var t = new tester(i1, result); var thread = new Thread(() => t.bystat()); threads.Add(thread); } var sw = Stopwatch.StartNew(); foreach (var thread in threads) { thread.Start(); } foreach (var thread in threads) { thread.Join(); } sw.Stop(); statResult = sw.Elapsed; Console.WriteLine("stat: " + statResult); foreach (var test in result) { Assert.AreEqual(statics.exec(test.Key), test.Value); } }