示例#1
0
        private void AssertTable(string source)
        {
            var table = TableReader1D.Read(source);

            var expected = new Table1D(
                new [] { 1500.0, 1600.0, 1800.0 },
                new [] { 51.2, 52.8, 55.9 });

            Assert.IsTrue(table.Equals(expected, delta));
        }
示例#2
0
        public void ReadCustomParser()
        {
            string s =
                @"10 3
                  15 9";

            Func <string, double> customParser = (str) =>
            {
                var x = double.Parse(str);
                return(x * x);
            };

            var result = TableReader1D.Read(s, double.Parse, customParser);

            var expected = new Table1D(
                new [] { 10.0, 15.0 },
                new [] { 9.0, 81.0 });

            Assert.IsTrue(result.Equals(expected, delta));
        }