Home | History | Annotate | Download | only in time

Lines Matching refs:tt

303 	for _, tt := range truncateRoundTests {
304 testOne(tt.t.Unix(), int64(tt.t.Nanosecond()), int64(tt.d))
550 for _, tt := range durationTests {
551 if str := tt.d.String(); str != tt.str {
552 t.Errorf("Duration(%d).String() = %s, want %s", int64(tt.d), str, tt.str)
554 if tt.d > 0 {
555 if str := (-tt.d).String(); str != "-"+tt.str {
556 t.Errorf("Duration(%d).String() = %s, want %s", int64(-tt.d), str, "-"+tt.str)
591 for _, tt := range dateTests {
592 time := Date(tt.year, Month(tt.month), tt.day, tt.hour, tt.min, tt.sec, tt.nsec, tt.z)
593 want := Unix(tt.unix, 0)
596 tt.year, tt.month, tt.day, tt.hour, tt.min, tt.sec, tt.nsec, tt.z,
642 for _, tt := range daysInTests {
643 di := DaysIn(Month(tt.month), tt.year)
644 if di != tt.di {
646 di, tt.di, tt.year, tt.month)
681 for _, tt := range gobTests {
683 if err := enc.Encode(&tt); err != nil {
684 t.Errorf("%v gob Encode error = %q, want nil", tt, err)
686 t.Errorf("%v gob Decode error = %q, want nil", tt, err)
687 } else if !equalTimeAndZone(gobtt, tt) {
688 t.Errorf("Decoded time = %v, want %v", gobtt, tt)
704 for _, tt := range invalidEncodingTests {
706 err := ignored.GobDecode(tt.bytes)
707 if err == nil || err.Error() != tt.want {
708 t.Errorf("time.GobDecode(%#v) error = %v, want %v", tt.bytes, err, tt.want)
710 err = ignored.UnmarshalBinary(tt.bytes)
711 if err == nil || err.Error() != tt.want {
712 t.Errorf("time.UnmarshalBinary(%#v) error = %v, want %v", tt.bytes, err, tt.want)
728 for _, tt := range notEncodableTimes {
729 _, err := tt.time.GobEncode()
730 if err == nil || err.Error() != tt.want {
731 t.Errorf("%v GobEncode error = %v, want %v", tt.time, err, tt.want)
733 _, err = tt.time.MarshalBinary()
734 if err == nil || err.Error() != tt.want {
735 t.Errorf("%v MarshalBinary error = %v, want %v", tt.time, err, tt.want)
750 for _, tt := range jsonTests {
753 if jsonBytes, err := json.Marshal(tt.time); err != nil {
754 t.Errorf("%v json.Marshal error = %v, want nil", tt.time, err)
755 } else if string(jsonBytes) != tt.json {
756 t.Errorf("%v JSON = %#q, want %#q", tt.time, string(jsonBytes), tt.json)
758 t.Errorf("%v json.Unmarshal error = %v, want nil", tt.time, err)
759 } else if !equalTimeAndZone(jsonTime, tt.time) {
760 t.Errorf("Unmarshaled time = %v, want %v", jsonTime, tt.time)
766 var tt Time
767 err := json.Unmarshal([]byte(`{"now is the time":"buddy"}`), &tt)
783 for _, tt := range notJSONEncodableTimes {
784 _, err := tt.time.MarshalJSON()
785 if err == nil || err.Error() != tt.want {
786 t.Errorf("%v MarshalJSON error = %v, want %v", tt.time, err, tt.want)
999 for _, tt := range nsDurationTests {
1000 if got := tt.d.Nanoseconds(); got != tt.want {
1001 t.Errorf("d.Nanoseconds() = %d; want: %d", got, tt.want)
1014 for _, tt := range secDurationTests {
1015 if got := tt.d.Seconds(); got != tt.want {
1016 t.Errorf("d.Seconds() = %g; want: %g", got, tt.want)
1033 for _, tt := range minDurationTests {
1034 if got := tt.d.Minutes(); got != tt.want {
1035 t.Errorf("d.Minutes() = %g; want: %g", got, tt.want)
1052 for _, tt := range hourDurationTests {
1053 if got := tt.d.Hours(); got != tt.want {
1054 t.Errorf("d.Hours() = %g; want: %g", got, tt.want)
1144 for _, tt := range defaultLocTests {
1147 if !tt.f(t1, t2) {
1148 t.Errorf("Time{} and Time{}.UTC() behave differently for %s", tt.name)