2023-03-17 11:20:09 +03:00
|
|
|
package calendar
|
|
|
|
|
|
|
|
|
|
import (
|
2023-05-02 09:51:50 +03:00
|
|
|
"github.com/ManyakRus/starter/constants"
|
2023-03-17 11:20:09 +03:00
|
|
|
"testing"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestFindPreviousWorkDay(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
Date := time.Date(2023, 03, 13, 0, 0, 0, 0, constants.Loc)
|
|
|
|
|
Otvet := FindPreviousWorkDay(Date)
|
|
|
|
|
if Otvet != time.Date(2023, 03, 10, 0, 0, 0, 0, constants.Loc) {
|
|
|
|
|
t.Error("TestFindPreviousWorkDay error")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIsWorkDay(t *testing.T) {
|
|
|
|
|
Date := time.Date(2023, 03, 19, 0, 0, 0, 0, constants.Loc)
|
|
|
|
|
Otvet := IsWorkDay(Date)
|
|
|
|
|
if Otvet != false {
|
|
|
|
|
t.Error("TestIsWorkDay error")
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-12 15:12:33 +03:00
|
|
|
|
|
|
|
|
func TestHoursMinutesSeconds_UnmarshalByte(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
Otvet := HoursMinutesSeconds{}
|
2025-02-12 15:17:19 +03:00
|
|
|
Otvet.UnmarshalJSON([]byte("01:02:03"))
|
2025-02-12 15:12:33 +03:00
|
|
|
if Otvet.Hours != 1 || Otvet.Minutes != 2 || Otvet.Seconds != 3 {
|
|
|
|
|
t.Error("TestHoursMinutesSeconds_UnmarshalByte error")
|
|
|
|
|
}
|
|
|
|
|
}
|