@@ -4,93 +4,137 @@ import 'package:astro_calculations/src/solar_calc.dart';
44import 'data/solar_test_data.dart' ;
55
66void main () {
7- group ('Julian Day Tests' , () {
8- test ('Get Julian Day from Gregorian Day' , () {
9- for (var dateTime in TestData ['julianDayTestData' ].keys) {
10- expect (getJulianDay (dateTime), equals (TestData ['julianDayTestData' ][dateTime]));
11- }
12- });
13-
14- test ('Get Gregorian Day from Julian Day' , () {
15- final _reversedMap = TestData ['julianDayTestData' ].map ((key, value) => MapEntry (value, key));
16- for (var julianDay in TestData ['julianDayTestData' ].values) {
17- expect (getGregorianDay (julianDay), equals (_reversedMap[julianDay]));
18- }
19- });
20- });
21-
227 group ('Heliocentric Calculations' , () {
238 test ('Get Heliocentric Latitude' , () {
24- expect (getHeliocentricLatitude (TestData ['julianMillenium' ]), closeTo (TestData ['heliocentricLatitude' ], 0.001 ));
9+ expect (getHeliocentricLatitude (TestData ['julianMillenium' ]),
10+ closeTo (TestData ['heliocentricLatitude' ], 0.001 ));
2511 });
2612
2713 test ('Get Heliocentric longitude' , () {
28- expect (getHeliocentricLongitude (TestData ['julianMillenium' ]), closeTo (TestData ['heliocentricLongitude' ], 0.001 ));
14+ expect (getHeliocentricLongitude (TestData ['julianMillenium' ]),
15+ closeTo (TestData ['heliocentricLongitude' ], 0.001 ));
2916 });
3017
3118 test ('Get Earth Radius Vector' , () {
32- expect (getEarthRadiusVector (TestData ['julianMillenium' ]), closeTo (TestData ['earthSunDistance' ], 0.001 ));
19+ expect (getEarthRadiusVector (TestData ['julianMillenium' ]),
20+ closeTo (TestData ['earthSunDistance' ], 0.001 ));
3321 });
3422 });
3523
3624 group ('Get Nutation Values' , () {
3725 final nutationValue = getNutation (TestData ['julianEphemerisCentury' ]);
3826 test ('Get Nutation longitude' , () {
39- expect (nutationValue.longitude, closeTo (TestData ['nutation' ].longitude, 0.0000001 ));
27+ expect (nutationValue.longitude,
28+ closeTo (TestData ['nutation' ].longitude, 0.0000001 ));
4029 });
4130 test ('Get Nutation Obliquity' , () {
42- expect (nutationValue.obliquity, closeTo (TestData ['nutation' ].obliquity, 0.0000001 ));
31+ expect (nutationValue.obliquity,
32+ closeTo (TestData ['nutation' ].obliquity, 0.0000001 ));
4333 });
4434 });
4535
4636 test ('Get true obliquity of ecliptic' , () {
47- expect (getTrueObliquityOfEcliptic (TestData ['julianMillenium' ], TestData ['nutation' ]), closeTo (TestData ['trueObliquityOfEcliptic' ], 0.00001 ));
37+ expect (
38+ getTrueObliquityOfEcliptic (
39+ TestData ['julianMillenium' ], TestData ['nutation' ]),
40+ closeTo (TestData ['trueObliquityOfEcliptic' ], 0.00001 ));
4841 });
4942
5043 test ('Get Aberration Correction' , () {
51- expect (getAberrationCorrection (TestData ['earthSunDistance' ]), closeTo (TestData ['aberrationCorrection' ], 0.00001 ));
44+ expect (getAberrationCorrection (TestData ['earthSunDistance' ]),
45+ closeTo (TestData ['aberrationCorrection' ], 0.00001 ));
5246 });
5347
5448 test ('Get Apparent Sun Longitude' , () {
55- expect (getApparentSunLongitude (TestData ['geocentricLongitude' ], TestData ['nutation' ], TestData ['aberrationCorrection' ]), closeTo (TestData ['apparentSunLongitude' ], 0.001 ));
49+ expect (
50+ getApparentSunLongitude (TestData ['geocentricLongitude' ],
51+ TestData ['nutation' ], TestData ['aberrationCorrection' ]),
52+ closeTo (TestData ['apparentSunLongitude' ], 0.001 ));
5653 });
5754
5855 test ('Get Apparent Sidereal Time' , () {
59- expect (getApparentSiderealTime (TestData ['julianDay' ], TestData ['julianMillenium' ], TestData ['nutation' ]), closeTo (TestData ['apparentSiderealTime' ], 0.01 ));
56+ expect (
57+ getApparentSiderealTime (TestData ['julianDay' ],
58+ TestData ['julianMillenium' ], TestData ['nutation' ]),
59+ closeTo (TestData ['apparentSiderealTime' ], 0.01 ));
6060 });
6161 test ('Get Geocentric Sun Right Ascension' , () {
62- expect (getGeocentricSunRightAscension (TestData ['apparentSunLongitude' ], TestData ['trueObliquityOfEcliptic' ], TestData ['geocentricLatitude' ]), closeTo (TestData ['geocentricRightAscension' ], 0.001 ));
62+ expect (
63+ getGeocentricSunRightAscension (
64+ TestData ['apparentSunLongitude' ],
65+ TestData ['trueObliquityOfEcliptic' ],
66+ TestData ['geocentricLatitude' ]),
67+ closeTo (TestData ['geocentricRightAscension' ], 0.001 ));
6368 });
6469 test ('Get Geocentric Sun Declination' , () {
65- expect (getGeocentricSunDeclination (TestData ['apparentSunLongitude' ], TestData ['trueObliquityOfEcliptic' ], TestData ['geocentricLatitude' ]), closeTo (TestData ['geocentricSunDeclination' ], 0.001 ));
70+ expect (
71+ getGeocentricSunDeclination (
72+ TestData ['apparentSunLongitude' ],
73+ TestData ['trueObliquityOfEcliptic' ],
74+ TestData ['geocentricLatitude' ]),
75+ closeTo (TestData ['geocentricSunDeclination' ], 0.001 ));
6676 });
6777 test ('get Observer local hour angle' , () {
68- expect (getLocalHourAngle (TestData ['apparentSiderealTime' ], TestData ['longitude' ], TestData ['geocentricRightAscension' ]), closeTo (TestData ['localHourAngle' ], 0.01 ));
78+ expect (
79+ getLocalHourAngle (TestData ['apparentSiderealTime' ],
80+ TestData ['longitude' ], TestData ['geocentricRightAscension' ]),
81+ closeTo (TestData ['localHourAngle' ], 0.01 ));
6982 });
7083
7184 group ('Position of sun with respect to observer on earth' , () {
7285 test ('get Topocentric Right Ascension' , () {
73- expect (getTopocentricSunRightAscension (TestData ['projectedRadialDistance' ], TestData ['equatorialHorizontalParallaxOfSun' ], TestData ['localHourAngle' ], TestData ['apparentSunLongitude' ], TestData ['trueObliquityOfEcliptic' ], TestData ['geocentricLatitude' ]), closeTo (TestData ['topocentricSunRightAscension' ], 0.001 ));
86+ expect (
87+ getTopocentricSunRightAscension (
88+ TestData ['projectedRadialDistance' ],
89+ TestData ['equatorialHorizontalParallaxOfSun' ],
90+ TestData ['localHourAngle' ],
91+ TestData ['apparentSunLongitude' ],
92+ TestData ['trueObliquityOfEcliptic' ],
93+ TestData ['geocentricLatitude' ]),
94+ closeTo (TestData ['topocentricSunRightAscension' ], 0.001 ));
7495 });
7596 test ('get Topocentric Sun Declination ' , () {
76- expect (getTopocentricSunDeclination (TestData ['projectedAxialDistance' ], TestData ['equatorialHorizontalParallaxOfSun' ], TestData ['localHourAngle' ], TestData ['projectedRadialDistance' ], TestData ['geocentricSunDeclination' ]), closeTo (TestData ['topocentricSunDeclination' ], 0.0001 ));
97+ expect (
98+ getTopocentricSunDeclination (
99+ TestData ['projectedAxialDistance' ],
100+ TestData ['equatorialHorizontalParallaxOfSun' ],
101+ TestData ['localHourAngle' ],
102+ TestData ['projectedRadialDistance' ],
103+ TestData ['geocentricSunDeclination' ]),
104+ closeTo (TestData ['topocentricSunDeclination' ], 0.0001 ));
77105 });
78106 });
79107
80108 test ('get Topocentric Local Hour Angle' , () {
81109 //Value of parallaxInSunRightAscension is calculated from this program itself since I couldn't find any data for it
82- expect (getTopocentricLocalHourAngle (TestData ['localHourAngle' ], TestData ['parallaxInSunRightAscension' ]), closeTo (TestData ['topocentricLocalHourAngle' ], 0.0001 ));
110+ expect (
111+ getTopocentricLocalHourAngle (TestData ['localHourAngle' ],
112+ TestData ['parallaxInSunRightAscension' ]),
113+ closeTo (TestData ['topocentricLocalHourAngle' ], 0.0001 ));
83114 });
84115
85116 test ('get Topocentric Zenith Angle' , () {
86- expect (getTopocentricZenithAngle (TestData ['latitude' ], TestData ['topocentricSunDeclination' ], TestData ['topocentricLocalHourAngle' ], TestData ['pressure' ], TestData ['temperatureInCelsius' ]), closeTo (TestData ['topocentricZenithAngle' ], 0.0001 ));
117+ expect (
118+ getTopocentricZenithAngle (
119+ TestData ['latitude' ],
120+ TestData ['topocentricSunDeclination' ],
121+ TestData ['topocentricLocalHourAngle' ],
122+ TestData ['pressure' ],
123+ TestData ['temperatureInCelsius' ]),
124+ closeTo (TestData ['topocentricZenithAngle' ], 0.0001 ));
87125 });
88126
89127 test ('get Topocentric Azimuth Angle' , () {
90- expect (getTopocentricAzimuthAngle (TestData ['topocentricLocalHourAngle' ], TestData ['latitude' ], TestData ['topocentricSunDeclination' ]), closeTo (TestData ['topocentricAzimuthAngle' ], 0.0001 ));
128+ expect (
129+ getTopocentricAzimuthAngle (TestData ['topocentricLocalHourAngle' ],
130+ TestData ['latitude' ], TestData ['topocentricSunDeclination' ]),
131+ closeTo (TestData ['topocentricAzimuthAngle' ], 0.0001 ));
91132 });
92133
93134 test ('get Topocentric Incidence Angle' , () {
94- expect (getIncidenceAngle (TestData ['topocentricZenithAngle' ], TestData ['slope' ], TestData ['slopeOrientation' ], TestData ['topocentricAzimuthAngle' ]), closeTo (TestData ['incidenceAngle' ], 0.001 ));
135+ expect (
136+ getIncidenceAngle (TestData ['topocentricZenithAngle' ], TestData ['slope' ],
137+ TestData ['slopeOrientation' ], TestData ['topocentricAzimuthAngle' ]),
138+ closeTo (TestData ['incidenceAngle' ], 0.001 ));
95139 });
96140}
0 commit comments