package megamillions import ( "testing" "time" ) func TestNetTicksToTime_Consistency(t *testing.T) { // netTicksToTime converts .NET ticks to Go time. // Verify it produces consistent results for the same input. ticks := int64(638396256000000000) t1 := netTicksToTime(ticks) t2 := netTicksToTime(ticks) if !t1.Equal(t2) { t.Errorf("netTicksToTime is not consistent: %v != %v", t1, t2) } } func TestNetTicksToTime_Ordering(t *testing.T) { // A larger ticks value should produce a later time. earlier := netTicksToTime(638396256000000000) later := netTicksToTime(638396256100000000) // 10 seconds later in ticks if !later.After(earlier) { t.Errorf("expected later ticks to produce later time: %v vs %v", earlier, later) } } func TestNetTicksToTime_DifferenceIsCorrect(t *testing.T) { // .NET ticks are 100-nanosecond intervals. // 10,000,000 ticks = 1 second. ticks1 := int64(638396256000000000) ticks2 := ticks1 + 10000000 // 1 second later t1 := netTicksToTime(ticks1) t2 := netTicksToTime(ticks2) diff := t2.Sub(t1) if diff != time.Second { t.Errorf("expected 1 second difference, got %v", diff) } } func TestNetTicksToTime_NotZero(t *testing.T) { // Verify the function produces a non-zero time for typical ticks values. ticks := int64(638396256000000000) result := netTicksToTime(ticks) if result.IsZero() { t.Error("netTicksToTime should not return zero time for valid ticks") } } func TestConfig_Validate(t *testing.T) { c := Config{} c = c.validate() _ = c // validate is a no-op, just verify no panic } func TestDrawing_ZeroValue(t *testing.T) { var d Drawing if d.MegaBall != 0 || d.Megaplier != 0 { t.Error("zero-value Drawing should have zero fields") } } func TestNextDrawing_ZeroValue(t *testing.T) { var nd NextDrawing if nd.Date != "" { t.Error("zero-value NextDrawing should have empty date") } }