public void SequenceGeneratorTest7() { IEnumerable <decimal> expected = new decimal[] { 1, 3, 5, 7, 9, 11 }; IEnumerable <decimal> actual = Enumerator.Generate(1m, 2, 6); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void SequenceGeneratorTest6() { IEnumerable <float> expected = new float[] { 1, 3, 5, 7, 9, 11 }; IEnumerable <float> actual = Enumerator.Generate(1f, 2, 6); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void SequenceGeneratorTest8() { IEnumerable <long> expected = new long[] { 1, 3, 5, 7, 9, 11 }; IEnumerable <long> actual = Enumerator.Generate(1L, 2, 6); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void SequenceGeneratorTest5() { IEnumerable <double> expected = new double[] { 1, 3, 5, 7, 9, 11 }; IEnumerable <double> actual = Enumerator.Generate(1d, 2, 6); Assert.IsTrue(expected.SequenceEqual(actual)); }
private Array Get3DArray(int x, int y, int z) { if (radioButtonAutoFill.Checked) { return(Enumerator.Generate(numericUpDownStart.Value, numericUpDownInc.Value, x * y * z) .Select(V => (double)V).ToArray(z, y, x)); } if (radioButtonManualFill.Checked) { try { IEnumerable <string> items = GetManualItems(); return(items.Select(X => double.Parse(X, Thread.CurrentThread.CurrentUICulture.NumberFormat)) .ToArray(z, y, x)); } catch (Exception ex) { throw new FormatException(Resources.InvalidInputFormat, ex); } } // file try { IEnumerable <string> items = GetFileItems(); return(items.Select(X => double.Parse(X, Thread.CurrentThread.CurrentUICulture.NumberFormat)) .ToArray(z, y, x)); } catch (FormatException ex) { throw new FormatException(Resources.InvalidFileContent, ex); } }
private Array Get1DArray(int x) { if (this.autoFillTab.IsSelected) { return(Enumerator.Generate(double.Parse(this.startValueTextBox.Text, CultureInfo.CurrentCulture), double.Parse(this.stepTextBox.Text, CultureInfo.CurrentCulture), x).Select(V => V).ToArray()); } else if (this.manualTab.IsSelected) { try { string[] items = this.GetManualItems(); return(items.Select(X => double.Parse(X, CultureInfo.CurrentCulture)).ToArray()); } catch (Exception ex) { throw new FormatException(AvProp.Resources.InvalidInputFormat, ex); } } else { // file try { string[] items = this.GetFileItems(); return(items.Select(X => double.Parse(X, CultureInfo.CurrentCulture)).ToArray()); } catch (FormatException ex) { throw new FormatException(AvProp.Resources.InvalidFileContent, ex); } }
private IEnumerable <IEnumerable <double> > GetEnums(int y, int x) { for (int i = 0; i < y; i++) { yield return(Enumerator.Generate <double>(y, y, x)); } }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { TestInfo testInfo = (TestInfo)e.Argument; IEnumerable <TestDataElement> testData = Enumerator.Generate(testInfo.SourceCount, X => new TestDataElement(X)); if (testInfo.SourceOrder == 0) { testData = testData.Shuffle(); } else { testData = PreSortTestData(testData, testInfo); } TestDataElement[] testArray1; TestDataElement[] testArray2; testArray1 = testData.ToArray(); testArray2 = new TestDataElement[testArray1.Length]; testArray1.CopyTo(testArray2, 0); IOrderedEnumerable <TestDataElement> standardSort = GetStandardSort(testArray1, testInfo); IComposableSortEnumerable <TestDataElement> linqLibSort = GetLinqLibSort(testArray2, testInfo); e.Cancel = DoTest(testInfo, standardSort, linqLibSort); }
public void SequenceGeneratorTest2() { IEnumerable <decimal> expected = new decimal[] { .03m, .04m, .05m, .06m, .07m, .08m, .09m }; decimal factor = .01m; IEnumerable <decimal> actual = Enumerator.Generate <decimal>(3, 7, (x) => x * factor); Assert.IsTrue(expected.SequenceEqual(actual)); }
private void buttonLargeArrays_Click(object sender, EventArgs e) { int[,,] acceptable = Enumerator.Generate(1, 1, 1000).ToArray(10, 10, 10); int[,,] large = Enumerator.Generate(1, 1, 4096).ToArray(16, 16, 16); int[,,] tooLarge = Enumerator.Generate(1, 1, 125000).ToArray(50, 50, 50); Debugger.Break(); }
public void VarianceLongTest() { IEnumerable <Tuple <string, long> > source = Enumerator.Generate <Tuple <string, long> >(7, X => Generator.GenerateLong(X)); double expected = 4.667; double actual; actual = (double)Math.Round(source.Variance(X => X.Item2), 3); Assert.IsTrue(expected.Equals(actual)); }
public void VarianceNullableFloatTest() { IEnumerable <Tuple <string, float?> > source = Enumerator.Generate <Tuple <string, float?> >(7, X => Generator.GenerateNullableFloat(X, 10, 10)); float?expected = 4.667f; float?actual; actual = (float?)Math.Round(source.Variance(X => X.Item2).Value, 3); Assert.IsTrue(expected.Equals(actual)); }
public void VarianceNullableDecimalTest() { IEnumerable <Tuple <string, decimal?> > source = Enumerator.Generate <Tuple <string, decimal?> >(7, X => Generator.GenerateNullableDecimal(X, 10)); decimal?expected = 4.667m; decimal?actual; actual = (decimal?)Math.Round(source.Variance(X => X.Item2).Value, 3); Assert.IsTrue(expected.Equals(actual)); }
public void VarianceLongTest2() { IEnumerable <Tuple <string, long> > source = Enumerator.Generate <Tuple <string, long> >(5, X => Generator.GenerateLong(X)); IEnumerable <double> expected = new double[] { .707, 1, 1.291, 1.581 }.Select(X => X * X).Round(3); IEnumerable <double> actual; actual = source.CumulativeVariance(X => X.Item2).Round(3); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void VarianceNullableLongTest2() { IEnumerable <Tuple <string, long?> > source = Enumerator.Generate <Tuple <string, long?> >(5, X => Generator.GenerateNullableLong(X, 20)); IEnumerable <double?> expected = new double?[] { 0.707, 1.000, 1.291, 1.581 }.Select(X => X.Value * X.Value).Round(2).Cast <double?>(); IEnumerable <double?> actual; actual = source.CumulativeVariance(X => X.Item2).Select(V => V.Value).Round(2).Cast <double?>(); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void VarianceIntTest1() { IEnumerable <Tuple <string, int> > source = Enumerator.Generate <Tuple <string, int> >(5, X => Generator.GenerateInt(X)); IEnumerable <double> expected = new double[] { 2.5 }; IEnumerable <double> actual; actual = source.Variance(5, X => X.Item2).Round(3); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void VarianceNullableIntTest1() { IEnumerable <Tuple <string, int?> > source = Enumerator.Generate <Tuple <string, int?> >(5, X => Generator.GenerateNullableInt(X, 20)); IEnumerable <double?> expected = new double?[] { 2.5 }; IEnumerable <double?> actual; actual = source.Variance(5, X => X.Item2).Select(V => V.Value).Round(3).Cast <double?>(); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void CumulativeStdevIntTest1() { IEnumerable <Tuple <string, int> > source = Enumerator.Generate <Tuple <string, int> >(5, X => Generator.GenerateInt(X)); IEnumerable <double> expected = new double[] { .707, 1, 1.291, 1.581 }; IEnumerable <double> actual; actual = source.CumulativeStdev(X => X.Item2).Round(3); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void StdevFloatTest2() { IEnumerable <Tuple <string, float> > source = Enumerator.Generate <Tuple <string, float> >(7, X => Generator.GenerateFloat(X, 10)); float expected = 2.160f; float actual; actual = (float)Math.Round(source.Stdev(X => X.Item2), 3); Assert.IsTrue(expected.Equals(actual)); }
public void CumulativeStdevNullableFloatTest1() { IEnumerable <Tuple <string, float?> > source = Enumerator.Generate <Tuple <string, float?> >(5, X => Generator.GenerateNullableFloat(X, 10, 2)); IEnumerable <float?> expected = new float?[] { float.NaN, 1.414f, 1.528f, 1.708f }; IEnumerable <float?> actual; actual = source.CumulativeStdev(X => X.Item2).Select(V => V.Value).Round(3).Cast <float?>(); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void CumulativeStdevNullableDoubleTest1() { IEnumerable <Tuple <string, double?> > source = Enumerator.Generate <Tuple <string, double?> >(5, X => Generator.GenerateNullableDouble(X, 10, 2)); IEnumerable <double?> expected = new double?[] { double.NaN, 1.414, 1.528, 1.708 }; IEnumerable <double?> actual; actual = source.CumulativeStdev(X => X.Item2).Select(V => V.Value).Round(3).Cast <double?>(); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void StdevDoubleTest2() { IEnumerable <Tuple <string, double> > source = Enumerator.Generate <Tuple <string, double> >(7, X => Generator.GenerateDouble(X, 10)); double expected = 2.160; double actual; actual = Math.Round(source.Stdev(X => X.Item2), 3); Assert.IsTrue(expected.Equals(actual)); }
public void StdevIntLongTest2() { IEnumerable <Tuple <string, int?> > source = Enumerator.Generate <Tuple <string, int?> >(7, X => Generator.GenerateNullableInt(X, 10)); double?expected = 2.160; double?actual; actual = (double?)Math.Round(source.Stdev(X => X.Item2).Value, 3); Assert.IsTrue(expected.Equals(actual)); }
public void StdevDecimalTest2() { IEnumerable <Tuple <string, decimal> > source = Enumerator.Generate <Tuple <string, decimal> >(7, X => Generator.GenerateDecimal(X)); decimal expected = 2.160m; decimal actual; actual = (decimal)Math.Round(source.Stdev(X => X.Item2), 3); Assert.IsTrue(expected.Equals(actual)); }
public void CumulativeStdevFloatTest1() { IEnumerable <Tuple <string, float> > source = Enumerator.Generate <Tuple <string, float> >(5, X => Generator.GenerateFloat(X, 10)); IEnumerable <float> expected = new float[] { .707f, 1, 1.291f, 1.581f }; IEnumerable <float> actual; actual = source.CumulativeStdev(X => X.Item2).Round(3); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void VarianceNullableLongTest() { IEnumerable <Tuple <string, long?> > source = Enumerator.Generate <Tuple <string, long?> >(7, X => Generator.GenerateNullableLong(X, 10)); double?expected = 4.667; double?actual; actual = (double?)Math.Round(source.Variance(X => X.Item2).Value, 3); Assert.IsTrue(expected.Equals(actual)); }
public void CumulativeStdevDecimalTest1() { IEnumerable <Tuple <string, decimal> > source = Enumerator.Generate <Tuple <string, decimal> >(5, X => Generator.GenerateDecimal(X)); IEnumerable <decimal> expected = new decimal[] { .707m, 1, 1.291m, 1.581m }; IEnumerable <decimal> actual; actual = source.CumulativeStdev(X => X.Item2).Round(3); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void VarianceFloatTest1() { IEnumerable <Tuple <string, float> > source = Enumerator.Generate <Tuple <string, float> >(5, X => Generator.GenerateFloat(X, 10)); IEnumerable <float> expected = new float[] { 2.5f }; IEnumerable <float> actual; actual = source.Variance(5, X => X.Item2).Round(3); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void CumulativeStdevNullableIntTest1() { IEnumerable <Tuple <string, int?> > source = Enumerator.Generate <Tuple <string, int?> >(5, X => Generator.GenerateNullableInt(X, 20)); IEnumerable <double?> expected = new double?[] { 0.707, 1.000, 1.291, 1.581 }; IEnumerable <double?> actual; actual = source.CumulativeStdev(X => X.Item2).Select(V => V.Value).Round(3).Cast <double?>(); Assert.IsTrue(expected.SequenceEqual(actual)); }
public void VarianceDecimalTest1() { IEnumerable <Tuple <string, decimal> > source = Enumerator.Generate <Tuple <string, decimal> >(5, X => Generator.GenerateDecimal(X)); IEnumerable <decimal> expected = new decimal[] { 2.5m }; IEnumerable <decimal> actual; actual = source.Variance(5, X => X.Item2).Round(3); Assert.IsTrue(expected.SequenceEqual(actual)); }