|
572 | 572 | # Time from IMCCE: +266° 52′
|
573 | 573 | end
|
574 | 574 | end
|
| 575 | + |
| 576 | + describe "::equation_of_time" do |
| 577 | + it "returns an Integer" do |
| 578 | + date = Date.new |
| 579 | + |
| 580 | + equation_of_time = described_class.equation_of_time(date: date) |
| 581 | + |
| 582 | + expect(equation_of_time).to be_an Integer |
| 583 | + end |
| 584 | + |
| 585 | + # Source: |
| 586 | + # Title: Practical Astronomy with your Calculator or Spreadsheet |
| 587 | + # Authors: Peter Duffett-Smith and Jonathan Zwart |
| 588 | + # Edition: Cambridge University Press |
| 589 | + # Chapter: 51 - The equation of time |
| 590 | + it "returns the right value of 2010-07-27" do |
| 591 | + date = Date.new(2010, 7, 27) |
| 592 | + |
| 593 | + equation_of_time = described_class.equation_of_time(date: date) |
| 594 | + |
| 595 | + expect(equation_of_time).to eq(-392) |
| 596 | + # Value from Practical Astronomy: 392 |
| 597 | + end |
| 598 | + |
| 599 | + # Source: |
| 600 | + # Title: Celestial Calculations |
| 601 | + # Author: J. L. Lawrence |
| 602 | + # Edition: MIT Press |
| 603 | + # Chapter: 6 - The Sun |
| 604 | + it "returns the right value of 2016-05-05" do |
| 605 | + date = Date.new(2016, 5, 5) |
| 606 | + |
| 607 | + equation_of_time = described_class.equation_of_time(date: date) |
| 608 | + |
| 609 | + expect(equation_of_time).to eq(199) |
| 610 | + # Value from Celestial Calculations: 199 |
| 611 | + end |
| 612 | + |
| 613 | + # Source: |
| 614 | + # Title: Celestial Calculations |
| 615 | + # Author: J. L. Lawrence |
| 616 | + # Edition: MIT Press |
| 617 | + # Chapter: 6 - The Sun |
| 618 | + it "returns the right value of 2015-08-09" do |
| 619 | + date = Date.new(2015, 8, 9) |
| 620 | + |
| 621 | + equation_of_time = described_class.equation_of_time(date: date) |
| 622 | + |
| 623 | + expect(equation_of_time).to eq(-334) |
| 624 | + # Value from Celestial Calculations: 337 |
| 625 | + end |
| 626 | + |
| 627 | + # Source: |
| 628 | + # Title: Celestial Calculations |
| 629 | + # Author: J. L. Lawrence |
| 630 | + # Edition: MIT Press |
| 631 | + # Chapter: 6 - The Sun |
| 632 | + it "returns the right value of 2010-05-06" do |
| 633 | + date = Date.new(2010, 5, 6) |
| 634 | + |
| 635 | + equation_of_time = described_class.equation_of_time(date: date) |
| 636 | + |
| 637 | + expect(equation_of_time).to eq(201) |
| 638 | + # Value from Celestial Calculations: 201 |
| 639 | + end |
| 640 | + |
| 641 | + # Source: |
| 642 | + # Title: Celestial Calculations |
| 643 | + # Author: J. L. Lawrence |
| 644 | + # Edition: MIT Press |
| 645 | + # Chapter: 6 - The Sun |
| 646 | + it "returns the right value of 2020-01-01" do |
| 647 | + date = Date.new(2020, 1, 1) |
| 648 | + |
| 649 | + equation_of_time = described_class.equation_of_time(date: date) |
| 650 | + |
| 651 | + expect(equation_of_time).to eq(-200) |
| 652 | + # Value from Celestial Calculations: 187 |
| 653 | + end |
| 654 | + end |
575 | 655 | end
|
0 commit comments