magnetico/pkg/persistence/iso8601_test.go
Bora Alper dc420da802 cumulative commit! (see the description for changes)
magneticod:
!!! disabled the gradual increase in congestion control, for some reason we still can't detect congestion...
- `*net.UDPAddr` in dht/mainline instead of `net.Addr`
- fixed a bug when a very small extension message received
- simplified how peer adress is handled in bittorrent/metadata/sink
- simplified TrawlingResult in dht/mainline

magneticow:
- use WAL for sqlite3

persistence:
- use URL.String() instead of url.Path in sql.Open() so that URL parameters are not lost...
2018-08-03 11:28:50 +03:00

46 lines
641 B
Go

package persistence
import "testing"
var validDates = []struct {
date string
granularity Granularity
}{
{
"2018",
Year,
},
{
"2018-04",
Month,
},
{
"2018-W16",
Week,
},
{
"2018-04-20",
Day,
},
{
"2018-04-20T15",
Hour,
},
}
func TestParseISO8601(t *testing.T) {
for i, date := range validDates {
_, gr, err := ParseISO8601(date.date)
if err != nil {
t.Errorf("Error while parsing valid date #%d: %s", i+1, err.Error())
continue
}
if gr != date.granularity {
t.Errorf("Granularity of the date #%d is wrong! Got %d (expected %d)",
i+1, gr, date.granularity)
continue
}
}
}