Skip to content

Commit

Permalink
cavern: Reset declination range after reporting
Browse files Browse the repository at this point in the history
Previously we'd misreport the range for second and subsequent locations
specified by *declination auto.
  • Loading branch information
ojwb committed Mar 22, 2024
1 parent e99711f commit c1fe79a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,8 @@ report_declination(settings *p)
fputnl(STDERR);
free(p->dec_context);
p->dec_context = NULL;
p->min_declination = HUGE_VAL;
p->max_declination = -HUGE_VAL;
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cmd_declination_auto.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
2 3 2.0 123 -66
./cmd_declination_auto.svx:6: info: Declination: 1.7dg @ 2000-12-25, grid convergence: -0.9dg
*declination auto 0410600 5282000 1234
./cmd_declination_auto.svx:38: info: Declination: 1.7dg @ 2000-12-25 / 2.0dg @ 2000-12-26, grid convergence: -0.1dg
./cmd_declination_auto.svx:39: info: Declination: 2.0dg @ 2000-12-26 / 2.0dg @ 2000-12-27, grid convergence: -0.1dg
*declination auto 0490600 5282000 1234

Removing trailing traverses...
Expand Down
6 changes: 5 additions & 1 deletion tests/cmd_declination_auto.svx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
; Regression test for bug fixed in 1.2.27 - cavern caches the declination,
; but fails to invalidate the cache when the declination coordinates are
; changed, only when the date changed.
*date 2000.12.26
*declination auto 0490600 5282000 1234
1 2a 50.0 000 0
*date 2000.12.26
*date 2000.12.27
1 2b 10.0 090 0
; We shouldn't report for this, but did in 1.4.6 and earlier (and convergence
; was reported as "inf").
*declination auto 0490600 5282001 1234
*end d

0 comments on commit c1fe79a

Please sign in to comment.