12 lines
571 B
TypeScript
12 lines
571 B
TypeScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { ANGLE_TOLERANCE, compareSolar, solarCases } from './solar-cases.ts';
|
|
|
|
for (const iso of solarCases) {
|
|
test(`SunCalc 2.x vs NOAA: nonnegative altitude / azimuth 0.1°, negative altitude 0.5°: ${iso}`, () => {
|
|
const comparison = compareSolar(iso);
|
|
assert.ok(comparison.azimuthError <= ANGLE_TOLERANCE, `azimuth error ${comparison.azimuthError}°`);
|
|
assert.ok(comparison.altitudeError <= comparison.altitudeTolerance, `altitude error ${comparison.altitudeError}°`);
|
|
});
|
|
}
|