Esempio n. 1
0
        /// <summary>
        /// Run the test
        /// </summary>
        public virtual ResultTest RunTest(IEnumerable <Providers.ISwephProvider> providers)
        {
            var result = new ResultTest {
                Test = this
            };

            // Run the test
            foreach (var provider in providers)
            {
                var values = new ResultTestValues {
                    Provider = provider
                };
                Stopwatch sw = new Stopwatch();
                sw.Start();
                try
                {
                    RunTest(values, provider);
                }
                catch (Exception ex) { values.Error = ex; result.Success = false; }
                sw.Stop();
                values.TestDelay = sw.Elapsed;
                result.TestValues[provider.Name] = values;
            }

            return(result);
        }
        protected override void RunTest(ResultTestValues result, ISwephProvider provider)
        {
            result.Values[$"G: 2017-10-07 14:53"] = provider.SweJulday(2017, 10, 7, new TimeSpan(14, 53, 0).TotalDays, true);
            result.Values[$"J: 2017-10-07 14:53"] = provider.SweJulday(2017, 10, 7, new TimeSpan(14, 53, 0).TotalDays, false);

            result.Values[$"G: Minimal"] = provider.SweJulday(-4713, 11, 24, 12.0, true);
            result.Values[$"J: Minimal"] = provider.SweJulday(-4712, 1, 1, 12.0, false);

            result.Values[$"G: 2000000"] = provider.SweJulday(763, 9, 18, 12.0, true);
            result.Values[$"J: 2000000"] = provider.SweJulday(763, 9, 14, 12.0, false);

            result.Values[$"G: 2000000"] = provider.SweJulday(-1800, 9, 18, 12.0, true);
            result.Values[$"J: 2000000"] = provider.SweJulday(-1800, 9, 14, 12.0, false);

            result.Values[$"G: 1974-08-15 23:30"] = provider.SweJulday(1974, 8, 15, 23 + 30 / 60.0 + 0 / 3600.0, true);
        }
        protected override void RunTest(ResultTestValues result, ISwephProvider provider)
        {
            int iflag  = SwephDll.SEFLG_JPLEPH;
            var tjd_ut = provider.SweJulday(2017, 10, 7, new TimeSpan(16, 31, 0).TotalDays, true);

            for (int p = SwephDll.SE_SUN; p <= SwephDll.SE_CHIRON; p++)
            {
                if (p == SwephDll.SE_EARTH)
                {
                    continue;
                }
                double[] x2      = new double[6];
                string   serr    = null;
                var      iflgret = provider.SweCalcUT(tjd_ut, p, iflag, ref x2, ref serr);
                string   sname   = provider.SweGetPlanetName(p);
                result.Values[sname] = $"long: {x2[0]}\nlat: {x2[1]}\ndist: {x2[2]}\nspeed long: {x2[3]}";
            }
        }
        protected override void RunTest(ResultTestValues result, ISwephProvider provider)
        {
            int iflag = SwephDll.SEFLG_SPEED | SwephDll.SEFLG_TOPOCTR;

            double tjd = provider.SweJulday(1974, 8, 16, 0.5, true);

            double[] geopos = new double[] { 47.853333, 5.333889, 468 };
            double[] x      = new double[6];
            string   serr   = null;

            provider.SweCalcUT(tjd, SwephDll.SE_SUN, iflag, ref x, ref serr);
            result.Values["Topo undefined"] = $"long: {x[0]}\nlat: {x[1]}\ndist: {x[2]}\nspeed long: {x[3]}";

            provider.SweSetTopo(geopos[0], geopos[1], geopos[2]);

            provider.SweCalcUT(tjd, SwephDll.SE_SUN, iflag, ref x, ref serr);
            result.Values["Topo defined"] = $"long: {x[0]}\nlat: {x[1]}\ndist: {x[2]}\nspeed long: {x[3]}";
        }
        protected override void RunTest(ResultTestValues result, ISwephProvider provider)
        {
            int y = 0, m = 0, d = 0; double ut = 0;

            provider.SweRevjul(0, true, ref y, ref m, ref d, ref ut);
            result.Values["G: 0"] = $"y:{y} - m:{m} - d:{d} - ut:{ut}";

            provider.SweRevjul(0, false, ref y, ref m, ref d, ref ut);
            result.Values["J: 0"] = $"y:{y} - m:{m} - d:{d} - ut:{ut}";

            provider.SweRevjul(2000000, true, ref y, ref m, ref d, ref ut);
            result.Values["G: 2000000"] = $"y:{y} - m:{m} - d:{d} - ut:{ut}";
            provider.SweRevjul(2000000, false, ref y, ref m, ref d, ref ut);
            result.Values["J: 2000000"] = $"y:{y} - m:{m} - d:{d} - ut:{ut}";

            provider.SweRevjul(2456774.20375, true, ref y, ref m, ref d, ref ut);
            result.Values["G: 2456774.20375"] = $"y:{y} - m:{m} - d:{d} - ut:{ut}";

            provider.SweRevjul(2442275.47916667, true, ref y, ref m, ref d, ref ut);
            result.Values["G: 2442275.47916667"] = $"y:{y} - m:{m} - d:{d} - ut:{ut}";
        }
        protected override void RunTest(ResultTestValues result, ISwephProvider provider)
        {
            var tjd_ut = provider.SweJulday(2017, 8, 26, 11.25, true);

            result.Values["deltaT"] = provider.SweDeltaT(tjd_ut);
        }
 protected override void RunTest(ResultTestValues result, ISwephProvider provider)
 {
     result.Values["version"] = provider.GetVersion();
 }
Esempio n. 8
0
 /// <summary>
 /// Run the test with a provider
 /// </summary>
 protected abstract void RunTest(ResultTestValues result, Providers.ISwephProvider provider);