package neptune

import (
	"math"
	"testing"
	"time"
)

func sameUnixSecond(got time.Time, want int64) bool {
	return math.Abs(float64(got.Unix()-want)) <= 1
}

func TestNeptune(t *testing.T) {
	tz := time.FixedZone("CST", 8*3600)
	date := time.Date(2022, 01, 20, 00, 00, 00, 00, tz)
	if !sameUnixSecond(NextConjunction(date), 1647171800) {
		t.Fatal(NextConjunction(date).Unix())
	}
	if CulminationTime(date, 115).Unix() != 1642665021 {
		t.Fatal(CulminationTime(date, 115).Unix())
	}
	date, err := (RiseTime(date, 115, 40, 0, false))
	if err != nil {
		t.Fatal(err)
	}
	if date.Unix() != 1642644398 {
		t.Fatal(date.Unix())
	}
}
